Interface TraceCodeUnit
- All Superinterfaces:
CodeUnit,MemBuffer,PropertySet
- All Known Subinterfaces:
DBTraceCodeUnitAdapter,DBTraceDataAdapter,DBTraceDefinedDataAdapter,InstructionAdapterFromPrototype,TraceData,TraceInstruction
- All Known Implementing Classes:
AbstractDBTraceCodeUnit,AbstractDBTraceDataComponent,AbstractDBTraceProgramViewListing.DBTraceProgramViewUndefinedData,DBTraceData,DBTraceDataArrayElementComponent,DBTraceDataCompositeFieldComponent,DBTraceInstruction,UndefinedDBTraceData
Trace-
Field Summary
Fields inherited from interface ghidra.program.model.listing.CodeUnit
COMMENT_PROPERTY, DEFINED_DATA_PROPERTY, EOL_COMMENT, INSTRUCTION_PROPERTY, MNEMONIC, PLATE_COMMENT, POST_COMMENT, PRE_COMMENT, REPEATABLE_COMMENT, SPACE_PROPERTY -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()Delete this code unitGet the bounds of this unit in space and timeintgetBytes(ByteBuffer buffer, int addressOffset) Read bytes starting at this unit's address plus the given offset into the given bufferlongGet the end snap of this code unitGet the language of this code unitGet the lifespan of this code unitGet references for the mnemonic for this code unit.getOperandReferences(int index) Returns the references for the operand index..Get the platform for this unitgetPrimaryReference(int index) Returns the primary reference for the operand index..Returns the program that generated this CodeUnit..<T> TgetProperty(String name, Class<T> valueClass) Get a property having the given typegetRange()Get the address range covered by this unitGet ALL memory references FROM this code unit.longGet the start snap of this code unitGet the thread associated with this code unitgetTrace()Get the trace in which this code unit existsvoidsetEndSnap(long endSnap) Set the end snap of this code unit<T> voidsetProperty(String name, Class<T> valueClass, T value) Set a property of the given type to the given value<T,U extends T>
voidsetTypedProperty(String name, T value) Set a property having the same type as the given valueMethods inherited from interface ghidra.program.model.listing.CodeUnit
addMnemonicReference, addOperandReference, compareTo, contains, getAddress, getAddressString, getBytes, getBytesInCodeUnit, getComment, getComment, getCommentAsArray, getCommentAsArray, getExternalReference, getLabel, getLength, getMaxAddress, getMinAddress, getMnemonicString, getNumOperands, getPrimarySymbol, getReferenceIteratorTo, getScalar, getSymbols, removeExternalReference, removeMnemonicReference, removeOperandReference, setComment, setComment, setCommentAsArray, setCommentAsArray, setPrimaryMemoryReference, setRegisterReference, setStackReferenceMethods inherited from interface ghidra.program.model.mem.MemBuffer
getAddress, getBigInteger, getByte, getBytes, getInputStream, getInputStream, getInt, getLong, getMemory, getShort, getUnsignedByte, getUnsignedInt, getUnsignedShort, getVarLengthInt, getVarLengthUnsignedInt, isBigEndian, isInitializedMemoryMethods inherited from interface ghidra.program.model.util.PropertySet
getIntProperty, getObjectProperty, getStringProperty, getVoidProperty, hasProperty, propertyNames, removeProperty, setProperty, setProperty, setProperty, setProperty
-
Method Details
-
getTrace
Trace getTrace()Get the trace in which this code unit exists- Returns:
- the trace
-
getPlatform
TracePlatform getPlatform()Get the platform for this unit- Returns:
- the platform
-
getProgram
TraceProgramView getProgram()Description copied from interface:CodeUnitReturns the program that generated this CodeUnit..- Specified by:
getProgramin interfaceCodeUnit- Returns:
- the program that generated this CodeUnit.
-
getThread
TraceThread getThread()Get the thread associated with this code unitA thread is associated with a code unit if it exists in a register space
- Returns:
- the thread
-
getLanguage
Language getLanguage()Get the language of this code unitCurrently, for data units, this is always the base or "host" language of the trace. For instructions, this may be a guest language.
- Returns:
- the language
-
getBounds
TraceAddressSnapRange getBounds()Get the bounds of this unit in space and time- Returns:
- the bounds
-
getRange
AddressRange getRange()Get the address range covered by this unit- Returns:
- the range
-
getLifespan
Lifespan getLifespan()Get the lifespan of this code unit- Returns:
- the lifespan
-
getStartSnap
long getStartSnap()Get the start snap of this code unit- Returns:
- the first snap of this unit's lifespan
-
setEndSnap
void setEndSnap(long endSnap) Set the end snap of this code unit- Parameters:
endSnap- the last snap of this unit's lifespan- Throws:
IllegalArgumentException- if the end snap is less than the start snap
-
getEndSnap
long getEndSnap()Get the end snap of this code unit- Returns:
- the last snap of this unit's lifespan
-
delete
void delete()Delete this code unit -
getBytes
Read bytes starting at this unit's address plus the given offset into the given bufferThis method honors the markers (position and limit) of the destination buffer. Use those markers to control the destination offset and maximum length.
- Parameters:
buffer- the destination bufferaddressOffset- the offset from this unit's (minimum) address- Returns:
- the number of bytes read
-
setProperty
Set a property of the given type to the given valueThis method is preferred to
setTypedProperty(String, Object), because in the case the property map does not already exist, the desired type is given explicitly.While it is best practice to match
valueClassexactly with the type of the map, this method will work so long as the givenvalueClassis a subtype of the map's type. If the property map does not already exist, it is created with the givenvalueClass. Note that there is no established mechanism for restoring values of a subtype from the underlying database.Currently, the only supported types are
Integer,String,Void, and subtypes ofSaveable.- Parameters:
name- the name of the propertyvalueClass- the type of the propertyvalue- the value of the property
-
setTypedProperty
Set a property having the same type as the given valueIf the named property has a super-type of the value's type, the value is accepted. If not, a
TypeMismatchExceptionis thrown. If the property map does not already exist, it is created having exactly the type of the given value.This method exists for two reasons: 1) To introduce the type variable U, which is more existential, and 2) to remove the requirement to subtype
Saveable. Otherwise, this method is identical in operation toPropertySet.setProperty(String, Saveable).- Parameters:
name- the name of the propertyvalue- the value of the property
-
getProperty
Get a property having the given typeIf the named property has a sub-type of the given
valueClass, the value (possiblynull) is returned. If the property does not exist,nullis returned. OtherwiseTypeMismatchExceptionis thrown, even if the property is not set at this unit's address.Note that getting a
Voidproperty will always returnnull. UsePropertySet.getVoidProperty(String)instead to detect if the property is set.PropertySet.hasProperty(String)will also work, but it does not verify that the property's type is actuallyVoid.- Parameters:
name- the name of the propertyvalueClass- the expected type of the value (or a super-type thereof)- Returns:
- the value of the property, or
null
-
getMnemonicReferences
TraceReference[] getMnemonicReferences()Description copied from interface:CodeUnitGet references for the mnemonic for this code unit.- Specified by:
getMnemonicReferencesin interfaceCodeUnit- Returns:
- an array of memory references. A zero length array will be returned if there are no references for the mnemonic.
-
getOperandReferences
Description copied from interface:CodeUnitReturns the references for the operand index..- Specified by:
getOperandReferencesin interfaceCodeUnit- Parameters:
index- operand index (0 is the first operand)- Returns:
- the references for the operand index.
-
getPrimaryReference
Description copied from interface:CodeUnitReturns the primary reference for the operand index..- Specified by:
getPrimaryReferencein interfaceCodeUnit- Parameters:
index- operand index (0 is the first operand)- Returns:
- the primary reference for the operand index.
-
getReferencesFrom
TraceReference[] getReferencesFrom()Description copied from interface:CodeUnitGet ALL memory references FROM this code unit.- Specified by:
getReferencesFromin interfaceCodeUnit- Returns:
- an array of memory references from this codeUnit or an empty array if there are no references.
-