Class DBTraceTimeManager
- All Implemented Interfaces:
ErrorHandler,DBTraceManager,TraceTimeManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ReadWriteLockprotected final DBCachedObjectIndex<String, DBTraceSnapshot> protected final DBCachedObjectStore<DBTraceSnapshot> protected final DBTraceThreadManagerprotected final DBTraceFields inherited from interface ghidra.trace.model.time.TraceTimeManager
KEY_TIME_RADIX -
Constructor Summary
ConstructorsConstructorDescriptionDBTraceTimeManager(DBHandle dbh, OpenMode openMode, ReadWriteLock lock, TaskMonitor monitor, DBTrace trace, DBTraceThreadManager threadManager) -
Method Summary
Modifier and TypeMethodDescriptioncreateSnapshot(String description) Create a new snapshot after the latestvoidNotification that an IO exception occurred.voiddeleteSnapshot(DBTraceSnapshot snapshot) protected DBTraceSnapshotdoFindNearest(TraceSchedule schedule, long version) protected DBTraceSnapshotdoGetValidSnapshotBySchedule(String key, long version) findScratchSnapshot(TraceSchedule schedule) Find or create a the snapshot with the given schedulefindSnapshotWithNearestPrefix(TraceSchedule schedule) Find the nearest related snapshot whose schedule is a prefix of the given scheduleCollection<? extends DBTraceSnapshot> List all snapshots in the traceGet maximum snapshot key that has ever existed, usually that of the latest snapshot Note, the corresponding snapshot need not exist, as it may have been deleted.getMostRecentSnapshot(long snap) Get the most recent snapshot since a given keygetSnapshot(long snap, boolean createIfAbsent) Get the snapshot with the given key, optionally creating itlongGet the number of snapshotsCollection<? extends DBTraceSnapshot> getSnapshots(long fromSnap, boolean fromInclusive, long toSnap, boolean toInclusive) List all snapshots between two given snaps in the traceCollection<? extends TraceSnapshot> getSnapshotsWithSchedule(TraceSchedule schedule) Get all snapshots with the given scheduleGet the radix for displaying and parsing time (snapshots and step counts)voidinvalidateCache(boolean all) Invalidate this manager's cachesprotected voidnotifySnapshotAdded(DBTraceSnapshot snapshot) protected voidnotifySnapshotChanged(DBTraceSnapshot snapshot) protected voidnotifySnapshotDeleted(DBTraceSnapshot snapshot) voidSet the radix for displaying and parsing time (snapshots and step counts)
-
Field Details
-
lock
-
trace
-
threadManager
-
snapshotStore
-
snapshotsBySchedule
-
-
Constructor Details
-
DBTraceTimeManager
public DBTraceTimeManager(DBHandle dbh, OpenMode openMode, ReadWriteLock lock, TaskMonitor monitor, DBTrace trace, DBTraceThreadManager threadManager) throws VersionException, IOException - Throws:
VersionExceptionIOException
-
-
Method Details
-
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).
-
notifySnapshotAdded
-
notifySnapshotChanged
-
notifySnapshotDeleted
-
createSnapshot
Description copied from interface:TraceTimeManagerCreate a new snapshot after the latest- Specified by:
createSnapshotin interfaceTraceTimeManager- Parameters:
description- a description of the new snapshot, i.e., the reason for advancing- Returns:
- the created snapshot
-
getSnapshot
Description copied from interface:TraceTimeManagerGet the snapshot with the given key, optionally creating it- Specified by:
getSnapshotin interfaceTraceTimeManager- Parameters:
snap- the snapshot keycreateIfAbsent- create the snapshot if it's missing- Returns:
- the snapshot or
null
-
getMostRecentSnapshot
Description copied from interface:TraceTimeManagerGet the most recent snapshot since a given key- Specified by:
getMostRecentSnapshotin interfaceTraceTimeManager- Parameters:
snap- the snapshot key- Returns:
- the snapshot or
null
-
getSnapshotsWithSchedule
Description copied from interface:TraceTimeManagerGet all snapshots with the given scheduleIdeally, the snapshot schedules should be managed such that the returned collection contains at most one snapshot.
- Specified by:
getSnapshotsWithSchedulein interfaceTraceTimeManager- Parameters:
schedule- the schedule to find- Returns:
- the snapshots
-
findScratchSnapshot
Description copied from interface:TraceTimeManagerFind or create a the snapshot with the given scheduleIf a snapshot with the given schedule already exists, this returns the first such snapshot found. Ideally, there is exactly one. If this method is consistently used for creating scratch snapshots, then that should always be the case. If no such snapshot exists, this creates a snapshot with the minimum available negative snapshot key, that is starting at
Long.MIN_VALUEand increasing from there.- Specified by:
findScratchSnapshotin interfaceTraceTimeManager- Parameters:
schedule- the schedule to find- Returns:
- the snapshot
-
doGetValidSnapshotBySchedule
-
doFindNearest
-
findSnapshotWithNearestPrefix
Find the nearest related snapshot whose schedule is a prefix of the given scheduleThis finds a snapshot that can be used as the initial state of an emulator to materialize the state at the given schedule. The one it returns is the one that would require the fewest instruction steps. Note that since an emulator cannot be initialized into the middle of an instruction, snapshots whose schedules contain p-code op steps are ignored. Additionally, this will ignore any snapshots whose version is less than the emulator cache version.
- Specified by:
findSnapshotWithNearestPrefixin interfaceTraceTimeManager- Parameters:
schedule- the desired schedule- Returns:
- the found snapshot, or null
- See Also:
- Implementation Notes:
- Because the index is lexicographic, we have to hack a bit. Consider that 20 would
come before 3 in the index. That said, all the steps leading up to the last would
have to be equal for it to be a prefix, so I don't think any weird lexicographic
stuff comes into play except in the final step., Even if the index were numeric, we have to worry about non-related schedules
appearing between related ones, e.g.,
0:t0-2, 0:t0-3;t1-1, when searching for0:t0-4.
-
getAllSnapshots
Description copied from interface:TraceTimeManagerList all snapshots in the trace- Specified by:
getAllSnapshotsin interfaceTraceTimeManager- Returns:
- the set of snapshots
-
getSnapshots
public Collection<? extends DBTraceSnapshot> getSnapshots(long fromSnap, boolean fromInclusive, long toSnap, boolean toInclusive) Description copied from interface:TraceTimeManagerList all snapshots between two given snaps in the trace- Specified by:
getSnapshotsin interfaceTraceTimeManager- Parameters:
fromSnap- the starting snapfromInclusive- whether to include the from snaptoSnap- the ending snaptoInclusive- when to include the to snap- Returns:
- the set of snapshots
-
getMaxSnap
Description copied from interface:TraceTimeManagerGet maximum snapshot key that has ever existed, usually that of the latest snapshot Note, the corresponding snapshot need not exist, as it may have been deleted.- Specified by:
getMaxSnapin interfaceTraceTimeManager- Returns:
- the key, or
nullif no snapshots have existed
-
getSnapshotCount
public long getSnapshotCount()Description copied from interface:TraceTimeManagerGet the number of snapshots- Specified by:
getSnapshotCountin interfaceTraceTimeManager- Returns:
- the count
-
deleteSnapshot
-
setTimeRadix
Description copied from interface:TraceTimeManagerSet the radix for displaying and parsing time (snapshots and step counts)This only affects the GUI, but storing it in the trace gives the back end a means of controlling it.
- Specified by:
setTimeRadixin interfaceTraceTimeManager- Parameters:
radix- the radix
-
getTimeRadix
Description copied from interface:TraceTimeManagerGet the radix for displaying and parsing time (snapshots and step counts)- Specified by:
getTimeRadixin interfaceTraceTimeManager- Returns:
- radix the radix
- See Also:
-