Package ghidra.program.model.listing
Class DataStub
java.lang.Object
ghidra.program.model.listing.DataStub
- All Implemented Interfaces:
Settings,CodeUnit,Data,MemBuffer,PropertySet
DataStub can be extended for use by tests. It throws an UnsupportedOperationException
for all methods in the Data interface. Any method that is needed for your test can then
be overridden so it can provide its own test implementation and return value.
-
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_PROPERTYFields inherited from interface ghidra.docking.settings.Settings
EMPTY_STRING_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMnemonicReference(Address refAddr, RefType refType, SourceType sourceType) Add a reference to the mnemonic for this code unit.voidaddOperandReference(int index, Address refAddr, RefType type, SourceType sourceType) Add a memory reference to the operand at the given index.voidaddValueReference(Address refAddr, RefType type) Add a memory reference to the value.voidRemoves all name-value pairs from this settings objectvoidclearSetting(String name) Removes any value associated with the given nameintCompares the given address to the address range of this node.booleanReturns true if address is contained in the range of this codeUnit.Get the Address which corresponds to the offset 0.getAddress(int opIndex) Get the Address for the given operand index if one exists.getAddressString(boolean showBlockName, boolean pad) Get the string representation of the starting address for this code unit.If the dataType is a typeDef, then the typeDef's base type is returned, otherwise, the datatType is returned.getBigInteger(int offset, int size, boolean signed) returns the value at the given offset, taking into account the endianness.bytegetByte(int offset) Get one byte from memory at the current position plus offset.byte[]getBytes()Get the bytes that make up this code unit.intgetBytes(byte[] b, int memoryBufferOffset) Readsb.lengthbytes from this memory buffer starting at the address of this memory buffer plus the given memoryBufferOffset from that position.voidgetBytesInCodeUnit(byte[] buffer, int bufferOffset) Copies max(buffer.length, code unit length) bytes into buffer starting at location offset in buffer.getComment(CommentType commentType) Get the comment for the given typeString[]getCommentAsArray(CommentType commentType) Get the comment for the given type and parse it into an array of strings such that each line is its own string.getComponent(int index) Returns the immediate n'th component or null if none exists.getComponent(int[] componentPath) Get a data item given the index path.getComponentAt(int offset) Return the first immediate child component that contains the byte at the given offset.getComponentContaining(int offset) Return the first immediate child component that contains the byte at the given offset.intGet the index of this component in its parentintGet this data's component level in its hierarchy of components.int[]Get the component path if this is a component.Returns the component path name (dot notation) for this fieldgetComponentsContaining(int offset) Returns a list of all the immediate child components that contain the byte at the given offset.Get the Data type for the data.Returns the appropriate string to use as the default label prefix or null if it has no preferred default label prefix;Returns the underlying default settings for these settings or null if there are noneReturns a string that represents the data value without markup.getExternalReference(int opIndex) Gets the external reference (if any) at the opIndexGet the field name of this data item if it is "inside" another data item, otherwise return null.intgetInt(int offset) returns the int at the given offset, taking into account the endianness.intgetIntProperty(String name) Get the int property for name.getLabel()Returns the label for this code unit..intGet length of this code unit.longgetLong(int offset) returns the long at the given offset, taking into account the endianness.Gets the Long value associated with the given nameReturns the ending address for this code unit..Get the Memory object actually used by the MemBuffer.Returns the starting address for this code unit..Get references for the mnemonic for this code unit.Returns the mnemonic for this code unit, e.g., MOV, JMP.String[]getNames()Get this list of keys that currently have values associated with themintReturn the number of components that make up this data item.intReturns the number of operands for this code unit..getObjectProperty(String name) Get the object property for name; returns null if there is no name property for this code unit.getOperandReferences(int index) Returns the references for the operand index..Get the immediate parent data item of this data item or null if this data item is not contained in another data item.intGet the offset of this Data item from the start of its immediate parent.Returns the full path name (dot notation) for this field.getPrimaryReference(int index) Returns the primary reference for the operand index..Returns the Primary Symbol for this code unit..getPrimitiveAt(int offset) Returns the primitive component containing this offset (i.e., one that does not have sub-components).Returns the program that generated this CodeUnit..Returns an iterator over all references TO this code unit..Get ALL memory references FROM this code unit.getRoot()Get the highest level Data item in a hierarchy of structures containing this component.intGet the offset of this Data item from the start of the root data item of some hierarchy of structures.getScalar(int opIndex) Returns the scalar at the given operand index.shortgetShort(int offset) returns the short at the given offset, taking into account the endianness.Gets the String value associated with the given namegetStringProperty(String name) Get the string property for name; returns null if there is no name property for this code unit.Symbol[]Returns the Symbols for this code unit..getValue()Returns the value of the data item.Gets the object associated with the given nameClass<?> Get the class used to express the value of this data.Get the references for the value.booleangetVoidProperty(String name) Returns whether this code unit is marked as having the name property.booleanhasProperty(String name) Returns true if the codeunit has the given property defined.booleanReturns true if this data corresponds to string data.booleanisArray()Returns true if this data item is an Array of DataTypesbooleanReturns true if the underlying bytes are in big-endian order, false if they are little endian.booleanisChangeAllowed(SettingsDefinition settingsDefinition) Determine if a settings change corresponding to the specified settingsDefinition is permitted.booleanDetermine if this data has explicitly been marked as constant.booleanReturns true if the data type is defined.booleanReturns true if this data item is a dynamic DataType.booleanisEmpty()Returns true if there are no key-value pairs stored in this settings object.booleanReturns true if this is a pointer, which implies getValue() will return an Object that is an Address.booleanReturns true if this data item is a Structure.booleanisUnion()Returns true if this data item is a Union.booleanDetermine if this data has explicitly been marked as volatile.booleanDetermine if this data has explicitly been marked as writable.Get an iterator over the property names which have values applied.voidremoveExternalReference(int opIndex) Remove external reference (if any) at the given opIndexvoidremoveMnemonicReference(Address refAddr) Remove a reference to the mnemonic for this code unit.voidremoveOperandReference(int index, Address refAddr) Remove a reference to the operand.voidremoveProperty(String name) Remove the property value associated with the given name .voidremoveValueReference(Address refAddr) Remove a reference to the value.voidsetComment(CommentType commentType, String comment) Set the comment for the given comment type.voidsetCommentAsArray(CommentType commentType, String[] comment) Set the comment (with each line in its own string) for the given comment typevoidAssociates the given long value with the name.voidSets a memory reference to be the primary reference at its address/opIndex location.voidsetProperty(String name) Set the named property.voidsetProperty(String name, int value) Set the named integer property with the given value.voidsetProperty(String name, Saveable value) Set the named property with the givenSaveablevalue.voidsetProperty(String name, String value) Set the named string property with the given value.voidsetRegisterReference(int opIndex, Register reg, SourceType sourceType, RefType refType) Sets a register reference at theoffseton the specified operand index, which effectively substitutes the previous operation interpretation
NOTE: If another reference was previously set on the operand, then it will be replaced with this register referencevoidsetStackReference(int opIndex, int offset, SourceType sourceType, RefType refType) Sets a stack reference at theoffseton the specified operand index, which effectively substitutes the previous operation interpretation
NOTE: If another reference was previously set on the operand, then it will be replaced with this stack referencevoidAssociates the given String value with the name.voidAssociates the given object with the name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.program.model.listing.CodeUnit
getComment, getCommentAsArray, setComment, setCommentAsArrayMethods inherited from interface ghidra.program.model.mem.MemBuffer
getInputStream, getInputStream, getUnsignedByte, getUnsignedInt, getUnsignedShort, getVarLengthInt, getVarLengthUnsignedInt, isInitializedMemoryMethods inherited from interface ghidra.docking.settings.Settings
getSuggestedValues
-
Constructor Details
-
DataStub
public DataStub()
-
-
Method Details
-
getAddressString
Description copied from interface:CodeUnitGet the string representation of the starting address for this code unit.- Specified by:
getAddressStringin interfaceCodeUnit- Parameters:
showBlockName- true if the string should include the memory block namepad- if true, the address will be padded with leading zeros. Even if pad is false, the string will be padded to make the address string contain at least 4 digits.- Returns:
- string representation of address
-
setProperty
Description copied from interface:PropertySetSet the named property with the givenSaveablevalue.- Specified by:
setPropertyin interfacePropertySet- Parameters:
name- the name of the property.value- value to be stored.
-
setProperty
Description copied from interface:PropertySetSet the named string property with the given value.- Specified by:
setPropertyin interfacePropertySet- Parameters:
name- the name of the property.value- value to be stored.
-
setProperty
Description copied from interface:PropertySetSet the named integer property with the given value.- Specified by:
setPropertyin interfacePropertySet- Parameters:
name- the name of the property.value- value to be stored.
-
setProperty
Description copied from interface:PropertySetSet the named property. This method is used for "void" properites. The property is either set or not set - there is no value- Specified by:
setPropertyin interfacePropertySet- Parameters:
name- the name of the property.
-
getObjectProperty
Description copied from interface:PropertySetGet the object property for name; returns null if there is no name property for this code unit.- Specified by:
getObjectPropertyin interfacePropertySet- Parameters:
name- the name of the property- Returns:
Saveableproperty value, with map-specific implementation class, or null.
-
getStringProperty
Description copied from interface:PropertySetGet the string property for name; returns null if there is no name property for this code unit.- Specified by:
getStringPropertyin interfacePropertySet- Parameters:
name- the name of the property- Returns:
- string property value or null
-
getIntProperty
Description copied from interface:PropertySetGet the int property for name.- Specified by:
getIntPropertyin interfacePropertySet- Parameters:
name- the name of the property- Returns:
- integer property value property has been set
- Throws:
NoValueException- if there is not name property for this code unit
-
hasProperty
Description copied from interface:PropertySetReturns true if the codeunit has the given property defined. This method works for all property map types.- Specified by:
hasPropertyin interfacePropertySet- Parameters:
name- the name of the property- Returns:
- true if property has been set, else false
-
getVoidProperty
Description copied from interface:PropertySetReturns whether this code unit is marked as having the name property.- Specified by:
getVoidPropertyin interfacePropertySet- Parameters:
name- the name of the property- Returns:
- true if property has been set, else false
-
propertyNames
Description copied from interface:PropertySetGet an iterator over the property names which have values applied.- Specified by:
propertyNamesin interfacePropertySet- Returns:
- iterator of all property map names which have values applied
-
removeProperty
Description copied from interface:PropertySetRemove the property value associated with the given name .- Specified by:
removePropertyin interfacePropertySet- Parameters:
name- the name of the property
-
getLabel
Description copied from interface:CodeUnitReturns the label for this code unit.. -
getSymbols
Description copied from interface:CodeUnitReturns the Symbols for this code unit..- Specified by:
getSymbolsin interfaceCodeUnit- Returns:
- the Symbols for this code unit.
-
getPrimarySymbol
Description copied from interface:CodeUnitReturns the Primary Symbol for this code unit..- Specified by:
getPrimarySymbolin interfaceCodeUnit- Returns:
- the Primary Symbol for this code unit.
-
getMinAddress
Description copied from interface:CodeUnitReturns the starting address for this code unit..- Specified by:
getMinAddressin interfaceCodeUnit- Returns:
- the starting address for this code unit.
-
getMaxAddress
Description copied from interface:CodeUnitReturns the ending address for this code unit..- Specified by:
getMaxAddressin interfaceCodeUnit- Returns:
- the ending address for this code unit.
-
getMnemonicString
Description copied from interface:CodeUnitReturns the mnemonic for this code unit, e.g., MOV, JMP.- Specified by:
getMnemonicStringin interfaceCodeUnit- Returns:
- the mnemonic for this code unit, e.g., MOV, JMP
-
getComment
Description copied from interface:CodeUnitGet the comment for the given type- Specified by:
getCommentin interfaceCodeUnit- Parameters:
commentType-comment type- Returns:
- the comment string of the appropriate type or null if no comment of that type exists for this code unit
-
getCommentAsArray
Description copied from interface:CodeUnitGet the comment for the given type and parse it into an array of strings such that each line is its own string.- Specified by:
getCommentAsArrayin interfaceCodeUnit- Parameters:
commentType-comment type- Returns:
- an array of strings where each item in the array is a line of text in the comment. If there is no comment of the requested type, an empty array is returned.
-
setComment
Description copied from interface:CodeUnitSet the comment for the given comment type. Passingnullclears the comment- Specified by:
setCommentin interfaceCodeUnit- Parameters:
commentType-comment typecomment- comment for code unit; null clears the comment
-
setCommentAsArray
Description copied from interface:CodeUnitSet the comment (with each line in its own string) for the given comment type- Specified by:
setCommentAsArrayin interfaceCodeUnit- Parameters:
commentType-comment typecomment- an array of strings where each string is a single line of the comment.
-
getLength
public int getLength()Description copied from interface:CodeUnitGet length of this code unit. NOTE: If aninstruction length-overrideis set this method will return the reduced length. -
getBytes
Description copied from interface:CodeUnitGet the bytes that make up this code unit. NOTE: If aninstruction length-overrideis set this method will not return all bytes associated with theinstruction prototype.- Specified by:
getBytesin interfaceCodeUnit- Returns:
- an array of bytes that are in memory at the codeunits address. The array length is the same as the codeUnits length
- Throws:
MemoryAccessException- if the full number of bytes could not be read.
-
getBytesInCodeUnit
Description copied from interface:CodeUnitCopies max(buffer.length, code unit length) bytes into buffer starting at location offset in buffer.- Specified by:
getBytesInCodeUnitin interfaceCodeUnit- Parameters:
buffer- byte array to copy intobufferOffset- offset in byte array the copy will start- Throws:
MemoryAccessException- if the full number of bytes could not be read.
-
contains
Description copied from interface:CodeUnitReturns true if address is contained in the range of this codeUnit. -
compareTo
Description copied from interface:CodeUnitCompares the given address to the address range of this node. -
addMnemonicReference
Description copied from interface:CodeUnitAdd a reference to the mnemonic for this code unit.- Specified by:
addMnemonicReferencein interfaceCodeUnit- Parameters:
refAddr- address to add as a reference.refType- the type of reference to add.sourceType- the source of this reference
-
removeMnemonicReference
Description copied from interface:CodeUnitRemove a reference to the mnemonic for this code unit.- Specified by:
removeMnemonicReferencein interfaceCodeUnit- Parameters:
refAddr- the address to remove as a reference.
-
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.
-
addOperandReference
Description copied from interface:CodeUnitAdd a memory reference to the operand at the given index.- Specified by:
addOperandReferencein interfaceCodeUnit- Parameters:
index- operand indexrefAddr- reference addresstype- the reference type to be added.sourceType- the source of this reference
-
removeOperandReference
Description copied from interface:CodeUnitRemove a reference to the operand.- Specified by:
removeOperandReferencein interfaceCodeUnit- Parameters:
index- operand indexrefAddr- address referencing the operand
-
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.
-
getReferenceIteratorTo
Description copied from interface:CodeUnitReturns an iterator over all references TO this code unit..- Specified by:
getReferenceIteratorToin interfaceCodeUnit- Returns:
- an iterator over all references TO this code unit.
-
getProgram
Description copied from interface:CodeUnitReturns the program that generated this CodeUnit..- Specified by:
getProgramin interfaceCodeUnit- Returns:
- the program that generated this CodeUnit.
-
getExternalReference
Description copied from interface:CodeUnitGets the external reference (if any) at the opIndex- Specified by:
getExternalReferencein interfaceCodeUnit- Parameters:
opIndex- the operand index to look for external references- Returns:
- the external reference at the operand or null if none exists.
-
removeExternalReference
public void removeExternalReference(int opIndex) Description copied from interface:CodeUnitRemove external reference (if any) at the given opIndex- Specified by:
removeExternalReferencein interfaceCodeUnit- Parameters:
opIndex- the index of the operand from which to remove any external reference.
-
setPrimaryMemoryReference
Description copied from interface:CodeUnitSets a memory reference to be the primary reference at its address/opIndex location. The primary reference is the one that is used in the getOperandRepresentation() method.- Specified by:
setPrimaryMemoryReferencein interfaceCodeUnit- Parameters:
ref- the reference to be set as primary.
-
setStackReference
Description copied from interface:CodeUnitSets a stack reference at theoffseton the specified operand index, which effectively substitutes the previous operation interpretation
NOTE: If another reference was previously set on the operand, then it will be replaced with this stack reference- Specified by:
setStackReferencein interfaceCodeUnit- Parameters:
opIndex- the index of the operand to set this stack referenceoffset- the (+/-) offset from stack base addresssourceType- the source of this referencerefType- type of reference, RefType.READ,WRITE,PTR...
-
setRegisterReference
Description copied from interface:CodeUnitSets a register reference at theoffseton the specified operand index, which effectively substitutes the previous operation interpretation
NOTE: If another reference was previously set on the operand, then it will be replaced with this register reference- Specified by:
setRegisterReferencein interfaceCodeUnit- Parameters:
opIndex- the index of the operand to set this register referencereg- a registersourceType- the source of this referencerefType- type of reference, RefType.READ,WRITE,PTR...
-
getNumOperands
public int getNumOperands()Description copied from interface:CodeUnitReturns the number of operands for this code unit..- Specified by:
getNumOperandsin interfaceCodeUnit- Returns:
- the number of operands for this code unit.
-
getAddress
Description copied from interface:CodeUnitGet the Address for the given operand index if one exists. Data objects have one operand (the value).- Specified by:
getAddressin interfaceCodeUnit- Parameters:
opIndex- index of the operand.- Returns:
- An addres if the operand represents a fully qualified address (given the context), or if the operand is a Scalar treated as an address. Null is returned if no address or scalar exists on that operand.
-
getScalar
Description copied from interface:CodeUnitReturns the scalar at the given operand index. Data objects have one operand (the value). -
getByte
Description copied from interface:MemBufferGet one byte from memory at the current position plus offset.- Specified by:
getBytein interfaceMemBuffer- Parameters:
offset- the displacement from the current position.- Returns:
- the data at offset from the current position.
- Throws:
MemoryAccessException- if memory cannot be read at the specified offset
-
getBytes
public int getBytes(byte[] b, int memoryBufferOffset) Description copied from interface:MemBufferReadsb.lengthbytes from this memory buffer starting at the address of this memory buffer plus the given memoryBufferOffset from that position. The actual number of bytes may be fewer if bytes can't be read.- Specified by:
getBytesin interfaceMemBuffer- Parameters:
b- the buffer into which bytes will be placedmemoryBufferOffset- the offset in this memory buffer from which to start reading bytes.- Returns:
- the number of bytes read which may be fewer than b.length if available bytes are exhausted or no bytes are available at the specified offset.
-
getAddress
Description copied from interface:MemBufferGet the Address which corresponds to the offset 0.- Specified by:
getAddressin interfaceMemBuffer- Returns:
- the current address of offset 0.
-
getMemory
Description copied from interface:MemBufferGet the Memory object actually used by the MemBuffer. -
isBigEndian
public boolean isBigEndian()Description copied from interface:MemBufferReturns true if the underlying bytes are in big-endian order, false if they are little endian.- Specified by:
isBigEndianin interfaceMemBuffer- Returns:
- true if the underlying bytes are in big-endian order, false if they are little endian.
-
getShort
Description copied from interface:MemBufferreturns the short at the given offset, taking into account the endianness.- Specified by:
getShortin interfaceMemBuffer- Parameters:
offset- the offset from the membuffers origin (the address that it is set at)- Returns:
- the short at the given offset, taking into account the endianness.
- Throws:
MemoryAccessException- if a 2-byte short value cannot be read at the specified offset
-
getInt
Description copied from interface:MemBufferreturns the int at the given offset, taking into account the endianness.- Specified by:
getIntin interfaceMemBuffer- Parameters:
offset- the offset from the membuffers origin (the address that it is set at)- Returns:
- the int at the given offset, taking into account the endianness.
- Throws:
MemoryAccessException- if a 4-byte integer value cannot be read at the specified offset
-
getLong
Description copied from interface:MemBufferreturns the long at the given offset, taking into account the endianness.- Specified by:
getLongin interfaceMemBuffer- Parameters:
offset- the offset from the membuffers origin (the address that it is set at)- Returns:
- the long at the given offset, taking into account the endianness.
- Throws:
MemoryAccessException- if a 8-byte long value cannot be read at the specified offset
-
getBigInteger
Description copied from interface:MemBufferreturns the value at the given offset, taking into account the endianness.- Specified by:
getBigIntegerin interfaceMemBuffer- Parameters:
offset- the offset from the membuffers origin (the address that it is set at)size- the number of bytes to include in the valuesigned- true if value should be treated as a signed twos-compliment value.- Returns:
- the value at the given offset, taking into account the endianness.
- Throws:
MemoryAccessException- if the request size value cannot be read at the specified offset
-
isChangeAllowed
Description copied from interface:SettingsDetermine if a settings change corresponding to the specified settingsDefinition is permitted.- Specified by:
isChangeAllowedin interfaceSettings- Parameters:
settingsDefinition- settings definition- Returns:
- true if change permitted else false
-
getLong
Description copied from interface:SettingsGets the Long value associated with the given name -
getString
Description copied from interface:SettingsGets the String value associated with the given name -
getValue
Description copied from interface:SettingsGets the object associated with the given name -
setLong
Description copied from interface:SettingsAssociates the given long value with the name. Note that an attempted setting change may be ignored if prohibited (e.g., immutable Settings, undefined setting name). -
setString
Description copied from interface:SettingsAssociates the given String value with the name. Note that an attempted setting change may be ignored if prohibited (e.g., immutable Settings, undefined setting name). -
setValue
Description copied from interface:SettingsAssociates the given object with the name. Note that an attempted setting change may be ignored if prohibited (e.g., immutable Settings, undefined setting name). -
clearSetting
Description copied from interface:SettingsRemoves any value associated with the given name- Specified by:
clearSettingin interfaceSettings- Parameters:
name- the key to remove any association
-
clearAllSettings
public void clearAllSettings()Description copied from interface:SettingsRemoves all name-value pairs from this settings object- Specified by:
clearAllSettingsin interfaceSettings
-
getNames
Description copied from interface:SettingsGet this list of keys that currently have values associated with them -
isEmpty
public boolean isEmpty()Description copied from interface:SettingsReturns true if there are no key-value pairs stored in this settings object. This is not a reflection of the underlying default settings which may still contain a key-value pair when this settings object is empty. -
getDefaultSettings
Description copied from interface:SettingsReturns the underlying default settings for these settings or null if there are none- Specified by:
getDefaultSettingsin interfaceSettings- Returns:
- underlying default settings or null
-
getValue
Description copied from interface:DataReturns the value of the data item. The value may be an address, a scalar, register or null if no value. -
getValueClass
Description copied from interface:DataGet the class used to express the value of this data.NOTE: This determination is made based upon data type and settings only and does not examine memory bytes which are used to construct the data value object.
- Specified by:
getValueClassin interfaceData- Returns:
- value class or null if a consistent class is not utilized.
-
hasStringValue
public boolean hasStringValue()Description copied from interface:DataReturns true if this data corresponds to string data. This is determined by the corresponding data type producing a String value.- Specified by:
hasStringValuein interfaceData- Returns:
- true if this data returns a String value and can be treated as string data.
-
isConstant
public boolean isConstant()Description copied from interface:DataDetermine if this data has explicitly been marked as constant. NOTE: This is based upon explicitDataandDataTypemutability settings and does not reflect independent memory block or processor specification settings.- Specified by:
isConstantin interfaceData- Returns:
- true if data is constant, else false.
-
isWritable
public boolean isWritable()Description copied from interface:DataDetermine if this data has explicitly been marked as writable. NOTE: This is based upon explicitDataandDataTypemutability settings and does not reflect independent memory block or processor specification settings.- Specified by:
isWritablein interfaceData- Returns:
- true if data is writable, else false.
-
isVolatile
public boolean isVolatile()Description copied from interface:DataDetermine if this data has explicitly been marked as volatile. NOTE: This is based upon explicitDataandDataTypemutability settings and does not reflect independent memory block or processor specification settings.- Specified by:
isVolatilein interfaceData- Returns:
- true if data is volatile, else false.
-
isDefined
public boolean isDefined()Description copied from interface:DataReturns true if the data type is defined. Any address that has not been defined to be code or data is treated as undefined data. -
getDataType
Description copied from interface:DataGet the Data type for the data.- Specified by:
getDataTypein interfaceData- Returns:
- the data type
-
getBaseDataType
Description copied from interface:DataIf the dataType is a typeDef, then the typeDef's base type is returned, otherwise, the datatType is returned.- Specified by:
getBaseDataTypein interfaceData- Returns:
- the data type
-
getValueReferences
Description copied from interface:DataGet the references for the value.- Specified by:
getValueReferencesin interfaceData- Returns:
- the references
-
addValueReference
Description copied from interface:DataAdd a memory reference to the value.- Specified by:
addValueReferencein interfaceData- Parameters:
refAddr- address referenced.type- the type of reference to be added.
-
removeValueReference
Description copied from interface:DataRemove a reference to the value.- Specified by:
removeValueReferencein interfaceData- Parameters:
refAddr- address of reference to be removed.
-
getFieldName
Description copied from interface:DataGet the field name of this data item if it is "inside" another data item, otherwise return null.- Specified by:
getFieldNamein interfaceData- Returns:
- the name of this data as known from some parent data item or null if this data item is not a component of another data item.
-
getPathName
Description copied from interface:DataReturns the full path name (dot notation) for this field. This includes the symbol name at this address.- Specified by:
getPathNamein interfaceData- Returns:
- the path name
-
getComponentPathName
Description copied from interface:DataReturns the component path name (dot notation) for this field- Specified by:
getComponentPathNamein interfaceData- Returns:
- the component path name
-
isPointer
public boolean isPointer()Description copied from interface:DataReturns true if this is a pointer, which implies getValue() will return an Object that is an Address. -
isUnion
public boolean isUnion()Description copied from interface:DataReturns true if this data item is a Union. -
isStructure
public boolean isStructure()Description copied from interface:DataReturns true if this data item is a Structure.- Specified by:
isStructurein interfaceData- Returns:
- true if a structure
-
isArray
public boolean isArray()Description copied from interface:DataReturns true if this data item is an Array of DataTypes -
isDynamic
public boolean isDynamic()Description copied from interface:DataReturns true if this data item is a dynamic DataType. -
getParent
Description copied from interface:DataGet the immediate parent data item of this data item or null if this data item is not contained in another data item. -
getRoot
Description copied from interface:DataGet the highest level Data item in a hierarchy of structures containing this component. -
getRootOffset
public int getRootOffset()Description copied from interface:DataGet the offset of this Data item from the start of the root data item of some hierarchy of structures.- Specified by:
getRootOffsetin interfaceData- Returns:
- the offset
-
getParentOffset
public int getParentOffset()Description copied from interface:DataGet the offset of this Data item from the start of its immediate parent.- Specified by:
getParentOffsetin interfaceData- Returns:
- the offset
-
getComponent
Description copied from interface:DataReturns the immediate n'th component or null if none exists.- Specified by:
getComponentin interfaceData- Parameters:
index- the index of the component to get.- Returns:
- the component
-
getComponent
Description copied from interface:DataGet a data item given the index path. Each integer in the array represents an index into the data item at that level.- Specified by:
getComponentin interfaceData- Parameters:
componentPath- the array of indexes to use to find the requested data item.- Returns:
- the component
-
getComponentPath
public int[] getComponentPath()Description copied from interface:DataGet the component path if this is a component. The component path is an array of integers that represent each index in the tree of data items. Top level data items have an empty array for their component path.- Specified by:
getComponentPathin interfaceData- Returns:
- the path
-
getNumComponents
public int getNumComponents()Description copied from interface:DataReturn the number of components that make up this data item. if this is an Array, return the number of elements in the array.- Specified by:
getNumComponentsin interfaceData- Returns:
- the number of components
-
getComponentAt
Description copied from interface:DataReturn the first immediate child component that contains the byte at the given offset. It is important to note that with certain datatypes there may be more than one component containing the specified offset (seeData.getComponentsContaining(int)).- Specified by:
getComponentAtin interfaceData- Parameters:
offset- the amount to add to this data items address to get the address of the requested data item.- Returns:
- first data component containing offset or null
-
getComponentContaining
Description copied from interface:DataReturn the first immediate child component that contains the byte at the given offset. It is important to note that with certain datatypes there may be more than one component containing the specified offset (seeData.getComponentsContaining(int)).- Specified by:
getComponentContainingin interfaceData- Parameters:
offset- the amount to add to this data items address to get the- Returns:
- first data component containing offset or null address of the requested data item.
-
getComponentsContaining
Description copied from interface:DataReturns a list of all the immediate child components that contain the byte at the given offset.For a union, this will return all the components (if the offset is 0). The presence of bit-fields or zero-length components may cause multiple components to be returned.
- Specified by:
getComponentsContainingin interfaceData- Parameters:
offset- the amount to add to this data items address to get the address of the requested data item.- Returns:
- a list of all the immediate child components that contain the byte at the given offset or null if offset is out of bounds.
-
getPrimitiveAt
Description copied from interface:DataReturns the primitive component containing this offset (i.e., one that does not have sub-components). This is useful for data items which are made up of multiple layers of other data items. This method immediately goes to the lowest level data item. If the minimum offset of a component is specified, the only first component containing the offset will be considered (e.g., 0-element array).- Specified by:
getPrimitiveAtin interfaceData- Parameters:
offset- the offset- Returns:
- primitive component containing this offset
-
getComponentIndex
public int getComponentIndex()Description copied from interface:DataGet the index of this component in its parent- Specified by:
getComponentIndexin interfaceData- Returns:
- -1 if this data item is not a component of another data item.
-
getComponentLevel
public int getComponentLevel()Description copied from interface:DataGet this data's component level in its hierarchy of components.- Specified by:
getComponentLevelin interfaceData- Returns:
- the level of this data item with 0 being the level of top data items.
-
getDefaultValueRepresentation
Description copied from interface:DataReturns a string that represents the data value without markup.- Specified by:
getDefaultValueRepresentationin interfaceData- Returns:
- the string
-
getDefaultLabelPrefix
Description copied from interface:DataReturns the appropriate string to use as the default label prefix or null if it has no preferred default label prefix;- Specified by:
getDefaultLabelPrefixin interfaceData- Parameters:
options- the options- Returns:
- the prefix
-