Package ghidra.trace.database.symbol

# Class DBTraceLabelSymbol

java.lang.Object
ghidra.program.database.DatabaseObject
ghidra.util.database.DBAnnotatedObject
ghidra.trace.database.symbol.AbstractDBTraceSymbol
ghidra.trace.database.symbol.DBTraceLabelSymbol

All Implemented Interfaces:
  `Symbol`, `DBTraceOverlaySpaceAdapter.DecodesAddresses`, `TraceLabelSymbol`, `TraceSymbol`, `TraceSymbolWithLifespan`, `TraceSpaceMixin`

public class DBTraceLabelSymbol extends AbstractDBTraceSymbol implements TraceLabelSymbol, TraceSpaceMixin, DBTraceOverlaySpaceAdapter.DecodesAddresses
The implementation of a label symbol, directly via a database object

Version history:

- 1: Change `address` to 10-byte fixed encoding
- 0: Initial version and previous unversioned implementation

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Address`
  `address`
  `protected long`
  `endSnap`
  `protected Lifespan`
  `lifespan`
  `protected long`
  `startSnap`

  ### Fields inherited from class ghidra.trace.database.symbol.AbstractDBTraceSymbol

  `manager, parent`

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

  `key`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DBTraceLabelSymbol(DBTraceSymbolManager manager, DBCachedObjectStore<?> store, DBRecord record)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `doSetPrimary(boolean primary)`
  Set the primary flag.
  `protected void`
  `fresh(boolean created)`
  Extension point: Called when the object's fields are populated.
  `Address`
  `getAddress()`
  `AddressSpace`
  `getAddressSpace()`
  Get the object's address space
  `DBTraceCodeUnitAdapter`
  `getCodeUnit()`
  Get the code unit at this label
  `long`
  `getEndSnap()`
  Get the maximum snapshot key in the lifespan
  `Lifespan`
  `getLifespan()`
  Get the lifespan of the symbol
  `Object`
  `getObject()`
  `long`
  `getStartSnap()`
  Get the minimum snapshot key in the lifespan
  `SymbolType`
  `getSymbolType()`
  Returns this symbol's type
  `TraceThread`
  `getThread()`
  If in register space, get the thread associated with this symbol.
  `boolean`
  `isPrimary()`
  `protected void`
  `set(Lifespan lifespan, Address address, String name, DBTraceNamespaceSymbol parent, SourceType source)`
  `void`
  `setEndSnap(long endSnap)`
  Set the maximum snapshot key in the lifespan
  `boolean`
  `setPrimary()`
  Sets this symbol to be primary.
  `protected void`
  `validateNameAndParent(String newName, DBTraceNamespaceSymbol newParent)`

  ### Methods inherited from class ghidra.trace.database.symbol.AbstractDBTraceSymbol

  `assertIsNamespace, assertNotGlobal, checkCircular, delete, doCollectAddressSet, doDelete, doSetNameWithEvent, doSetParent, doSetSource, doSetSourceWithEvent, equals, getAddressSet, getID, getName, getName, getOverlaySpaceAdapter, getParentNamespace, getParentSymbol, getPath, getProgram, getProgramLocation, getRanges, getReferenceCollection, getReferenceCount, getReferences, getReferences, getSource, getTrace, hashCode, hasReferences, isDescendant, isDynamic, isExternal, isGlobal, isPinned, isValidParent, set, setName, setNameAndNamespace, setNamespace, setPinned, setSource, toString, validateNameAndSource`

  ### 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.trace.database.address.DBTraceOverlaySpaceAdapter.DecodesAddresses

  `getOverlaySpaceAdapter`

  ### Methods inherited from interface ghidra.program.model.symbol.Symbol

  `delete, getID, getName, getName, getPath, getProgram, getProgramLocation, getReferenceCount, getSource, hasReferences, isDeleted, isDescendant, isDynamic, isExternal, isExternalEntryPoint, isGlobal, isValidParent, setName, setNameAndNamespace, setNamespace, setSource`

  ### Methods inherited from interface ghidra.trace.util.TraceSpaceMixin

  `getFrameLevel, getTrace`

  ### Methods inherited from interface ghidra.trace.model.symbol.TraceSymbol

  `getParentNamespace, getParentSymbol, getReferenceCollection, getReferences, getReferences, getTrace, isPinned, setPinned`

- ## Field Details

  - ### address

    protected Address address

  - ### startSnap

    protected long startSnap

  - ### endSnap

    protected long endSnap

  - ### lifespan

    protected Lifespan lifespan

- ## Constructor Details

  - ### DBTraceLabelSymbol

    public DBTraceLabelSymbol(DBTraceSymbolManager manager, DBCachedObjectStore<?> store, DBRecord record)

- ## 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 `AbstractDBTraceSymbol`
    Parameters:
      `created` - `true` when object is being created, or `false` when it is being loaded.
    Throws:
      `IOException` - if further initialization fails.

  - ### set

    protected void set(Lifespan lifespan, Address address, String name, DBTraceNamespaceSymbol parent, SourceType source)

  - ### getLifespan

    public Lifespan getLifespan()
    Description copied from interface: `TraceSymbolWithLifespan`
    Get the lifespan of the symbol
    Specified by:
      `getLifespan` in interface `TraceSymbolWithLifespan`
    Overrides:
      `getLifespan` in class `AbstractDBTraceSymbol`
    Returns:
      the lifespan

  - ### getStartSnap

    public long getStartSnap()
    Description copied from interface: `TraceSymbolWithLifespan`
    Get the minimum snapshot key in the lifespan
    Specified by:
      `getStartSnap` in interface `TraceSymbolWithLifespan`
    Returns:
      the minimum snapshot key

  - ### setEndSnap

    public void setEndSnap(long endSnap)
    Description copied from interface: `TraceSymbolWithLifespan`
    Set the maximum snapshot key in the lifespan
    Specified by:
      `setEndSnap` in interface `TraceSymbolWithLifespan`
    Parameters:
      `endSnap` - the new maximum snapshot key

  - ### getEndSnap

    public long getEndSnap()
    Description copied from interface: `TraceSymbolWithLifespan`
    Get the maximum snapshot key in the lifespan
    Specified by:
      `getEndSnap` in interface `TraceSymbolWithLifespan`
    Returns:
      the maximum snapshot key

  - ### getAddressSpace

    public AddressSpace getAddressSpace()
    Description copied from interface: `TraceSpaceMixin`
    Get the object's address space
    Specified by:
      `getAddressSpace` in interface `TraceSpaceMixin`
    Overrides:
      `getAddressSpace` in class `AbstractDBTraceSymbol`
    Returns:
      the address space

  - ### getThread

    public TraceThread getThread()
    Description copied from interface: `TraceSymbol`
    If in register space, get the thread associated with this symbol.
    Specified by:
      `getThread` in interface `TraceSpaceMixin`
    Specified by:
      `getThread` in interface `TraceSymbol`
    Overrides:
      `getThread` in class `AbstractDBTraceSymbol`
    Returns:
      the thread

  - ### getSymbolType

    public SymbolType getSymbolType()
    Description copied from interface: `Symbol`
    Returns this symbol's type
    Specified by:
      `getSymbolType` in interface `Symbol`
    Returns:
      symbol type

  - ### validateNameAndParent

    protected void validateNameAndParent(String newName, DBTraceNamespaceSymbol newParent) throws DuplicateNameException
    Overrides:
      `validateNameAndParent` in class `AbstractDBTraceSymbol`
    Throws:
      `DuplicateNameException`

  - ### getAddress

    public Address getAddress()
    Specified by:
      `getAddress` in interface `Symbol`
    Overrides:
      `getAddress` in class `AbstractDBTraceSymbol`
    Returns:
      the address for the symbol.

  - ### getCodeUnit

    public DBTraceCodeUnitAdapter getCodeUnit()
    Description copied from interface: `TraceLabelSymbol`
    Get the code unit at this label
    Specified by:
      `getCodeUnit` in interface `TraceLabelSymbol`
    Returns:
      the code unit

  - ### getObject

    public Object getObject()
    Specified by:
      `getObject` in interface `Symbol`
    Returns:
      object associated with this symbol or null if symbol has been deleted

  - ### doSetPrimary

    protected boolean doSetPrimary(boolean primary)
    Set the primary flag. The caller must still call `DBAnnotatedObject.update(DBObjectColumn...)` for `AbstractDBTraceSymbol.FLAGS_COLUMN`, if this method returns true.
    Returns:
      true if the primary flag was modified.

  - ### setPrimary

    public boolean setPrimary()
    Description copied from interface: `Symbol`
    Sets this symbol to be primary. All other symbols at the same address will be set to !primary. Only applies to non-function symbols.
    Specified by:
      `setPrimary` in interface `Symbol`
    Returns:
      returns true if the symbol was not primary and now it is, otherwise false

  - ### isPrimary

    public boolean isPrimary()
    Specified by:
      `isPrimary` in interface `Symbol`
    Returns:
      true if this symbol is primary