Class DBTraceData

All Implemented Interfaces:
Settings, CodeUnit, Data, MemBuffer, MemBufferMixin, PropertySet, DBTraceCodeUnitAdapter, DBTraceDataAdapter, DBTraceDefinedDataAdapter, TraceCodeUnit, TraceData, TraceAddressSnapRange, DataAdapterFromDataType, DataAdapterFromSettings, DataAdapterMinimal, BoundedShape<TraceAddressSnapRange>, BoundingShape<TraceAddressSnapRange>, Rectangle2D<Address,Long,TraceAddressSnapRange>

public class DBTraceData extends AbstractDBTraceCodeUnit<DBTraceData> implements DBTraceDefinedDataAdapter
The implementation for a defined TraceData for DBTrace
  • Field Details

  • Constructor Details

  • Method Details

    • fresh

      protected void fresh(boolean created) throws IOException
      Description copied from class: DBAnnotatedObject
      Extension point: Called when the object's fields are populated.

      This provides an opportunity for the object to initialize any non-database-backed fields that depend on the database-backed fields. Note that its use may indicate a situation better solved by a custom DBCachedObjectStoreFactory.DBFieldCodec. If both the database-backed and non-database-backed fields are used frequently, then a codec may not be indicated. If the database-backed fields are only used in this method or to encode another frequently-used field, then a codec is likely better.

      For a new object, the database-backed fields remain at their initial values. They will be saved after this method returns, so they may be further initialized with custom logic.

      For an object loaded from the database, the database-backed fields are already populated from the record when this method is called. They are not automatically saved after this method returns. This method should not further initialize database-backed fields in this case.

      Overrides:
      fresh in class DBTraceAddressSnapRangePropertyMapTree.AbstractDBTraceAddressSnapRangePropertyMapData<DBTraceData>
      Parameters:
      created - true when object is being created, or false when it is being loaded.
      Throws:
      IOException - if further initialization fails.
    • setRecordValue

      protected void setRecordValue(DBTraceData value)
      Description copied from class: DBTreeDataRecord
      Set the value of this record Note that the value is sometimes the record itself. In this case, this method expects value to be null and does nothing. See SpatialMap.put(BoundedShape, Object) for more details of this pattern.
      Specified by:
      setRecordValue in class DBTreeDataRecord<TraceAddressSnapRange,TraceAddressSnapRange,DBTraceData>
      Parameters:
      value - the record's new value
    • getRecordValue

      protected DBTraceData getRecordValue()
      Description copied from class: DBTreeDataRecord
      Get the value of this record Note that the value is sometimes the record itself, i.e., this method returns this. See SpatialMap.put(BoundedShape, Object) for more details of this pattern.
      Specified by:
      getRecordValue in class DBTreeDataRecord<TraceAddressSnapRange,TraceAddressSnapRange,DBTraceData>
      Returns:
      the record's value
    • set

      protected void set(InternalTracePlatform platform, long dataTypeID)
      Set the fields of this record
      Parameters:
      platform - the platform
      dataTypeID - the data type id
    • getDataTypeLength

      protected int getDataTypeLength()
      If this unit's data type has a fixed length, get that length
      Returns:
      the length, or -1
    • getBaseDataType

      public static DataType getBaseDataType(DataType dt)
      Get the base data type of the given data type, following typedefs recursively
      Parameters:
      dt - the data type
      Returns:
      the base data type
    • getPlatform

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

      public void delete()
      Description copied from interface: TraceCodeUnit
      Delete this code unit
      Specified by:
      delete in interface TraceCodeUnit
    • 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
      Overrides:
      setEndSnap in class AbstractDBTraceCodeUnit<DBTraceData>
      Parameters:
      endSnap - the last snap of this unit's lifespan
    • 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
    • toString

      public String toString()
      Overrides:
      toString in class DBTreeDataRecord<TraceAddressSnapRange,TraceAddressSnapRange,DBTraceData>
    • 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
    • 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
    • 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
    • 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
    • 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.
    • getFieldName

      public String getFieldName()
      Description copied from interface: Data
      Get the field name of this data item if it is "inside" another data item, otherwise return null.
      Specified by:
      getFieldName in interface Data
      Returns:
      the name of this data as known from some parent data item or null if this data item is not a component of another data item.
    • getPathName

      public String getPathName()
      Description copied from interface: Data
      Returns the full path name (dot notation) for this field. This includes the symbol name at this address.
      Specified by:
      getPathName in interface Data
      Returns:
      the path name
    • getComponentPathName

      public String getComponentPathName()
      Description copied from interface: Data
      Returns the component path name (dot notation) for this field
      Specified by:
      getComponentPathName in interface Data
      Returns:
      the component path name
    • getPathName

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

      public DBTraceDataSettingsOperations 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