Package ghidra.pcode.exec.trace

# Class TraceEmulationIntegration.BytesPieceHandler

java.lang.Object
ghidra.pcode.exec.trace.TraceEmulationIntegration.BytesPieceHandler

All Implemented Interfaces:
  `TraceEmulationIntegration.PieceHandler<byte[],byte[]>`

Direct Known Subclasses:
  `TraceEmulationIntegration.ImmediateBytesPieceHandler`

Enclosing class:
  `TraceEmulationIntegration`

public static class TraceEmulationIntegration.BytesPieceHandler extends Object implements TraceEmulationIntegration.PieceHandler<byte[],byte[]>
A handler that implements the lazy-read-writer-later pattern of trace integration for a concrete emulator's bytes.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `CHUNK_SIZE`
  The maximum number of bytes to buffer at a time

  ### Fields inherited from interface ghidra.pcode.exec.trace.TraceEmulationIntegration.PieceHandler

  `NONE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BytesPieceHandler()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Class<byte[]>`
  `getAddressDomain()`
  Get the address domain this can handle
  `Class<byte[]>`
  `getValueDomain()`
  Get the value domain this can handle
  `AddressSetView`
  `readUninitialized(PcodeTraceDataAccess acc, PcodeThread<?> thread, PcodeExecutorStatePiece<byte[],byte[]> piece, AddressSetView set)`
  An uninitialized portion of a state piece is being read (concrete addressing).
  `void`
  `writeDown(PcodeTraceDataAccess into, PcodeThread<?> thread, PcodeExecutorStatePiece<byte[],byte[]> piece, AddressSetView written)`
  Serialize a given portion of the state to the trace database.

  ### 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.trace.TraceEmulationIntegration.PieceHandler

  `abstractReadUninit, abstractWritten, dataWritten`

- ## Field Details

  - ### CHUNK_SIZE

    public static final int CHUNK_SIZE
    The maximum number of bytes to buffer at a time
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### BytesPieceHandler

    public BytesPieceHandler()

- ## Method Details

  - ### getAddressDomain

    public Class<byte[]> getAddressDomain()
    Description copied from interface: `TraceEmulationIntegration.PieceHandler`
    Get the address domain this can handle
    Specified by:
      `getAddressDomain` in interface `TraceEmulationIntegration.PieceHandler<byte[],byte[]>`
    Returns:
      the address domain

  - ### getValueDomain

    public Class<byte[]> getValueDomain()
    Description copied from interface: `TraceEmulationIntegration.PieceHandler`
    Get the value domain this can handle
    Specified by:
      `getValueDomain` in interface `TraceEmulationIntegration.PieceHandler<byte[],byte[]>`
    Returns:
      the value domain

  - ### readUninitialized

    public AddressSetView readUninitialized(PcodeTraceDataAccess acc, PcodeThread<?> thread, PcodeExecutorStatePiece<byte[],byte[]> piece, AddressSetView set)
    Description copied from interface: `TraceEmulationIntegration.PieceHandler`
    An uninitialized portion of a state piece is being read (concrete addressing).
    Specified by:
      `readUninitialized` in interface `TraceEmulationIntegration.PieceHandler<byte[],byte[]>`
    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)`

  - ### writeDown

    public void writeDown(PcodeTraceDataAccess into, PcodeThread<?> thread, PcodeExecutorStatePiece<byte[],byte[]> piece, AddressSetView written)
    Description copied from interface: `TraceEmulationIntegration.PieceHandler`
    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.

    Specified by:
      `writeDown` in interface `TraceEmulationIntegration.PieceHandler<byte[],byte[]>`
    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