Interface TraceCodeUnit

All Superinterfaces:
CodeUnit, MemBuffer, PropertySet
All Known Subinterfaces:
DBTraceCodeUnitAdapter, DBTraceDataAdapter, DBTraceDefinedDataAdapter, InstructionAdapterFromPrototype, TraceData, TraceInstruction
All Known Implementing Classes:
AbstractDBTraceCodeUnit, AbstractDBTraceDataComponent, AbstractDBTraceProgramViewListing.DBTraceProgramViewUndefinedData, DBTraceData, DBTraceDataArrayElementComponent, DBTraceDataCompositeFieldComponent, DBTraceInstruction, UndefinedDBTraceData

public interface TraceCodeUnit extends CodeUnit
A code unit in a Trace
  • Method Details

    • getTrace

      Trace getTrace()
      Get the trace in which this code unit exists
      Returns:
      the trace
    • getPlatform

      TracePlatform getPlatform()
      Get the platform for this unit
      Returns:
      the platform
    • getProgram

      TraceProgramView getProgram()
      Description copied from interface: CodeUnit
      Returns the program that generated this CodeUnit..
      Specified by:
      getProgram in interface CodeUnit
      Returns:
      the program that generated this CodeUnit.
    • getThread

      TraceThread getThread()
      Get the thread associated with this code unit

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

      Returns:
      the thread
    • getLanguage

      Language getLanguage()
      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.

      Returns:
      the language
    • getBounds

      Get the bounds of this unit in space and time
      Returns:
      the bounds
    • getRange

      AddressRange getRange()
      Get the address range covered by this unit
      Returns:
      the range
    • getLifespan

      Lifespan getLifespan()
      Get the lifespan of this code unit
      Returns:
      the lifespan
    • getStartSnap

      long getStartSnap()
      Get the start snap of this code unit
      Returns:
      the first snap of this unit's lifespan
    • setEndSnap

      void setEndSnap(long endSnap)
      Set the end snap of this code unit
      Parameters:
      endSnap - the last snap of this unit's lifespan
      Throws:
      IllegalArgumentException - if the end snap is less than the start snap
    • getEndSnap

      long getEndSnap()
      Get the end snap of this code unit
      Returns:
      the last snap of this unit's lifespan
    • delete

      void delete()
      Delete this code unit
    • getBytes

      int getBytes(ByteBuffer buffer, int addressOffset)
      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.

      Parameters:
      buffer - the destination buffer
      addressOffset - the offset from this unit's (minimum) address
      Returns:
      the number of bytes read
    • setProperty

      <T> void setProperty(String name, Class<T> valueClass, T value)
      Set a property of the given type to the given value

      This method is preferred to setTypedProperty(String, Object), because in the case the property map does not already exist, the desired type is given explicitly.

      While it is best practice to match valueClass exactly with the type of the map, this method will work so long as the given valueClass is a subtype of the map's type. If the property map does not already exist, it is created with the given valueClass. Note that there is no established mechanism for restoring values of a subtype from the underlying database.

      Currently, the only supported types are Integer, String, Void, and subtypes of Saveable.

      Parameters:
      name - the name of the property
      valueClass - the type of the property
      value - the value of the property
    • setTypedProperty

      <T, U extends T> void setTypedProperty(String name, T value)
      Set a property having the same type as the given value

      If the named property has a super-type of the value's type, the value is accepted. If not, a TypeMismatchException is thrown. If the property map does not already exist, it is created having exactly the type of the given value.

      This method exists for two reasons: 1) To introduce the type variable U, which is more existential, and 2) to remove the requirement to subtype Saveable. Otherwise, this method is identical in operation to PropertySet.setProperty(String, Saveable).

      Parameters:
      name - the name of the property
      value - the value of the property
    • getProperty

      <T> T getProperty(String name, Class<T> valueClass)
      Get a property having the given type

      If the named property has a sub-type of the given valueClass, the value (possibly null) is returned. If the property does not exist, null is returned. Otherwise TypeMismatchException is thrown, even if the property is not set at this unit's address.

      Note that getting a Void property will always return null. Use PropertySet.getVoidProperty(String) instead to detect if the property is set. PropertySet.hasProperty(String) will also work, but it does not verify that the property's type is actually Void.

      Parameters:
      name - the name of the property
      valueClass - the expected type of the value (or a super-type thereof)
      Returns:
      the value of the property, or null
    • getMnemonicReferences

      TraceReference[] getMnemonicReferences()
      Description copied from interface: CodeUnit
      Get references for the mnemonic for this code unit.
      Specified by:
      getMnemonicReferences in interface CodeUnit
      Returns:
      an array of memory references. A zero length array will be returned if there are no references for the mnemonic.
    • getOperandReferences

      TraceReference[] getOperandReferences(int index)
      Description copied from interface: CodeUnit
      Returns the references for the operand index..
      Specified by:
      getOperandReferences in interface CodeUnit
      Parameters:
      index - operand index (0 is the first operand)
      Returns:
      the references for the operand index.
    • getPrimaryReference

      TraceReference getPrimaryReference(int index)
      Description copied from interface: CodeUnit
      Returns the primary reference for the operand index..
      Specified by:
      getPrimaryReference in interface CodeUnit
      Parameters:
      index - operand index (0 is the first operand)
      Returns:
      the primary reference for the operand index.
    • getReferencesFrom

      TraceReference[] getReferencesFrom()
      Description copied from interface: CodeUnit
      Get ALL memory references FROM this code unit.
      Specified by:
      getReferencesFrom in interface CodeUnit
      Returns:
      an array of memory references from this codeUnit or an empty array if there are no references.