Class TraceEmulationIntegration.AbstractSimplePropertyBasedPieceHandler<A,T,P>

java.lang.Object
ghidra.pcode.exec.trace.TraceEmulationIntegration.AbstractPropertyBasedPieceHandler<A,T,P>
ghidra.pcode.exec.trace.TraceEmulationIntegration.AbstractSimplePropertyBasedPieceHandler<A,T,P>
Type Parameters:
A - the address domain of the piece
T - the value domain of the piece
P - the type of the property map
All Implemented Interfaces:
TraceEmulationIntegration.PieceHandler<A,T>
Enclosing class:
TraceEmulationIntegration

public abstract static class TraceEmulationIntegration.AbstractSimplePropertyBasedPieceHandler<A,T,P> extends TraceEmulationIntegration.AbstractPropertyBasedPieceHandler<A,T,P>
A misguided simplification of TraceEmulationIntegration.AbstractPropertyBasedPieceHandler that reduces the requirement to a simple codec.

For cases where subpiecing of variables is not of concern, this simplification may suffice. This is usually okay for proofs of concept or very simplistic architectures. However, once you introduce structured/aliased registers (e.g., EAX is the lower 32 bits of RAX), or you're dealing with off-cut memory references, you have to deal with subpiecing and this simplification is no longer viable.

  • Constructor Details

    • AbstractSimplePropertyBasedPieceHandler

      public AbstractSimplePropertyBasedPieceHandler()
  • Method Details

    • decode

      protected abstract T decode(P propertyValue)
      Decode a state value from the given property value
      Parameters:
      propertyValue - the property value
      Returns:
      the decoded state value
    • decodeFrom

      protected void decodeFrom(PcodeExecutorStatePiece<A,T> piece, AddressSetView limit, AddressRange range, P propertyValue)
      Decode a property entry and set appropriate variable(s) in the piece

      The found property entry may cover more addresses than are actually required, either because they've not been requested or because the value has already been set. Writing a value that wasn't requested isn't too bad, but writing one that was already initialized could be catastrophic.

      Specified by:
      decodeFrom in class TraceEmulationIntegration.AbstractPropertyBasedPieceHandler<A,T,P>
      Parameters:
      piece - the piece with uninitialized variables to decode from a property
      limit - the portion that is requested and uninitialized. DO NOT initialize any address outside of this set.
      range - the range covered by the found property entry
      propertyValue - the value of the property entry
    • encode

      protected abstract P encode(T value)
      Encode a state value into a property value
      Parameters:
      value - the state value
      Returns:
      the encoded property value
    • encodeInto

      protected void encodeInto(PcodeTracePropertyAccess<P> property, AddressRange range, T value)
      Encode a variable's value into a property entry
      Specified by:
      encodeInto in class TraceEmulationIntegration.AbstractPropertyBasedPieceHandler<A,T,P>
      Parameters:
      property - the property map (access shim)
      range - the variable's address range (this may optionally be coalesced from several variables by the piece's internals)
      value - the variable's value