Class DBTraceObjectManager
- All Implemented Interfaces:
ErrorHandler,DBTraceManager,TraceObjectManager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprotected static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ReadWriteLockprotected final DBCachedObjectIndex<KeyPath, DBTraceObject> protected final Map<ghidra.trace.database.target.DBTraceObjectManager.ObjectsContainingKey, Collection<?>> protected final DBCachedObjectStore<DBTraceObject> protected final Collection<TraceObject> protected TraceObjectSchemaprotected final Map<Class<? extends TraceObjectInterface>, Set<TraceObjectSchema>> protected final DBCachedObjectStore<DBTraceObjectManager.DBTraceObjectSchemaEntry> protected final DBTraceprotected final DBTraceObjectValueRStarTree.DBTraceObjectValueMapprotected final DBTraceObjectValueRStarTreeprotected final ghidra.trace.database.target.DBTraceObjectValueWriteBehindCache -
Constructor Summary
ConstructorsConstructorDescriptionDBTraceObjectManager(DBHandle dbh, OpenMode openMode, ReadWriteLock lock, TaskMonitor monitor, Language baseLanguage, DBTrace trace) -
Method Summary
Modifier and TypeMethodDescriptionaddBreakpoint(String path, Lifespan lifespan, AddressRange range, Collection<TraceThread> threads, Collection<TraceBreakpointKind> kinds, boolean enabled, String comment) addMemoryRegion(String path, Lifespan lifespan, AddressRange range, Collection<TraceMemoryFlag> flags) addModule(String path, String name, Lifespan lifespan, AddressRange range) addSection(String path, String name, Lifespan lifespan, AddressRange range) addStackFrame(KeyPath path, long snap) protected DBTraceObjectassertIsMine(TraceObject object) assertMyThread(TraceThread thread) protected voidcheckDuplicateThread(String path, Lifespan lifespan) protected booleancheckMyObject(DBTraceObject object) voidclear()Delete the entire object model, including the schemaprotected Set<TraceObjectSchema> collectSchemasForInterface(Class<? extends TraceObjectInterface> iface) createObject(KeyPath path) Create (or get) an object with the given canonical pathcreateRootObject(TraceObjectSchema schema) Creates the root object of the model, fixing its schemavoidFor maintenance, remove all disconnected objectsvoidNotification that an IO exception occurred.protected <I extends TraceObjectInterface>
IdoAddWithInterface(KeyPath path, Class<I> iface) protected <I extends TraceObjectInterface>
IdoAddWithInterface(String path, Class<I> iface) protected DBTraceObjectdoCreateObject(KeyPath path) protected DBTraceObjectValuedoCreateValue(Lifespan lifespan, DBTraceObject parent, String key, Object value) protected DBTraceObjectValueDatadoCreateValueData(Lifespan lifespan, DBTraceObject parent, String key, Object value) protected voidprotected voiddoDeleteObject(DBTraceObject object) protected voidprotected DBTraceObjectdoGetObject(KeyPath path) protected Collection<? extends TraceObjectInterface> doGetObjectsContaining(ghidra.trace.database.target.DBTraceObjectManager.ObjectsContainingKey key) protected voidemitValueCreated(DBTraceObject parent, DBTraceObjectValue entry) voidGet all the objects in the database<I extends TraceObjectInterface>
Collection<I> getAllObjects(Class<I> iface) Get all the values (edges) in the database<I extends TraceObjectInterface>
IgetLatestSuccessor(TraceObject seed, KeyPath path, long snap, Class<I> iface) Get objects in the database having the given canonical pathgetObjectById(long key) Get the object with the given database key, if it exists<I extends TraceObjectInterface>
IgetObjectByPath(long snap, String path, Class<I> iface) <I extends TraceObjectInterface>
IgetObjectContaining(long snap, Address address, String key, Class<I> iface) intGet the number of objects in the database<I extends TraceObjectInterface>
AddressSetViewgetObjectsAddressSet(long snap, String key, Class<I> ifaceCls, Predicate<? super I> predicate) <I extends TraceObjectInterface>
Collection<I> getObjectsAtSnap(long snap, Class<I> iface) Stream<? extends DBTraceObject> getObjectsByPath(Lifespan span, KeyPath path) Get objects in the database having the given path intersecting the given span<I extends TraceObjectInterface>
Collection<I> getObjectsByPath(String path, Class<I> iface) <I extends TraceObjectInterface>
Collection<I> getObjectsContaining(long snap, Address address, String key, Class<I> iface) <I extends TraceObjectInterface>
Collection<I> getObjectsIntersecting(Lifespan lifespan, AddressRange range, String key, Class<I> iface) Get the root object, if it has been createdGet the schema of the root object<I extends TraceObjectInterface>
IgetSuccessor(TraceObject seed, PathFilter filter, long snap, Class<I> iface) getTrace()Get the trace to which the object manager belongsStream<? extends TraceObjectValPath> getValuePaths(Lifespan span, PathFilter filter) Get value entries in the database matching the given predicates intersecting the given spanCollection<? extends TraceObjectValue> getValuesAt(long snap, Address address, String entryKey) Collection<? extends TraceObjectValue> getValuesIntersecting(Lifespan span, AddressRange range, String entryKey) Get all address-ranged values intersecting the given span and address rangevoidinvalidateCache(boolean all) Invalidate this manager's cachesprotected voidprotected void<I extends TraceObjectInterface>
Stream<I> queryAllInterface(Lifespan span, Class<I> iface) Get all interfaces of the given type in the databaseGet the schema of the root object, failing if no root object existsprotected voidsetSchema(TraceObjectSchema schema) protected Stream<DBTraceObjectValueBehind> streamValuesAtBehind(long snap, Address address, String entryKey) protected Stream<DBTraceObjectValueData> streamValuesAtData(long snap, Address address, String entryKey) protected Stream<DBTraceObjectValueBehind> streamValuesIntersectingBehind(Lifespan span, AddressRange range, String entryKey) protected Stream<DBTraceObjectValueData> streamValuesIntersectingData(Lifespan span, AddressRange range, String entryKey) protected ObjectvalidatePrimitive(Object value) protected ObjectvalidateValue(Object value) voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.trace.model.target.TraceObjectManager
getValuesIntersecting
-
Field Details
-
lock
-
trace
-
schemaStore
-
objectStore
-
valueTree
-
valueMap
-
valueWbCache
protected final ghidra.trace.database.target.DBTraceObjectValueWriteBehindCache valueWbCache -
objectsByPath
-
objectsView
-
rootSchema
-
objectsContainingCache
protected final Map<ghidra.trace.database.target.DBTraceObjectManager.ObjectsContainingKey,Collection<?>> objectsContainingCache -
schemasByInterface
protected final Map<Class<? extends TraceObjectInterface>,Set<TraceObjectSchema>> schemasByInterface
-
-
Constructor Details
-
DBTraceObjectManager
public DBTraceObjectManager(DBHandle dbh, OpenMode openMode, ReadWriteLock lock, TaskMonitor monitor, Language baseLanguage, DBTrace trace) throws IOException, VersionException - Throws:
IOExceptionVersionException
-
-
Method Details
-
loadRootSchema
protected void loadRootSchema() -
dbError
Description copied from interface:ErrorHandlerNotification that an IO exception occurred.- Specified by:
dbErrorin interfaceErrorHandler- Parameters:
e-IOExceptionwhich was cause of error
-
invalidateCache
public void invalidateCache(boolean all) Description copied from interface:DBTraceManagerInvalidate this manager's caches- Specified by:
invalidateCachein interfaceDBTraceManager- Parameters:
all- probably nothing. Check out implementations ofManagerDB.invalidateCache(boolean).
-
checkMyObject
-
assertIsMine
-
validatePrimitive
-
validateValue
-
getTrace
Description copied from interface:TraceObjectManagerGet the trace to which the object manager belongs- Specified by:
getTracein interfaceTraceObjectManager- Returns:
- the trace
-
setSchema
-
emitValueCreated
-
doCreateValueData
protected DBTraceObjectValueData doCreateValueData(Lifespan lifespan, DBTraceObject parent, String key, Object value) -
doCreateValue
protected DBTraceObjectValue doCreateValue(Lifespan lifespan, DBTraceObject parent, String key, Object value) -
doCreateObject
-
doGetObject
-
createObject
Description copied from interface:TraceObjectManagerCreate (or get) an object with the given canonical path- Specified by:
createObjectin interfaceTraceObjectManager- Parameters:
path- the object's canonical path- Returns:
- the new object
-
createRootObject
Description copied from interface:TraceObjectManagerCreates the root object of the model, fixing its schemaNote the schema cannot be changed once the root object is created. The only means to "change" the schema is to delete the root object (and thus the entire tree) then re-create the root object with the new schema.
- Specified by:
createRootObjectin interfaceTraceObjectManager- Parameters:
schema- the schema- Returns:
- the new object
-
getRootSchema
Description copied from interface:TraceObjectManagerGet the schema of the root object- Specified by:
getRootSchemain interfaceTraceObjectManager- Returns:
- the schema or null
-
getRootValue
-
getRootObject
Description copied from interface:TraceObjectManagerGet the root object, if it has been created- Specified by:
getRootObjectin interfaceTraceObjectManager- Returns:
- the root object, or null
-
getObjectById
Description copied from interface:TraceObjectManagerGet the object with the given database key, if it exists- Specified by:
getObjectByIdin interfaceTraceObjectManager- Parameters:
key- the desired object's key- Returns:
- the object, or null
-
getObjectByCanonicalPath
Description copied from interface:TraceObjectManagerGet objects in the database having the given canonical path- Specified by:
getObjectByCanonicalPathin interfaceTraceObjectManager- Parameters:
path- the canonical path of the desired objects- Returns:
- the collection of objects
-
getObjectsByPath
Description copied from interface:TraceObjectManagerGet objects in the database having the given path intersecting the given span- Specified by:
getObjectsByPathin interfaceTraceObjectManager- Parameters:
span- the span that desired objects' lifespans must intersectpath- the path of the desired objects- Returns:
- the iterable of objects
-
getValuePaths
Description copied from interface:TraceObjectManagerGet value entries in the database matching the given predicates intersecting the given spanWhile the manager does not maintain integrity wrt. child lifespans and that of their parents, nor even the connectivity of objects to their canonical parents, this search depends on that consistency. An object may not be discovered unless it is properly connected to the root object. Furthermore, it will not be discovered unless it and its ancestors' lifespans all intersect the given span.
- Specified by:
getValuePathsin interfaceTraceObjectManager- Parameters:
span- the span that desired objects' lifespans must intersectfilter- predicates to match the desired objects- Returns:
- an iterator over the matching objects
-
getAllObjects
Description copied from interface:TraceObjectManagerGet all the objects in the database- Specified by:
getAllObjectsin interfaceTraceObjectManager- Returns:
- the stream of all objects
-
getObjectCount
public int getObjectCount()Description copied from interface:TraceObjectManagerGet the number of objects in the database- Specified by:
getObjectCountin interfaceTraceObjectManager- Returns:
- the number of objects
-
getAllValues
Description copied from interface:TraceObjectManagerGet all the values (edges) in the database- Specified by:
getAllValuesin interfaceTraceObjectManager- Returns:
- the stream of all values
-
streamValuesIntersectingData
protected Stream<DBTraceObjectValueData> streamValuesIntersectingData(Lifespan span, AddressRange range, String entryKey) -
streamValuesIntersectingBehind
protected Stream<DBTraceObjectValueBehind> streamValuesIntersectingBehind(Lifespan span, AddressRange range, String entryKey) -
getValuesIntersecting
public Collection<? extends TraceObjectValue> getValuesIntersecting(Lifespan span, AddressRange range, String entryKey) Description copied from interface:TraceObjectManagerGet all address-ranged values intersecting the given span and address range- Specified by:
getValuesIntersectingin interfaceTraceObjectManager- Parameters:
span- the span that desired values lifespans must intersectrange- the range that desired address-ranged values must intersectentryKey- the entry key if a single one should be matched, or null for any- Returns:
- the collection of values
-
streamValuesAtData
protected Stream<DBTraceObjectValueData> streamValuesAtData(long snap, Address address, String entryKey) -
streamValuesAtBehind
protected Stream<DBTraceObjectValueBehind> streamValuesAtBehind(long snap, Address address, String entryKey) -
getValuesAt
public Collection<? extends TraceObjectValue> getValuesAt(long snap, Address address, String entryKey) -
queryAllInterface
Description copied from interface:TraceObjectManagerGet all interfaces of the given type in the database- Specified by:
queryAllInterfacein interfaceTraceObjectManager- Type Parameters:
I- the type of the desired interface- Parameters:
span- the span that desired objects must intersectiface- the class of the desired interface- Returns:
- the collection of all instances of the given interface
-
cullDisconnectedObjects
public void cullDisconnectedObjects()Description copied from interface:TraceObjectManagerFor maintenance, remove all disconnected objectsAn object is disconnected if it is neither the child nor parent of any value for any span. In other words, it's unused.
- Specified by:
cullDisconnectedObjectsin interfaceTraceObjectManager
-
clear
public void clear()Description copied from interface:TraceObjectManagerDelete the entire object model, including the schemaThis is the only mechanism to modify the schema. This should almost never be necessary, because a connector should provide its immutable schema immediately. Nevertheless, the database permits schema modification, but requires that the entire model be replaced.
- Specified by:
clearin interfaceTraceObjectManager
-
doDeleteObject
-
doDeleteValue
-
doDeleteCachedValue
-
requireRootSchema
Description copied from interface:TraceObjectManagerGet the schema of the root object, failing if no root object exists- Specified by:
requireRootSchemain interfaceTraceObjectManager- Returns:
- the schema
-
doAddWithInterface
-
doAddWithInterface
-
getAllObjects
-
getObjectsByPath
-
getObjectByPath
-
invalidateObjectsContainingCache
protected void invalidateObjectsContainingCache() -
doGetObjectsContaining
protected Collection<? extends TraceObjectInterface> doGetObjectsContaining(ghidra.trace.database.target.DBTraceObjectManager.ObjectsContainingKey key) -
getObjectsContaining
public <I extends TraceObjectInterface> Collection<I> getObjectsContaining(long snap, Address address, String key, Class<I> iface) -
getObjectContaining
public <I extends TraceObjectInterface> I getObjectContaining(long snap, Address address, String key, Class<I> iface) -
collectSchemasForInterface
protected Set<TraceObjectSchema> collectSchemasForInterface(Class<? extends TraceObjectInterface> iface) -
getObjectsIntersecting
public <I extends TraceObjectInterface> Collection<I> getObjectsIntersecting(Lifespan lifespan, AddressRange range, String key, Class<I> iface) -
getObjectsAtSnap
-
getObjectsAddressSet
public <I extends TraceObjectInterface> AddressSetView getObjectsAddressSet(long snap, String key, Class<I> ifaceCls, Predicate<? super I> predicate) -
getSuccessor
public <I extends TraceObjectInterface> I getSuccessor(TraceObject seed, PathFilter filter, long snap, Class<I> iface) -
getLatestSuccessor
public <I extends TraceObjectInterface> I getLatestSuccessor(TraceObject seed, KeyPath path, long snap, Class<I> iface) -
addBreakpoint
public TraceBreakpointLocation addBreakpoint(String path, Lifespan lifespan, AddressRange range, Collection<TraceThread> threads, Collection<TraceBreakpointKind> kinds, boolean enabled, String comment) throws DuplicateNameException - Throws:
DuplicateNameException
-
addMemoryRegion
public TraceMemoryRegion addMemoryRegion(String path, Lifespan lifespan, AddressRange range, Collection<TraceMemoryFlag> flags) throws TraceOverlappedRegionException - Throws:
TraceOverlappedRegionException
-
addModule
public TraceModule addModule(String path, String name, Lifespan lifespan, AddressRange range) throws DuplicateNameException - Throws:
DuplicateNameException
-
addSection
public TraceSection addSection(String path, String name, Lifespan lifespan, AddressRange range) throws DuplicateNameException - Throws:
DuplicateNameException
-
addStack
-
addStackFrame
-
checkDuplicateThread
- Throws:
DuplicateNameException
-
addThread
public TraceThread addThread(String path, String display, Lifespan lifespan) throws DuplicateNameException - Throws:
DuplicateNameException
-
assertMyThread
-
flushWbCaches
public void flushWbCaches() -
waitWbWorkers
public void waitWbWorkers()
-