Class AbstractDBTraceDataComponent

java.lang.Object
ghidra.trace.database.listing.AbstractDBTraceDataComponent
All Implemented Interfaces:
Settings, CodeUnit, Data, MemBuffer, MemBufferMixin, PropertySet, DBTraceCodeUnitAdapter, DBTraceDataAdapter, DBTraceDefinedDataAdapter, TraceCodeUnit, TraceData, DataAdapterFromDataType, DataAdapterFromSettings, DataAdapterMinimal
Direct Known Subclasses:
DBTraceDataArrayElementComponent, DBTraceDataCompositeFieldComponent

public abstract class AbstractDBTraceDataComponent extends Object implements DBTraceDefinedDataAdapter
An abstract implementation of a TraceData for a data component, i.e., field of a struct or element of an array

These are not backed directly by a table. The root data unit, along with its type, is stored in the table. If the type is composite, then these are generated, possibly recursively, for the components therein.

  • Field Details

    • root

      protected final DBTraceData root
    • parent

      protected final DBTraceDefinedDataAdapter parent
    • index

      protected final int index
    • address

      protected final Address address
    • dataType

      protected final DataType dataType
    • length

      protected final int length
    • level

      protected final int level
    • baseDataType

      protected final DataType baseDataType
    • maxAddress

      protected final Address maxAddress
    • defaultSettings

      protected final Settings defaultSettings
    • path

      protected int[] path
    • componentCache

      protected AbstractDBTraceDataComponent[] componentCache
  • Constructor Details

    • AbstractDBTraceDataComponent

      public AbstractDBTraceDataComponent(DBTraceData root, DBTraceDefinedDataAdapter parent, int index, Address address, DataType dataType, int length)
      Create a data component
      Parameters:
      root - the root data unit
      parent - the parent component, possibly the root
      index - the index of this component in its parent
      address - the minimum address of this component
      dataType - the data type of this component
      length - the length of this component
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • delete

      public void delete()
      Description copied from interface: TraceCodeUnit
      Delete this code unit
      Specified by:
      delete in interface TraceCodeUnit
    • 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
    • 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
    • getPlatform

      public TracePlatform getPlatform()
      Description copied from interface: TraceCodeUnit
      Get the platform for this unit
      Specified by:
      getPlatform in interface TraceCodeUnit
      Returns:
      the platform
    • getLanguage

      public Language getLanguage()
      Description copied from interface: TraceCodeUnit
      Get the language of this code unit

      Currently, for data units, this is always the base or "host" language of the trace. For instructions, this may be a guest language.

      Specified by:
      getLanguage in interface TraceCodeUnit
      Returns:
      the language
    • getLifespan

      public Lifespan getLifespan()
      Description copied from interface: TraceCodeUnit
      Get the lifespan of this code unit
      Specified by:
      getLifespan in interface TraceCodeUnit
      Returns:
      the lifespan
    • 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
    • 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
    • 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
    • doGetComponentCache

      public AbstractDBTraceDataComponent[] doGetComponentCache()
      Description copied from interface: DBTraceDefinedDataAdapter
      TODO: Document me Note this will always be called with the write lock
      Specified by:
      doGetComponentCache in interface DBTraceDefinedDataAdapter
      Returns:
      the new or existing component cache
    • getDataType

      public DataType getDataType()
      Description copied from interface: Data
      Get the Data type for the data.
      Specified by:
      getDataType in interface Data
      Returns:
      the data type
    • getBaseDataType

      public DataType getBaseDataType()
      Description copied from interface: Data
      If the dataType is a typeDef, then the typeDef's base type is returned, otherwise, the datatType is returned.
      Specified by:
      getBaseDataType in interface Data
      Returns:
      the data type
    • getComponentPath

      public int[] getComponentPath()
      Description copied from interface: Data
      Get the component path if this is a component. The component path is an array of integers that represent each index in the tree of data items. Top level data items have an empty array for their component path.
      Specified by:
      getComponentPath in interface Data
      Returns:
      the path
    • getPathName

      public String getPathName()
      Returns the full path name (dot notation) for this field. This includes the symbol name at this address.

      In other words, this includes the symbol name of the root unit; whereas, getComponentPathName() omits it.

      Specified by:
      getPathName in interface Data
      Returns:
      the path name
    • getComponentPathName

      public String getComponentPathName()
      Returns the component path name (dot notation) for this field

      In other words, this omits the symbol name of the root unit; whereas, getPathName() includes it.

      Specified by:
      getComponentPathName in interface Data
      Returns:
      the component path name
    • getFieldSyntax

      public abstract String getFieldSyntax()
    • getPathName

      public StringBuilder getPathName(StringBuilder builder, boolean includeRootSymbol)
      Specified by:
      getPathName in interface DBTraceDefinedDataAdapter
    • getParent

      public DBTraceDefinedDataAdapter getParent()
      Description copied from interface: Data
      Get the immediate parent data item of this data item or null if this data item is not contained in another data item.
      Specified by:
      getParent in interface Data
      Specified by:
      getParent in interface DBTraceDefinedDataAdapter
      Returns:
      the data
    • getRoot

      public DBTraceData getRoot()
      Description copied from interface: Data
      Get the highest level Data item in a hierarchy of structures containing this component.
      Specified by:
      getRoot in interface Data
      Specified by:
      getRoot in interface DBTraceDataAdapter
      Specified by:
      getRoot in interface DBTraceDefinedDataAdapter
      Returns:
      the data
    • getRootOffset

      public int getRootOffset()
      Description copied from interface: Data
      Get the offset of this Data item from the start of the root data item of some hierarchy of structures.
      Specified by:
      getRootOffset in interface Data
      Returns:
      the offset
    • getParentOffset

      public int getParentOffset()
      Description copied from interface: Data
      Get the offset of this Data item from the start of its immediate parent.
      Specified by:
      getParentOffset in interface Data
      Returns:
      the offset
    • getComponentIndex

      public int getComponentIndex()
      Description copied from interface: Data
      Get the index of this component in its parent
      Specified by:
      getComponentIndex in interface Data
      Returns:
      -1 if this data item is not a component of another data item.
    • getComponentLevel

      public int getComponentLevel()
      Description copied from interface: Data
      Get this data's component level in its hierarchy of components.
      Specified by:
      getComponentLevel in interface Data
      Returns:
      the level of this data item with 0 being the level of top data items.
    • getSettingsSpace

      public DBTraceDataSettingsAdapter.DBTraceDataSettingsSpace getSettingsSpace(boolean createIfAbsent)
      Description copied from interface: DBTraceDataAdapter
      Get the same space from the internal settings adapter
      Specified by:
      getSettingsSpace in interface DBTraceDataAdapter
      Parameters:
      createIfAbsent - true to create the space if its not already present
      Returns:
      the space or null
    • getDefaultSettings

      public Settings getDefaultSettings()
      Description copied from interface: Settings
      Returns the underlying default settings for these settings or null if there are none
      Specified by:
      getDefaultSettings in interface Settings
      Returns:
      underlying default settings or null