Class UndefinedDBTraceData

java.lang.Object
ghidra.trace.database.listing.UndefinedDBTraceData
All Implemented Interfaces:
Settings, CodeUnit, Data, MemBuffer, MemBufferMixin, PropertySet, DBTraceCodeUnitAdapter, DBTraceDataAdapter, TraceCodeUnit, TraceData, DataAdapterFromDataType, DataAdapterFromSettings, DataAdapterMinimal, TraceSpaceMixin
Direct Known Subclasses:
AbstractDBTraceProgramViewListing.DBTraceProgramViewUndefinedData

public class UndefinedDBTraceData extends Object implements DBTraceDataAdapter, TraceSpaceMixin
The implementation for an undefined TraceData for DBTrace

These are not backed by a table. They are generated ephemerally. Each is exactly one unit in size in both time and space.

  • Field Details

    • trace

      protected final DBTrace trace
    • snap

      protected final long snap
    • lifespan

      protected final Lifespan lifespan
    • address

      protected final Address address
    • thread

      protected final TraceThread thread
    • frameLevel

      protected final int frameLevel
  • Constructor Details

    • UndefinedDBTraceData

      public UndefinedDBTraceData(DBTrace trace, long snap, Address address, TraceThread thread, int frameLevel)
      Construct an undefined unit
      Parameters:
      trace - the trace
      snap - the snap
      address - the address
      thread - the thread, if in a per-thread space
      frameLevel - the frame, if in a per-frame space
  • Method Details

    • getAddressSpace

      public AddressSpace getAddressSpace()
      Description copied from interface: TraceSpaceMixin
      Get the object's address space
      Specified by:
      getAddressSpace in interface DBTraceCodeUnitAdapter
      Specified by:
      getAddressSpace in interface TraceSpaceMixin
      Returns:
      the address space
    • 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
      Specified by:
      getTrace in interface TraceSpaceMixin
      Returns:
      the trace
    • 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
    • getPlatform

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

      public AddressRange getRange()
      Description copied from interface: TraceCodeUnit
      Get the address range covered by this unit
      Specified by:
      getRange in interface TraceCodeUnit
      Returns:
      the range
    • getBounds

      public TraceAddressSnapRange getBounds()
      Description copied from interface: TraceCodeUnit
      Get the bounds of this unit in space and time
      Specified by:
      getBounds in interface TraceCodeUnit
      Returns:
      the bounds
    • 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.
    • 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
      Specified by:
      getThread in interface TraceSpaceMixin
      Returns:
      the thread
    • getFrameLevel

      public int getFrameLevel()
      Description copied from interface: TraceSpaceMixin
      Get the frame level denoted by the object's address space

      Note this will return 0 if the frame level is not applicable. This is the same as the innermost frame level when it is applicable. To distinguish whether or not a 0 return value is applicable, you must examine the path or schema.

      Specified by:
      getFrameLevel in interface TraceSpaceMixin
      Returns:
      the level or 0
    • 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
    • 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.
    • toString

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

      public Address getAddress(int opIndex)
      Description copied from interface: CodeUnit
      Get the Address for the given operand index if one exists. Data objects have one operand (the value).
      Specified by:
      getAddress in interface CodeUnit
      Specified by:
      getAddress in interface DataAdapterFromDataType
      Parameters:
      opIndex - index of the operand.
      Returns:
      An address if the operand represents a fully qualified address (given the context), or if the operand is a Scalar treated as an address. Null is returned if no address or scalar exists on that operand.
    • 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
    • isDefined

      public boolean isDefined()
      Description copied from interface: Data
      Returns true if the data type is defined. Any address that has not been defined to be code or data is treated as undefined data.
      Specified by:
      isDefined in interface Data
      Returns:
      true if is defined
    • 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
    • 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
    • getParent

      public Data 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
      Returns:
      the data
    • getRoot

      public DBTraceDataAdapter 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
      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
    • getComponent

      public TraceData getComponent(int index)
      Description copied from interface: Data
      Returns the immediate n'th component or null if none exists.
      Specified by:
      getComponent in interface Data
      Specified by:
      getComponent in interface TraceData
      Parameters:
      index - the index of the component to get.
      Returns:
      the component
    • getComponent

      public TraceData getComponent(int[] componentPath)
      Description copied from interface: Data
      Get a data item given the index path. Each integer in the array represents an index into the data item at that level.
      Specified by:
      getComponent in interface Data
      Specified by:
      getComponent in interface TraceData
      Parameters:
      componentPath - the array of indexes to use to find the requested data item.
      Returns:
      the component
    • 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
    • getNumComponents

      public int getNumComponents()
      Description copied from interface: Data
      Return the number of components that make up this data item. if this is an Array, return the number of elements in the array.
      Specified by:
      getNumComponents in interface Data
      Returns:
      the number of components
    • getComponentAt

      public TraceData getComponentAt(int offset)
      Description copied from interface: Data
      Return the first immediate child component that contains the byte at the given offset. It is important to note that with certain datatypes there may be more than one component containing the specified offset (see Data.getComponentsContaining(int)).
      Specified by:
      getComponentAt in interface Data
      Specified by:
      getComponentAt in interface TraceData
      Parameters:
      offset - the amount to add to this data items address to get the address of the requested data item.
      Returns:
      first data component containing offset or null
    • getComponentContaining

      public TraceData getComponentContaining(int offset)
      Description copied from interface: Data
      Return the first immediate child component that contains the byte at the given offset. It is important to note that with certain datatypes there may be more than one component containing the specified offset (see Data.getComponentsContaining(int)).
      Specified by:
      getComponentContaining in interface Data
      Specified by:
      getComponentContaining in interface TraceData
      Parameters:
      offset - the amount to add to this data items address to get the
      Returns:
      first data component containing offset or null address of the requested data item.
    • getComponentsContaining

      public List<Data> getComponentsContaining(int offset)
      Description copied from interface: Data
      Returns a list of all the immediate child components that contain the byte at the given offset.

      For a union, this will return all the components (if the offset is 0). The presence of bit-fields or zero-length components may cause multiple components to be returned.

      Specified by:
      getComponentsContaining in interface Data
      Parameters:
      offset - the amount to add to this data items address to get the address of the requested data item.
      Returns:
      a list of all the immediate child components that contain the byte at the given offset or null if offset is out of bounds.
    • getPrimitiveAt

      public UndefinedDBTraceData getPrimitiveAt(int offset)
      Description copied from interface: Data
      Returns the primitive component containing this offset (i.e., one that does not have sub-components). This is useful for data items which are made up of multiple layers of other data items. This method immediately goes to the lowest level data item. If the minimum offset of a component is specified, the only first component containing the offset will be considered (e.g., 0-element array).
      Specified by:
      getPrimitiveAt in interface Data
      Specified by:
      getPrimitiveAt in interface DBTraceDataAdapter
      Specified by:
      getPrimitiveAt in interface TraceData
      Parameters:
      offset - the offset
      Returns:
      primitive component containing this 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 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