Package ghidra.trace.database.symbol
Class DBTraceReferenceManager
java.lang.Object
ghidra.trace.database.space.AbstractDBTraceSpaceBasedManager<DBTraceReferenceSpace>
ghidra.trace.database.symbol.DBTraceReferenceManager
- All Implemented Interfaces:
ErrorHandler,DBTraceManager,DBTraceDelegatingManager<DBTraceReferenceSpace>,TraceReferenceManager,TraceReferenceOperations
public class DBTraceReferenceManager
extends AbstractDBTraceSpaceBasedManager<DBTraceReferenceSpace>
implements TraceReferenceManager, DBTraceDelegatingManager<DBTraceReferenceSpace>
-
Nested Class Summary
Nested classes/interfaces inherited from class ghidra.trace.database.space.AbstractDBTraceSpaceBasedManager
AbstractDBTraceSpaceBasedManager.DBTraceSpaceEntryNested classes/interfaces inherited from interface ghidra.trace.database.space.DBTraceDelegatingManager
DBTraceDelegatingManager.ExcConsumer<T,E extends Throwable>, DBTraceDelegatingManager.ExcFunction<T, R, E extends Throwable>, DBTraceDelegatingManager.ExcPredicate<T, E extends Throwable>, DBTraceDelegatingManager.ExcSupplier<T, E extends Throwable> -
Field Summary
FieldsFields inherited from class ghidra.trace.database.space.AbstractDBTraceSpaceBasedManager
baseLanguage, dbh, lock, name, NO_ADDRESS_SPACE, regSpacesByContainer, spaces, spaceStore, spacesView, threadManager, trace -
Constructor Summary
ConstructorsConstructorDescriptionDBTraceReferenceManager(DBHandle dbh, OpenMode openMode, ReadWriteLock lock, TaskMonitor monitor, Language baseLanguage, DBTrace trace, DBTraceThreadManager threadManager, DBTraceOverlaySpaceAdapter overlayAdapter) -
Method Summary
Modifier and TypeMethodDescriptionaddMemoryReference(Lifespan lifespan, Address fromAddress, AddressRange toRange, RefType refType, SourceType source, int operandIndex) Add a memory referenceaddOffsetReference(Lifespan lifespan, Address fromAddress, Address toAddress, boolean toAddrIsBase, long offset, RefType refType, SourceType source, int operandIndex) Add an offset memory referenceaddReference(Lifespan lifespan, Reference reference) A (a copy of) the given reference to this manageraddReference(TraceReference reference) A (a copy of) the given reference to this manageraddRegisterReference(Lifespan lifespan, Address fromAddress, Register toRegister, RefType refType, SourceType source, int operandIndex) Add a register referenceaddShiftedReference(Lifespan lifespan, Address fromAddress, Address toAddress, int shift, RefType refType, SourceType source, int operandIndex) Add a shifted memory referenceaddStackReference(Lifespan lifespan, Address fromAddress, int toStackOffset, RefType refType, SourceType source, int operandIndex) Add a (static) stack referenceassertIsMine(Reference ref) voidcheckIsInMemory(AddressSpace space) Ensures that a "from" address is in memoryvoidclearReferencesFrom(Lifespan span, AddressRange range) Clear all references from the given lifespan and address rangevoidclearReferencesTo(Lifespan span, AddressRange range) Clear all references to the given lifespan and address rangeprotected DBTraceReferenceSpaceprotected voidprotected voidprotected voidCollection<? extends DBTraceReference> getFlowReferencesFrom(long snap, Address fromAddress) Get all flow references from the given snapshot and addressgetForSpace(AddressSpace space, boolean createIfAbsent) getPrimaryReferenceFrom(long snap, Address fromAddress, int operandIndex) Get the primary reference matching from the given snapshot, address, and operand indexgetReference(long snap, Address fromAddress, AddressRange toRange, int operandIndex) Find the reference that matches the given parametersintgetReferenceCountFrom(long snap, Address fromAddress) Count the number of references from the given snapshot and addressintgetReferenceCountTo(long snap, Address toAddress) Count the number of references to the given snapshot and addressGet an address set of all "to" addresses in any reference intersecting the given lifespangetReferenceRegisterSpace(TraceStackFrame frame, boolean createIfAbsent) getReferenceRegisterSpace(TraceThread thread, boolean createIfAbsent) protected Collection<? extends DBTraceReference> getReferencesBySymbolId(long id) Collection<? extends DBTraceReference> getReferencesFrom(long snap, Address fromAddress) Find all references from the given snapshot and addressCollection<? extends DBTraceReference> getReferencesFrom(long snap, Address fromAddress, int operandIndex) Find all references from the given snapshot, address, and operand indexCollection<? extends DBTraceReference> getReferencesFromRange(Lifespan span, AddressRange range) Find all references with from addresses contained in the given lifespan and address rangegetReferenceSources(Lifespan span) Get an address set of all "from" addresses in any reference intersecting the given lifespangetReferenceSpace(AddressSpace space, boolean createIfAbsent) Collection<? extends DBTraceReference> getReferencesTo(long snap, Address toAddress) Get all references whose to address (or range) contains the given snapshot and addressCollection<? extends DBTraceReference> getReferencesToRange(Lifespan span, AddressRange range, Rectangle2DDirection order) Get all references whose to address range intersects the given lifespan and address rangereadLock()Methods inherited from class ghidra.trace.database.space.AbstractDBTraceSpaceBasedManager
dbError, get, getActiveSpaces, getBaseLanguage, getForRegisterSpace, getForRegisterSpace, getForRegisterSpace, getLock, getSpaceByName, getTabledSpaces, getTrace, invalidateCache, loadSpaces, tableNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.trace.database.space.DBTraceDelegatingManager
delegateAddressSet, delegateAny, delegateCollection, delegateDeleteB, delegateDeleteV, delegateFirst, delegateHashSet, delegateRead, delegateRead, delegateReadB, delegateReadI, delegateReadI, delegateReadOr, delegateWrite, delegateWriteAll, delegateWriteI, delegateWriteVMethods inherited from interface ghidra.trace.model.symbol.TraceReferenceOperations
addMemoryReference, getReference, getReferencesToRange, hasFlowReferencesFrom, hasReferencesFrom, hasReferencesFrom, hasReferencesTo
-
Field Details
-
NAME
- See Also:
-
overlayAdapter
-
-
Constructor Details
-
DBTraceReferenceManager
public DBTraceReferenceManager(DBHandle dbh, OpenMode openMode, ReadWriteLock lock, TaskMonitor monitor, Language baseLanguage, DBTrace trace, DBTraceThreadManager threadManager, DBTraceOverlaySpaceAdapter overlayAdapter) throws VersionException, IOException - Throws:
VersionExceptionIOException
-
-
Method Details
-
createSpace
protected DBTraceReferenceSpace createSpace(AddressSpace space, AbstractDBTraceSpaceBasedManager.DBTraceSpaceEntry ent) throws VersionException, IOException - Specified by:
createSpacein classAbstractDBTraceSpaceBasedManager<DBTraceReferenceSpace>- Throws:
VersionExceptionIOException
-
checkIsInMemory
Ensures that a "from" address is in memoryNOTE: To manage references from registers, you must use
getReferenceRegisterSpace(TraceThread, boolean), which requires a thread.- Specified by:
checkIsInMemoryin interfaceDBTraceDelegatingManager<DBTraceReferenceSpace>- Parameters:
space- the space of the address to check
-
getForSpace
- Specified by:
getForSpacein interfaceDBTraceDelegatingManager<DBTraceReferenceSpace>- Overrides:
getForSpacein classAbstractDBTraceSpaceBasedManager<DBTraceReferenceSpace>
-
readLock
- Specified by:
readLockin interfaceDBTraceDelegatingManager<DBTraceReferenceSpace>
-
writeLock
- Specified by:
writeLockin interfaceDBTraceDelegatingManager<DBTraceReferenceSpace>
-
doAddXRef
-
doDelXRef
-
doSetXRefLifespan
-
assertIsMine
-
getReferenceSpace
- Specified by:
getReferenceSpacein interfaceTraceReferenceManager
-
getReferenceRegisterSpace
- Specified by:
getReferenceRegisterSpacein interfaceTraceReferenceManager
-
getReferenceRegisterSpace
public DBTraceReferenceSpace getReferenceRegisterSpace(TraceStackFrame frame, boolean createIfAbsent) - Specified by:
getReferenceRegisterSpacein interfaceTraceReferenceManager
-
addReference
Description copied from interface:TraceReferenceOperationsA (a copy of) the given reference to this manager- Specified by:
addReferencein interfaceTraceReferenceOperations- Parameters:
reference- the reference to add- Returns:
- the resulting reference
-
addReference
Description copied from interface:TraceReferenceOperationsA (a copy of) the given reference to this manager- Specified by:
addReferencein interfaceTraceReferenceOperations- Parameters:
lifespan- the span of time where this reference appliesreference- the reference- Returns:
- the resulting reference
-
addMemoryReference
public DBTraceReference addMemoryReference(Lifespan lifespan, Address fromAddress, AddressRange toRange, RefType refType, SourceType source, int operandIndex) Description copied from interface:TraceReferenceOperationsAdd a memory reference- Specified by:
addMemoryReferencein interfaceTraceReferenceOperations- Parameters:
lifespan- the span of time where this reference appliesfromAddress- the from address of the referencetoRange- the to addresses of the referencerefType- the type of referencesource- how this reference was derivedoperandIndex- the operand index for the "from" end, or -1- Returns:
- the resulting reference
-
addOffsetReference
public DBTraceOffsetReference addOffsetReference(Lifespan lifespan, Address fromAddress, Address toAddress, boolean toAddrIsBase, long offset, RefType refType, SourceType source, int operandIndex) Description copied from interface:TraceReferenceOperationsAdd an offset memory reference- Specified by:
addOffsetReferencein interfaceTraceReferenceOperations- Parameters:
lifespan- the span of time where this reference appliesfromAddress- the from address of the referencetoAddress- the to address of the referencetoAddrIsBase- indicate whether or not toAddress incorporates the offset. False means toAddress=base+offset. True means toAddress=base.offset- value added to the base addressrefType- the type of referencesource- how this reference was derivedoperandIndex- the operand index for the "from" end, or -1- Returns:
- the resulting reference
-
addShiftedReference
public DBTraceShiftedReference addShiftedReference(Lifespan lifespan, Address fromAddress, Address toAddress, int shift, RefType refType, SourceType source, int operandIndex) Description copied from interface:TraceReferenceOperationsAdd a shifted memory reference- Specified by:
addShiftedReferencein interfaceTraceReferenceOperations- Parameters:
lifespan- the span of time where this reference appliesfromAddress- the from address of the referencetoAddress- the to address of the referenceshift- the number of bits to shift leftrefType- the type of referencesource- how this reference was derivedoperandIndex- the operand index for the "from" end, or -1- Returns:
- the resulting reference
-
addRegisterReference
public DBTraceReference addRegisterReference(Lifespan lifespan, Address fromAddress, Register toRegister, RefType refType, SourceType source, int operandIndex) Description copied from interface:TraceReferenceOperationsAdd a register reference- Specified by:
addRegisterReferencein interfaceTraceReferenceOperations- Parameters:
lifespan- the span of time where this reference appliesfromAddress- the from address of the referencetoRegister- the to register of the referencerefType- the type of referencesource- how this reference was derivedoperandIndex- the operand index for the "from" end, or -1- Returns:
- the resulting reference
-
addStackReference
public DBTraceReference addStackReference(Lifespan lifespan, Address fromAddress, int toStackOffset, RefType refType, SourceType source, int operandIndex) Description copied from interface:TraceReferenceOperationsAdd a (static) stack reference- Specified by:
addStackReferencein interfaceTraceReferenceOperations- Parameters:
lifespan- the span of time where this reference appliesfromAddress- the from address of the referencetoStackOffset- the to offset of the referencerefType- the type of referencesource- how this reference was derivedoperandIndex- the operand index for the "from" end, or -1- Returns:
- the resulting reference
-
getReference
public DBTraceReference getReference(long snap, Address fromAddress, AddressRange toRange, int operandIndex) Description copied from interface:TraceReferenceOperationsFind the reference that matches the given parametersNOTE: It is not sufficient to intersect the to range. It must exactly match that given.
- Specified by:
getReferencein interfaceTraceReferenceOperations- Parameters:
snap- the snapshot keyfromAddress- the from addresstoRange- the to address rangeoperandIndex- the operand index for the "from" end, or -1- Returns:
- the found reference or null
-
getReferencesFrom
Description copied from interface:TraceReferenceOperationsFind all references from the given snapshot and address- Specified by:
getReferencesFromin interfaceTraceReferenceOperations- Parameters:
snap- the snapshot keyfromAddress- the from address- Returns:
- the collection of results
-
getReferencesFrom
public Collection<? extends DBTraceReference> getReferencesFrom(long snap, Address fromAddress, int operandIndex) Description copied from interface:TraceReferenceOperationsFind all references from the given snapshot, address, and operand index- Specified by:
getReferencesFromin interfaceTraceReferenceOperations- Parameters:
snap- the snapshot keyfromAddress- the from addressoperandIndex- the operand index for the "from" end, or -1- Returns:
- the collection of results
-
getReferencesFromRange
public Collection<? extends DBTraceReference> getReferencesFromRange(Lifespan span, AddressRange range) Description copied from interface:TraceReferenceOperationsFind all references with from addresses contained in the given lifespan and address range- Specified by:
getReferencesFromRangein interfaceTraceReferenceOperations- Parameters:
span- the lifespan to examinerange- the range to examine- Returns:
- the collection of results
-
getFlowReferencesFrom
Description copied from interface:TraceReferenceOperationsGet all flow references from the given snapshot and address- Specified by:
getFlowReferencesFromin interfaceTraceReferenceOperations- Parameters:
snap- the snapshot keyfromAddress- the from address- Returns:
- the collection of results
-
getPrimaryReferenceFrom
Description copied from interface:TraceReferenceOperationsGet the primary reference matching from the given snapshot, address, and operand index- Specified by:
getPrimaryReferenceFromin interfaceTraceReferenceOperations- Parameters:
snap- the snapshot keyfromAddress- the from addressoperandIndex- the operand index for the "from" end, or -1- Returns:
- the found reference or null
-
clearReferencesFrom
Description copied from interface:TraceReferenceOperationsClear all references from the given lifespan and address rangeAny reference intersecting the given "from" parameters will have its lifespan truncated to the start of the given lifespan.
- Specified by:
clearReferencesFromin interfaceTraceReferenceOperations- Parameters:
span- the lifespan to removerange- the range to clear
-
getReferencesTo
Description copied from interface:TraceReferenceOperationsGet all references whose to address (or range) contains the given snapshot and address- Specified by:
getReferencesToin interfaceTraceReferenceOperations- Parameters:
snap- the snapshot keytoAddress- the to address- Returns:
- the collection of results
-
getReferencesToRange
public Collection<? extends DBTraceReference> getReferencesToRange(Lifespan span, AddressRange range, Rectangle2DDirection order) Description copied from interface:TraceReferenceOperationsGet all references whose to address range intersects the given lifespan and address rangeThe following iteration orders may be specified for the resulting (lazy) collection:
null- no particular order. This spares the cost of sorting.Rectangle2DDirection.TOPMOST- most-recent (latest snapshot) first.Rectangle2DDirection.BOTTOMMOST- least-recent (earliest including scratch snapshot first).Rectangle2DDirection.LEFTMOST- smallest address first.Rectangle2DDirection.RIGHTMOST- largest address first.
"Secondary" sorting is not supported.
- Specified by:
getReferencesToRangein interfaceTraceReferenceOperations- Parameters:
span- the lifespan to examinerange- the range to examineorder- the order of items in the collection.- Returns:
- the collection of results
-
clearReferencesTo
Description copied from interface:TraceReferenceOperationsClear all references to the given lifespan and address rangeAny reference intersecting the given "to" parameters will have its lifespan truncated to the start of the given lifespan.
- Specified by:
clearReferencesToin interfaceTraceReferenceOperations- Parameters:
span- the lifespan to removerange- the range of clear
-
getReferenceSources
Description copied from interface:TraceReferenceOperationsGet an address set of all "from" addresses in any reference intersecting the given lifespan- Specified by:
getReferenceSourcesin interfaceTraceReferenceOperations- Parameters:
span- the lifespan to examine- Returns:
- a (lazily-computed) address set view of all "from" addresses
-
getReferenceDestinations
Description copied from interface:TraceReferenceOperationsGet an address set of all "to" addresses in any reference intersecting the given lifespan- Specified by:
getReferenceDestinationsin interfaceTraceReferenceOperations- Parameters:
span- the lifespan to examine- Returns:
- a (lazily-computed) address set view of all "to" addresses
-
getReferenceCountFrom
Description copied from interface:TraceReferenceOperationsCount the number of references from the given snapshot and address- Specified by:
getReferenceCountFromin interfaceTraceReferenceOperations- Parameters:
snap- the snapshot keyfromAddress- the from address- Returns:
- the number of references
-
getReferenceCountTo
Description copied from interface:TraceReferenceOperationsCount the number of references to the given snapshot and address- Specified by:
getReferenceCountToin interfaceTraceReferenceOperations- Parameters:
snap- the snapshot keytoAddress- the to address- Returns:
- the number of references
-
getReferencesBySymbolId
-