Package ghidra.program.model.listing
Interface Data
-
-
Field Summary
-
Fields inherited from interface ghidra.program.model.listing.CodeUnit
COMMENT_PROPERTY, DEFINED_DATA_PROPERTY, EOL_COMMENT, INSTRUCTION_PROPERTY, MNEMONIC, NO_COMMENT, PLATE_COMMENT, POST_COMMENT, PRE_COMMENT, REPEATABLE_COMMENT, SPACE_PROPERTY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addValueReference(Address refAddr, RefType type)
Add a memory reference to the value.DataType
getBaseDataType()
If the dataType is a typeDef, then the typeDef's base type is returned, otherwise, the datatType is returned.Data
getComponent(int index)
Returns the immediate n'th component or null if none exists.Data
getComponent(int[] componentPath)
Get a data item given the index path.Data
getComponentAt(int offset)
Return the immediate child component that contains the byte at the given offset.int
getComponentIndex()
Get the index of this component in its parentint
getComponentLevel()
Get this data's component level in its hierarchy of components.int[]
getComponentPath()
Get the component path if this is a component.java.lang.String
getComponentPathName()
Returns the component path name (dot notation) for this fieldjava.util.List<Data>
getComponentsContaining(int offset)
Returns a list of all the immediate child components that contain the byte at the given offset.DataType
getDataType()
Get the Data type for the data.java.lang.String
getDefaultLabelPrefix(DataTypeDisplayOptions options)
Returns the appropriate string to use as the default label prefix or null if it has no prefered default label prefix;java.lang.String
getDefaultValueRepresentation()
Returns a string that represents the data value without markup.java.lang.String
getFieldName()
Get the field name of this data item if it is "inside" another data item, otherwise return null.int
getNumComponents()
Return the number of components that make up this data item.Data
getParent()
Get the immediate parent data item of this data item or null if this data item is not contained in another data item.int
getParentOffset()
Get the offset of this Data item from the start of its immediate parent.java.lang.String
getPathName()
Returns the full path name (dot notation) for this field.Data
getPrimitiveAt(int offset)
Returns the primitive component that is at this offset.Data
getRoot()
Get the highest level Data item in a hierarchy of structures containing this component.int
getRootOffset()
Get the offset of this Data item from the start of the root data item of some hierarchy of structures.java.lang.Object
getValue()
Returns the value of the data item.java.lang.Class<?>
getValueClass()
Get the class used to express the value of this data.Reference[]
getValueReferences()
Get the references for the value.boolean
hasStringValue()
Returns true if this data corresponds to string data.boolean
isArray()
Returns true if this data item is an Array of DataTypesboolean
isConstant()
boolean
isDefined()
Returns true if the data type is defined.boolean
isDynamic()
Returns true if this data item is a dynamic DataType.boolean
isPointer()
Returns true if this is a pointer, implies getValue() will will return an Object that is an Address.boolean
isStructure()
Returns true if this data item is a Structure.boolean
isUnion()
Returns true if this data item is a Union.boolean
isVolatile()
void
removeValueReference(Address refAddr)
Remove a reference to the value.-
Methods inherited from interface ghidra.program.model.listing.CodeUnit
addMnemonicReference, addOperandReference, compareTo, contains, getAddress, getAddressString, getBytes, getBytesInCodeUnit, getComment, getCommentAsArray, getExternalReference, getIntProperty, getLabel, getLength, getMaxAddress, getMinAddress, getMnemonicReferences, getMnemonicString, getNumOperands, getObjectProperty, getOperandReferences, getPrimaryReference, getPrimarySymbol, getProgram, getReferenceIteratorTo, getReferencesFrom, getScalar, getStringProperty, getSymbols, getVoidProperty, hasProperty, isSuccessor, propertyNames, removeExternalReference, removeMnemonicReference, removeOperandReference, removeProperty, setComment, setCommentAsArray, setPrimaryMemoryReference, setProperty, setProperty, setProperty, setProperty, setRegisterReference, setStackReference, visitProperty
-
Methods inherited from interface ghidra.program.model.mem.MemBuffer
getAddress, getBigInteger, getByte, getBytes, getInt, getLong, getMemory, getShort, getUnsignedByte, getUnsignedInt, getUnsignedShort, getVarLengthInt, getVarLengthUnsignedInt, isBigEndian, isInitializedMemory
-
Methods inherited from interface ghidra.docking.settings.Settings
clearAllSettings, clearSetting, getByteArray, getDefaultSettings, getLong, getNames, getString, getValue, isEmpty, setByteArray, setLong, setString, setValue
-
-
-
-
Method Detail
-
getValue
java.lang.Object getValue()
Returns the value of the data item. The value may be an address, a scalar, register or null if no value.
-
getValueClass
java.lang.Class<?> getValueClass()
Get 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.- Returns:
- value class or null if a consistent class is not utilized.
-
hasStringValue
boolean hasStringValue()
Returns true if this data corresponds to string data. This is determined by the corresponding data type producing a String value.- Returns:
- true if this data returns a String value and can be treated as string data.
-
isConstant
boolean isConstant()
- Returns:
- true if data is constant. If true, isConstant will always be false
-
isVolatile
boolean isVolatile()
- Returns:
- true if data is volatile. If true, isVolatile will always be false
-
isDefined
boolean isDefined()
Returns 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
DataType getDataType()
Get the Data type for the data.
-
getBaseDataType
DataType getBaseDataType()
If the dataType is a typeDef, then the typeDef's base type is returned, otherwise, the datatType is returned.
-
getValueReferences
Reference[] getValueReferences()
Get the references for the value.
-
addValueReference
void addValueReference(Address refAddr, RefType type)
Add a memory reference to the value.- Parameters:
refAddr
- address referenced.type
- the type of reference to be added.
-
removeValueReference
void removeValueReference(Address refAddr)
Remove a reference to the value.- Parameters:
refAddr
- address of reference to be removed.
-
getFieldName
java.lang.String getFieldName()
Get the field name of this data item if it is "inside" another data item, otherwise return null.- 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
java.lang.String getPathName()
Returns the full path name (dot notation) for this field. This includes the symbol name at this address.
-
getComponentPathName
java.lang.String getComponentPathName()
Returns the component path name (dot notation) for this field
-
isPointer
boolean isPointer()
Returns true if this is a pointer, implies getValue() will will return an Object that is an Address.
-
isUnion
boolean isUnion()
Returns true if this data item is a Union.
-
isStructure
boolean isStructure()
Returns true if this data item is a Structure.
-
isArray
boolean isArray()
Returns true if this data item is an Array of DataTypes
-
isDynamic
boolean isDynamic()
Returns true if this data item is a dynamic DataType.
-
getParent
Data getParent()
Get the immediate parent data item of this data item or null if this data item is not contained in another data item.
-
getRoot
Data getRoot()
Get the highest level Data item in a hierarchy of structures containing this component.
-
getRootOffset
int getRootOffset()
Get the offset of this Data item from the start of the root data item of some hierarchy of structures.
-
getParentOffset
int getParentOffset()
Get the offset of this Data item from the start of its immediate parent.
-
getComponent
Data getComponent(int index)
Returns the immediate n'th component or null if none exists.- Parameters:
index
- the index of the component to get.
-
getComponent
Data getComponent(int[] componentPath)
Get a data item given the index path. Each integer in the array represents an index into the data item at that level.- Parameters:
componentPath
- the array of indexes to use to find the requested data item.
-
getComponentPath
int[] getComponentPath()
Get 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 thier component path.
-
getNumComponents
int getNumComponents()
Return the number of components that make up this data item. if this is an Array, return the number of elements in the array.
-
getComponentAt
Data getComponentAt(int offset)
Return the immediate child component that contains the byte at the given offset.- Parameters:
offset
- the amount to add to this data items address to get the address of the requested data item.
-
getComponentsContaining
java.util.List<Data> getComponentsContaining(int offset)
Returns 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). For a structure, this will be either a single non bit field element or a list of bit field elements.
- 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.
-
getPrimitiveAt
Data getPrimitiveAt(int offset)
Returns the primitive component that is at this offset. This is useful for data items are made up of multiple layers of other data items. This method immediately goes to the lowest level data item.
-
getComponentIndex
int getComponentIndex()
Get the index of this component in its parent- Returns:
- -1 if this data item is not a component of another data item.
-
getComponentLevel
int getComponentLevel()
Get this data's component level in its hierarchy of components.- Returns:
- the level of this data item with 0 being the level of top data items.
-
getDefaultValueRepresentation
java.lang.String getDefaultValueRepresentation()
Returns a string that represents the data value without markup.
-
getDefaultLabelPrefix
java.lang.String getDefaultLabelPrefix(DataTypeDisplayOptions options)
Returns the appropriate string to use as the default label prefix or null if it has no prefered default label prefix;- Parameters:
options
-
-
-