Package ghidra.pcode.exec.trace

# Class AddressesReadTracePcodeExecutorStatePiece

java.lang.Object
ghidra.pcode.exec.AbstractLongOffsetPcodeExecutorStatePiece<byte[],AddressSetView,AddressSpace>
ghidra.pcode.exec.trace.AddressesReadTracePcodeExecutorStatePiece

All Implemented Interfaces:
  `PcodeExecutorStatePiece<byte[],AddressSetView>`

public class AddressesReadTracePcodeExecutorStatePiece extends AbstractLongOffsetPcodeExecutorStatePiece<byte[],AddressSetView,AddressSpace> implements PcodeExecutorStatePiece<byte[],AddressSetView>
An auxilliary state piece that reports the (trace) address ranges

Except for unique spaces, sets are ignored, and gets simply echo back the range of addresses of the requested read. In unique spaces, the "addresses read" is treated as the value, so that values transiting unique space can correct have their source address ranges reported. Use this with `AddressesReadPcodeArithmetic` to compute the union of these ranges during Sleigh expression evaluation. The ranges are translated from the guest platform, if applicable, to the trace address. In the case of registers, the addresses are also translated to the appropriate overlay space, if applicable.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface ghidra.pcode.exec.PcodeExecutorStatePiece

  `PcodeExecutorStatePiece.Reason`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final PcodeTraceDataAccess`
  `data`

  ### Fields inherited from class ghidra.pcode.exec.AbstractLongOffsetPcodeExecutorStatePiece

  `addressArithmetic, arithmetic, cb, language, uniqueSpace`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `AddressesReadTracePcodeExecutorStatePiece(PcodeTraceDataAccess data)`
  Construct the state piece
  `protected`
  `AddressesReadTracePcodeExecutorStatePiece(PcodeTraceDataAccess data, Map<Long,AddressSetView> unique)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected AddressSetView`
  `checkSize(int size, AddressSetView val)`
  Check that the size of the value matches that given
  `void`
  `clear()`
  Erase the entire state or piece
  `AddressesReadTracePcodeExecutorStatePiece`
  `fork(PcodeStateCallbacks cb)`
  Create a deep copy of this state
  `MemBuffer`
  `getConcreteBuffer(Address address, PcodeArithmetic.Purpose purpose)`
  Bind a buffer of concrete bytes at the given start address
  `protected AddressSpace`
  `getForSpace(AddressSpace space, boolean toWrite)`
  Get the internal space for the given address space
  `protected AddressSetView`
  `getFromSpace(AddressSpace space, long offset, int size, PcodeExecutorStatePiece.Reason reason, PcodeStateCallbacks cb)`
  Get a value from the given space
  `Map<Register,AddressSetView>`
  `getRegisterValues()`
  Get all register values known to this state
  `protected Map<Register,AddressSetView>`
  `getRegisterValuesFromSpace(AddressSpace s, List<Register> registers)`
  Can the given space for register values, as in `AbstractLongOffsetPcodeExecutorStatePiece.getRegisterValues()`
  `protected void`
  `setInSpace(AddressSpace space, long offset, int size, AddressSetView val, PcodeStateCallbacks cb)`
  Set a value in the given space

  ### Methods inherited from class ghidra.pcode.exec.AbstractLongOffsetPcodeExecutorStatePiece

  `forkMap, getAddressArithmetic, getArithmetic, getFromNullSpace, getLanguage, getUnique, getVar, getVar, getVarInternal, getVarInternal, getVarInternal, setUnique, setVar, setVar, setVarInternal, setVarInternal, setVarInternal, streamPieces`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface ghidra.pcode.exec.PcodeExecutorStatePiece

  `checkRange, getAddressArithmetic, getArithmetic, getLanguage, getNextEntryInternal, getNextEntryInternal, getVar, getVar, getVar, getVar, getVar, getVarInternal, getVarInternal, inspectBigInteger, inspectByte, inspectConcrete, inspectInt, inspectLong, inspectRegisterValue, inspectShort, quantizeOffset, setBigInteger, setByte, setConcrete, setInt, setLong, setRegisterValue, setRegisterValue, setShort, setVar, setVar, setVar, setVar, setVar, setVarInternal, setVarInternal, streamPieces`

- ## Field Details

  - ### data

    protected final PcodeTraceDataAccess data

- ## Constructor Details

  - ### AddressesReadTracePcodeExecutorStatePiece

    protected AddressesReadTracePcodeExecutorStatePiece(PcodeTraceDataAccess data, Map<Long,AddressSetView> unique)

  - ### AddressesReadTracePcodeExecutorStatePiece

    public AddressesReadTracePcodeExecutorStatePiece(PcodeTraceDataAccess data)
    Construct the state piece
    Parameters:
      `data` - the trace data access shim

- ## Method Details

  - ### checkSize

    protected AddressSetView checkSize(int size, AddressSetView val)
    Description copied from class: `AbstractLongOffsetPcodeExecutorStatePiece`
    Check that the size of the value matches that given

    Extensions may override this and do nothing when the abstract type has no defined size

    Overrides:
      `checkSize` in class `AbstractLongOffsetPcodeExecutorStatePiece<byte[],AddressSetView,AddressSpace>`
    Parameters:
      `size` - the size in bytes
      `val` - the value
    Returns:
      the value, possibly adjusted

  - ### getConcreteBuffer

    public MemBuffer getConcreteBuffer(Address address, PcodeArithmetic.Purpose purpose)
    Description copied from interface: `PcodeExecutorStatePiece`
    Bind a buffer of concrete bytes at the given start address
    Specified by:
      `getConcreteBuffer` in interface `PcodeExecutorStatePiece<byte[],AddressSetView>`
    Parameters:
      `address` - the start address
      `purpose` - the reason why the emulator needs a concrete value
    Returns:
      a buffer

  - ### fork

    public AddressesReadTracePcodeExecutorStatePiece fork(PcodeStateCallbacks cb)
    Description copied from interface: `PcodeExecutorStatePiece`
    Create a deep copy of this state
    Specified by:
      `fork` in interface `PcodeExecutorStatePiece<byte[],AddressSetView>`
    Parameters:
      `cb` - callbacks to receive emulation events
    Returns:
      the copy

  - ### getRegisterValuesFromSpace

    protected Map<Register,AddressSetView> getRegisterValuesFromSpace(AddressSpace s, List<Register> registers)
    Description copied from class: `AbstractLongOffsetPcodeExecutorStatePiece`
    Can the given space for register values, as in `AbstractLongOffsetPcodeExecutorStatePiece.getRegisterValues()`
    Specified by:
      `getRegisterValuesFromSpace` in class `AbstractLongOffsetPcodeExecutorStatePiece<byte[],AddressSetView,AddressSpace>`
    Parameters:
      `s` - the space to scan
      `registers` - the registers known to be in the corresponding address space
    Returns:
      the map of registers to values

  - ### getRegisterValues

    public Map<Register,AddressSetView> getRegisterValues()
    Description copied from interface: `PcodeExecutorStatePiece`
    Get all register values known to this state

    When the state acts as a cache, it should only return those cached.

    Specified by:
      `getRegisterValues` in interface `PcodeExecutorStatePiece<byte[],AddressSetView>`
    Overrides:
      `getRegisterValues` in class `AbstractLongOffsetPcodeExecutorStatePiece<byte[],AddressSetView,AddressSpace>`
    Returns:
      a map of registers and their values

  - ### getForSpace

    protected AddressSpace getForSpace(AddressSpace space, boolean toWrite)
    Description copied from class: `AbstractLongOffsetPcodeExecutorStatePiece`
    Get the internal space for the given address space
    Specified by:
      `getForSpace` in class `AbstractLongOffsetPcodeExecutorStatePiece<byte[],AddressSetView,AddressSpace>`
    Parameters:
      `space` - the address space
      `toWrite` - in case internal spaces are generated lazily, this indicates the space must be present, because it is going to be written to.
    Returns:
      the space, or `null`

  - ### setInSpace

    protected void setInSpace(AddressSpace space, long offset, int size, AddressSetView val, PcodeStateCallbacks cb)
    Description copied from class: `AbstractLongOffsetPcodeExecutorStatePiece`
    Set a value in the given space
    Specified by:
      `setInSpace` in class `AbstractLongOffsetPcodeExecutorStatePiece<byte[],AddressSetView,AddressSpace>`
    Parameters:
      `space` - the address space
      `offset` - the offset within the space
      `size` - the number of bytes to write (the size of the value)
      `val` - the value to store
      `cb` - callbacks to receive emulation events

  - ### getFromSpace

    protected AddressSetView getFromSpace(AddressSpace space, long offset, int size, PcodeExecutorStatePiece.Reason reason, PcodeStateCallbacks cb)
    Description copied from class: `AbstractLongOffsetPcodeExecutorStatePiece`
    Get a value from the given space
    Specified by:
      `getFromSpace` in class `AbstractLongOffsetPcodeExecutorStatePiece<byte[],AddressSetView,AddressSpace>`
    Parameters:
      `space` - the address space
      `offset` - the offset within the space
      `size` - the number of bytes to read (the size of the value)
      `reason` - the reason for reading state
      `cb` - callbacks to receive emulation events
    Returns:
      the read value

  - ### clear

    public void clear()
    Description copied from interface: `PcodeExecutorStatePiece`
    Erase the entire state or piece

    This is generally only useful when the state is itself a cache to another object. This will ensure the state is reading from that object rather than a stale cache. If this is not a cache, this could in fact clear the whole state, and the machine using it will be left in the dark.

    Specified by:
      `clear` in interface `PcodeExecutorStatePiece<byte[],AddressSetView>`