Package ghidra.trace.database.listing
Class DBTraceCommentAdapter
java.lang.Object
ghidra.trace.database.space.AbstractDBTraceSpaceBasedManager<DBTraceAddressSnapRangePropertyMapSpace<DBTraceCommentAdapter.DBTraceCommentEntry,DBTraceCommentAdapter.DBTraceCommentEntry>>
ghidra.trace.database.map.DBTraceAddressSnapRangePropertyMap<DBTraceCommentAdapter.DBTraceCommentEntry,DBTraceCommentAdapter.DBTraceCommentEntry>
ghidra.trace.database.listing.DBTraceCommentAdapter
- All Implemented Interfaces:
ErrorHandler,DBTraceManager,DBTraceDelegatingManager<DBTraceAddressSnapRangePropertyMapSpace<DBTraceCommentAdapter.DBTraceCommentEntry,,DBTraceCommentAdapter.DBTraceCommentEntry>> TraceAddressSnapRangePropertyMap<DBTraceCommentAdapter.DBTraceCommentEntry>,TraceAddressSnapRangePropertyMapOperations<DBTraceCommentAdapter.DBTraceCommentEntry>,SpatialMap<TraceAddressSnapRange,DBTraceCommentAdapter.DBTraceCommentEntry, DBTraceAddressSnapRangePropertyMapTree.TraceAddressSnapRangeQuery>
public class DBTraceCommentAdapter
extends DBTraceAddressSnapRangePropertyMap<DBTraceCommentAdapter.DBTraceCommentEntry,DBTraceCommentAdapter.DBTraceCommentEntry>
A property map for storing code unit comments
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA comment entryNested classes/interfaces inherited from class ghidra.trace.database.map.DBTraceAddressSnapRangePropertyMap
DBTraceAddressSnapRangePropertyMap.DBTraceAddressSnapRangePropertyMapDataFactory<T,DR extends DBTraceAddressSnapRangePropertyMapTree.AbstractDBTraceAddressSnapRangePropertyMapData<T>> 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> Nested classes/interfaces inherited from interface ghidra.util.database.spatial.SpatialMap
SpatialMap.EmptySpatialMap<DS extends BoundedShape<?>,T, Q> -
Field Summary
FieldsFields inherited from class ghidra.trace.database.map.DBTraceAddressSnapRangePropertyMap
dataFactory, dataTypeFields inherited from class ghidra.trace.database.space.AbstractDBTraceSpaceBasedManager
baseLanguage, dbh, lock, name, NO_ADDRESS_SPACE, regSpacesByContainer, spaces, spaceStore, spacesView, threadManager, traceFields inherited from interface ghidra.util.database.spatial.SpatialMap
EMPTY_MAP -
Constructor Summary
ConstructorsConstructorDescriptionDBTraceCommentAdapter(DBHandle dbh, OpenMode openMode, ReadWriteLock lock, TaskMonitor monitor, Language baseLanguage, DBTrace trace, DBTraceThreadManager threadManager) -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]arrayFromComment(String comment) Split a comment into an array of linesvoidclearComments(Lifespan span, AddressRange range, CommentType commentType) Clear all comments in the given box of the given typestatic StringcommentFromArray(String[] comment) Construct a comment from an array of linesgetComment(long snap, Address address, CommentType commentType) Get the comment at the given pointprotected voidmakeWay(DBTraceCommentAdapter.DBTraceCommentEntry entry, Lifespan span) Truncate or delete and existing comment entryPut an entry into the mapvoidsetComment(Lifespan lifespan, Address address, CommentType commentType, String comment) Set a comment at the given address for the given lifespanMethods inherited from class ghidra.trace.database.map.DBTraceAddressSnapRangePropertyMap
clear, createSpace, deleteData, deleteValue, entries, firstEntry, firstKey, firstValue, getAddressSetView, getAddressSetView, getForSpace, getName, getRegisterSpace, getRegisterSpace, isEmpty, keys, orderedEntries, orderedKeys, orderedValues, readLock, reduce, remove, remove, size, values, writeLockMethods 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
checkIsInMemory, delegateAddressSet, delegateAny, delegateCollection, delegateDeleteB, delegateDeleteV, delegateFirst, delegateHashSet, delegateRead, delegateRead, delegateReadB, delegateReadI, delegateReadI, delegateReadOr, delegateWrite, delegateWriteAll, delegateWriteI, delegateWriteVMethods inherited from interface ghidra.trace.model.map.TraceAddressSnapRangePropertyMapOperations
put, put, put, put
-
Field Details
-
EMPTY_STRING_ARRAY
-
-
Constructor Details
-
DBTraceCommentAdapter
public DBTraceCommentAdapter(DBHandle dbh, OpenMode openMode, ReadWriteLock lock, TaskMonitor monitor, Language baseLanguage, DBTrace trace, DBTraceThreadManager threadManager) throws IOException, VersionException - Throws:
IOExceptionVersionException
-
-
Method Details
-
makeWay
Truncate or delete and existing comment entryIt is assumed the entry intersects some implied address range.
- Parameters:
entry- the entry to truncate or deletespan- the span that must be clear
-
setComment
Set a comment at the given address for the given lifespan- Parameters:
lifespan- the lifespanaddress- the addresscommentType- the type of comment as inListing.setComment(Address, CommentType, String)comment- the comment
-
commentFromArray
Construct a comment from an array of lines- Parameters:
comment- the lines or null- Returns:
- the comment text or null
-
arrayFromComment
Split a comment into an array of lines- Parameters:
comment- the comment text or null- Returns:
- the array of lines or null
-
getComment
Get the comment at the given point- Parameters:
snap- the snapaddress- the addresscommentType- the type of comment- Returns:
- the comment text
-
clearComments
Clear all comments in the given box of the given type- Parameters:
span- the lifespan fo the boxrange- the address range of the boxcommentType- a comment type to clear, or null to clear all.
-
put
public DBTraceCommentAdapter.DBTraceCommentEntry put(TraceAddressSnapRange shape, DBTraceCommentAdapter.DBTraceCommentEntry value) Description copied from interface:SpatialMapPut an entry into the mapNote that the map may copy, and possibly modify, the given value. The value returned is the value actually stored by the map. This may be useful when the map's values are identical to its records. This allows the creation of a "blank" entry with a given shape. The entry is then populated by the user.
class MyDBDataRecord extends DBTreeDataRecord<MyShape, MyNodeShape, MyDBDataRecord> { @Override protected void setValue(MyDBDataRecord value) { // Do nothing: value ought to be null. Map will create and return "blank" record } protected MyDBDataRecord getValue() { return this; // The record is the value } } MyDBDataRecord rec = map.put(MyShape.create(args), null); rec.setSomething(6); rec.setAnother("My user data");This practice is preferred when the values are not simple, and/or when the shape is a property of the value. In other cases, e.g., when the value is an enum or a
Color, thenDBTreeDataRecord.setRecordValue(Object)andDBTreeDataRecord.getRecordValue()should be implemented as field accessors.- Specified by:
putin interfaceSpatialMap<TraceAddressSnapRange,DBTraceCommentAdapter.DBTraceCommentEntry, DBTraceAddressSnapRangePropertyMapTree.TraceAddressSnapRangeQuery> - Overrides:
putin classDBTraceAddressSnapRangePropertyMap<DBTraceCommentAdapter.DBTraceCommentEntry,DBTraceCommentAdapter.DBTraceCommentEntry> - Parameters:
shape- the shape of the entryvalue- the value for the entry- Returns:
- the value as stored in the map
-