Package ghidra.pcode.exec.trace

# Interface TraceEmulationIntegration.PieceHandler<A,T>

Type Parameters:
  `A` - the address domain of pieces this can handle
  `T` - the value domain of pieces this can handle

All Known Implementing Classes:
  `TaintPieceHandler`, `TraceEmulationIntegration.AbstractPropertyBasedPieceHandler`, `TraceEmulationIntegration.AbstractSimplePropertyBasedPieceHandler`, `TraceEmulationIntegration.BytesPieceHandler`, `TraceEmulationIntegration.ImmediateBytesPieceHandler`

Enclosing class:
  `TraceEmulationIntegration`

public static interface TraceEmulationIntegration.PieceHandler<A,T>
The handler for a specific piece within an emulator's (or executor's) state.

See Also:
  - `PcodeExecutorStatePiece`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final TraceEmulationIntegration.PieceHandler<?,?>`
  `NONE`
  A handler that does nothing

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default int`
  `abstractReadUninit(PcodeTraceDataAccess acc, PcodeThread<?> thread, PcodeExecutorStatePiece<A,T> piece, AddressSpace space, A offset, int length)`
  An uninitialized portion of a state piece is being read (abstract addressing).
  `default void`
  `abstractWritten(PcodeTraceDataAccess acc, AddressSet written, PcodeThread<?> thread, PcodeExecutorStatePiece<A,T> piece, AddressSpace space, A offset, int length, T value)`
  Data was written (abstract addressing).
  `default boolean`
  `dataWritten(PcodeTraceDataAccess acc, AddressSet written, PcodeThread<?> thread, PcodeExecutorStatePiece<A,T> piece, Address address, int length, T value)`
  Data was written (concrete addressing).
  `Class<A>`
  `getAddressDomain()`
  Get the address domain this can handle
  `Class<T>`
  `getValueDomain()`
  Get the value domain this can handle
  `AddressSetView`
  `readUninitialized(PcodeTraceDataAccess acc, PcodeThread<?> thread, PcodeExecutorStatePiece<A,T> piece, AddressSetView set)`
  An uninitialized portion of a state piece is being read (concrete addressing).
  `void`
  `writeDown(PcodeTraceDataAccess into, PcodeThread<?> thread, PcodeExecutorStatePiece<A,T> piece, AddressSetView written)`
  Serialize a given portion of the state to the trace database.

- ## Field Details

  - ### NONE

    static final TraceEmulationIntegration.PieceHandler<?,?> NONE
    A handler that does nothing

- ## Method Details

  - ### getAddressDomain

    Class<A> getAddressDomain()
    Get the address domain this can handle
    Returns:
      the address domain

  - ### getValueDomain

    Class<T> getValueDomain()
    Get the value domain this can handle
    Returns:
      the value domain

  - ### readUninitialized

    AddressSetView readUninitialized(PcodeTraceDataAccess acc, PcodeThread<?> thread, PcodeExecutorStatePiece<A,T> piece, AddressSetView set)
    An uninitialized portion of a state piece is being read (concrete addressing).
    Parameters:
      `acc` - the trace access shim for the relevant state (shared or local)
      `thread` - the thread, if applicable. This is null if either the state being accessed is the emulator's shared state, or if the state is bound to a plain `PcodeExecutor`.
      `piece` - the state piece being handled
      `set` - the uninitialized portion required
    Returns:
      the addresses in `set` that remain uninitialized
    See Also:
      - `PcodeEmulationCallbacks.readUninitialized(PcodeThread, PcodeExecutorStatePiece, AddressSetView)`

  - ### abstractReadUninit

    default int abstractReadUninit(PcodeTraceDataAccess acc, PcodeThread<?> thread, PcodeExecutorStatePiece<A,T> piece, AddressSpace space, A offset, int length)
    An uninitialized portion of a state piece is being read (abstract addressing).
    Parameters:
      `acc` - the trace access shim for the relevant state (shared or local)
      `thread` - the thread, if applicable. This is null if either the state being accessed is the emulator's shared state, or if the state is bound to a plain `PcodeExecutor`.
      `piece` - the state piece being handled
      `space` - the address space
      `offset` - the offset at the start of the uninitialized portion
      `length` - the size in bytes of the uninitialized portion
    Returns:
      the number of bytes just initialized, typically 0 or `length`
    See Also:
      - `PcodeEmulationCallbacks.readUninitialized(PcodeThread, PcodeExecutorStatePiece, AddressSpace, Object, int)`

  - ### dataWritten

    default boolean dataWritten(PcodeTraceDataAccess acc, AddressSet written, PcodeThread<?> thread, PcodeExecutorStatePiece<A,T> piece, Address address, int length, T value)
    Data was written (concrete addressing).
    Parameters:
      `acc` - the trace access shim for the relevant state (shared or local)
      `written` - the `TraceEmulationIntegration.Writer`'s current log of written addresses (mutable). Typically, this is not accessed but rather passed to delegate methods.
      `thread` - the thread, if applicable. This is null if either the state being accessed is the emulator's shared state, or if the state is bound to a plain `PcodeExecutor`.
      `piece` - the state piece being handled
      `address` - the start address of the write
      `length` - the size in bytes of the write
      `value` - the value written
    Returns:
      true to prevent the `TraceEmulationIntegration.Writer` from updating its log.
    See Also:
      - `PcodeEmulationCallbacks.dataWritten(PcodeThread, PcodeExecutorStatePiece, Address, int, Object)`

  - ### abstractWritten

    default void abstractWritten(PcodeTraceDataAccess acc, AddressSet written, PcodeThread<?> thread, PcodeExecutorStatePiece<A,T> piece, AddressSpace space, A offset, int length, T value)
    Data was written (abstract addressing).
    Parameters:
      `acc` - the trace access shim for the relevant state (shared or local)
      `written` - the `TraceEmulationIntegration.Writer`'s current log of written addresses (mutable). Typically, this is not accessed but rather passed to delegate methods.
      `thread` - the thread, if applicable. This is null if either the state being accessed is the emulator's shared state, or if the state is bound to a plain `PcodeExecutor`.
      `piece` - the state piece being handled
      `space` - the address space
      `offset` - the offset of the start of the write
      `length` - the size in bytes of the write
      `value` - the value written
    See Also:
      - `PcodeEmulationCallbacks.dataWritten(PcodeThread, PcodeExecutorStatePiece, AddressSpace, Object, int, Object)`

  - ### writeDown

    void writeDown(PcodeTraceDataAccess into, PcodeThread<?> thread, PcodeExecutorStatePiece<A,T> piece, AddressSetView written)
    Serialize a given portion of the state to the trace database.

    The "given portion" refers to the address set provided in `written`. Pieces may also have state assigned to abstract addresses. In such cases, it is up to the handler to track what has been written.

    Parameters:
      `into` - the destination trace access
      `thread` - the thread associated with the piece's state
      `piece` - the source state piece
      `written` - the portion that is known to have been written