Package ghidra.trace.database.listing

# Class AbstractDBTraceCodeUnit<T extends AbstractDBTraceCodeUnit<T>>

java.lang.Object
ghidra.program.database.DatabaseObject
ghidra.util.database.DBAnnotatedObject
ghidra.util.database.spatial.DBTreeRecord<TraceAddressSnapRange,TraceAddressSnapRange>
ghidra.util.database.spatial.DBTreeDataRecord<TraceAddressSnapRange,TraceAddressSnapRange,T>
ghidra.trace.database.map.DBTraceAddressSnapRangePropertyMapTree.AbstractDBTraceAddressSnapRangePropertyMapData<T>
ghidra.trace.database.listing.AbstractDBTraceCodeUnit<T>

Type Parameters:
  `T` - the implementation type of this unit

All Implemented Interfaces:
  `CodeUnit`, `MemBuffer`, `MemBufferMixin`, `PropertySet`, `DBTraceCodeUnitAdapter`, `TraceCodeUnit`, `TraceAddressSnapRange`, `BoundedShape<TraceAddressSnapRange>`, `BoundingShape<TraceAddressSnapRange>`, `Rectangle2D<Address,Long,TraceAddressSnapRange>`

Direct Known Subclasses:
  `DBTraceData`, `DBTraceInstruction`

public abstract class AbstractDBTraceCodeUnit<T extends AbstractDBTraceCodeUnit<T>> extends DBTraceAddressSnapRangePropertyMapTree.AbstractDBTraceAddressSnapRangePropertyMapData<T> implements DBTraceCodeUnitAdapter
An abstract implementation of a table-backed code unit

This is implemented as a data entry in an address-snap-range property map. This is not suitable for data components, nor for undefined units.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class ghidra.util.database.spatial.DBTreeDataRecord

  `DBTreeDataRecord.RecordEntry<DS extends BoundedShape<NS>,NS extends BoundingShape<NS>,T>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected ByteBuffer`
  `byteCache`
  `protected final DBTraceCodeSpace`
  `space`

  ### Fields inherited from class ghidra.trace.database.map.DBTraceAddressSnapRangePropertyMapTree.AbstractDBTraceAddressSnapRangePropertyMapData

  `lifespan, range, tree`

  ### Fields inherited from class ghidra.program.database.DatabaseObject

  `key`

  ### Fields inherited from interface ghidra.program.model.listing.CodeUnit

  `COMMENT_PROPERTY, DEFINED_DATA_PROPERTY, EOL_COMMENT, INSTRUCTION_PROPERTY, MNEMONIC, PLATE_COMMENT, POST_COMMENT, PRE_COMMENT, REPEATABLE_COMMENT, SPACE_PROPERTY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractDBTraceCodeUnit(DBTraceCodeSpace space, DBTraceAddressSnapRangePropertyMapTree<T,?> tree, DBCachedObjectStore<?> store, DBRecord record)`
  Construct a code unit

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Address`
  `getAddress()`
  Get the Address which corresponds to the offset 0.
  `int`
  `getBytes(ByteBuffer buffer, int addressOffset)`
  Read bytes starting at this unit's address plus the given offset into the given buffer
  `long`
  `getEndSnap()`
  Get the end snap of this code unit
  `int`
  `getLength()`
  Get length of this code unit.
  `Address`
  `getMaxAddress()`
  Returns the ending address for this code unit..
  `long`
  `getStartSnap()`
  Get the start snap of this code unit
  `TraceThread`
  `getThread()`
  Get the thread associated with this code unit
  `DBTrace`
  `getTrace()`
  Get the trace in which this code unit exists
  `void`
  `setEndSnap(long endSnap)`
  Set the end snap of this code unit

  ### Methods inherited from class ghidra.trace.database.map.DBTraceAddressSnapRangePropertyMapTree.AbstractDBTraceAddressSnapRangePropertyMapData

  `doSetLifespan, doSetRange, equals, fresh, getBounds, getLifespan, getParentKey, getRange, getShape, getSpace, hashCode, setParentKey, setShape, shapeEquals`

  ### Methods inherited from class ghidra.util.database.spatial.DBTreeDataRecord

  `asEntry, getDataCount, getRecordValue, setRecordValue, toString`

  ### Methods inherited from class ghidra.util.database.DBAnnotatedObject

  `doRefresh, doUpdateAll, doUpdated, doWrite, getObjectKey, getTableName, isDeleted, refresh, refresh, update, update, update, update`

  ### Methods inherited from class ghidra.program.database.DatabaseObject

  `checkDeleted, checkIsValid, checkIsValid, getKey, isDeleted, isInvalid, keyChanged, setDeleted, setInvalid, validate`

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

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface ghidra.program.model.listing.CodeUnit

  `getAddress, getComment, getCommentAsArray, getMnemonicString, getNumOperands, getScalar, setComment, setCommentAsArray`

  ### Methods inherited from interface ghidra.trace.database.listing.DBTraceCodeUnitAdapter

  `addMnemonicReference, addOperandReference, compareTo, contains, getAddressSpace, getAddressString, getBytes, getBytesInCodeUnit, getComment, getCommentAsArray, getExternalReference, getIntProperty, getLabel, getMemory, getMinAddress, getMnemonicReferences, getObjectProperty, getOperandReferences, getPrimaryReference, getPrimarySymbol, getProgram, getProperty, getReferenceIteratorTo, getReferencesFrom, getStringProperty, getSymbols, getVoidProperty, hasProperty, isBigEndian, propertyNames, removeExternalReference, removeMnemonicReference, removeOperandReference, removeProperty, setComment, setCommentAsArray, setPrimaryMemoryReference, setProperty, setProperty, setProperty, setProperty, setProperty, setRegisterReference, setStackReference, setTypedProperty`

  ### Methods inherited from interface ghidra.program.model.mem.MemBuffer

  `getInputStream, getInputStream, getUnsignedByte, getUnsignedInt, getUnsignedShort, getVarLengthInt, getVarLengthUnsignedInt, isInitializedMemory`

  ### Methods inherited from interface ghidra.program.model.mem.MemBufferMixin

  `getBigInteger, getByte, getBytes, getBytesInFull, getInt, getLong, getShort`

  ### Methods inherited from interface ghidra.util.database.spatial.rect.Rectangle2D

  `computeAreaIntersection, computeAreaUnionBounds, computeCentroidDistance, contains, contains, doEquals, doHashCode, enclosedBy, encloses, getArea, getCenter, getMargin, intersection, intersects, unionBounds`

  ### Methods inherited from interface ghidra.trace.model.TraceAddressSnapRange

  `description, getX1, getX2, getY1, getY2, immutable`

  ### Methods inherited from interface ghidra.trace.model.listing.TraceCodeUnit

  `delete, getBounds, getLanguage, getLifespan, getPlatform, getRange`

- ## Field Details

  - ### space

    protected final DBTraceCodeSpace space

  - ### byteCache

    protected ByteBuffer byteCache

- ## Constructor Details

  - ### AbstractDBTraceCodeUnit

    public AbstractDBTraceCodeUnit(DBTraceCodeSpace space, DBTraceAddressSnapRangePropertyMapTree<T,?> tree, DBCachedObjectStore<?> store, DBRecord record)
    Construct a code unit
    Parameters:
      `space` - the space
      `tree` - the storage R*-Tree
      `store` - the object store
      `record` - the record

- ## Method Details

  - ### getAddress

    public Address getAddress()
    Description copied from interface: `MemBuffer`
    Get the Address which corresponds to the offset 0.
    Specified by:
      `getAddress` in interface `MemBuffer`
    Returns:
      the current address of offset 0.

  - ### getMaxAddress

    public Address getMaxAddress()
    Description copied from interface: `CodeUnit`
    Returns the ending address for this code unit..
    Specified by:
      `getMaxAddress` in interface `CodeUnit`
    Returns:
      the ending address for this code unit.

  - ### getLength

    public int getLength()
    Description copied from interface: `CodeUnit`
    Get length of this code unit. NOTE: If an `instruction length-override` is set this method will return the reduced length.
    Specified by:
      `getLength` in interface `CodeUnit`
    Returns:
      code unit length

  - ### getThread

    public TraceThread getThread()
    Description copied from interface: `TraceCodeUnit`
    Get the thread associated with this code unit

    A thread is associated with a code unit if it exists in a register space

    Specified by:
      `getThread` in interface `TraceCodeUnit`
    Returns:
      the thread

  - ### getTrace

    public DBTrace getTrace()
    Description copied from interface: `TraceCodeUnit`
    Get the trace in which this code unit exists
    Specified by:
      `getTrace` in interface `DBTraceCodeUnitAdapter`
    Specified by:
      `getTrace` in interface `TraceCodeUnit`
    Returns:
      the trace

  - ### getStartSnap

    public long getStartSnap()
    Description copied from interface: `TraceCodeUnit`
    Get the start snap of this code unit
    Specified by:
      `getStartSnap` in interface `TraceCodeUnit`
    Returns:
      the first snap of this unit's lifespan

  - ### setEndSnap

    public void setEndSnap(long endSnap)
    Description copied from interface: `TraceCodeUnit`
    Set the end snap of this code unit
    Specified by:
      `setEndSnap` in interface `TraceCodeUnit`
    Parameters:
      `endSnap` - the last snap of this unit's lifespan

  - ### getEndSnap

    public long getEndSnap()
    Description copied from interface: `TraceCodeUnit`
    Get the end snap of this code unit
    Specified by:
      `getEndSnap` in interface `TraceCodeUnit`
    Returns:
      the last snap of this unit's lifespan

  - ### getBytes

    public int getBytes(ByteBuffer buffer, int addressOffset)
    Description copied from interface: `TraceCodeUnit`
    Read bytes starting at this unit's address plus the given offset into the given buffer

    This method honors the markers (position and limit) of the destination buffer. Use those markers to control the destination offset and maximum length.

    Specified by:
      `getBytes` in interface `MemBufferMixin`
    Specified by:
      `getBytes` in interface `TraceCodeUnit`
    Parameters:
      `buffer` - the destination buffer
      `addressOffset` - the offset from this unit's (minimum) address
    Returns:
      the number of bytes read