Package ghidra.program.model.listing
Interface Data
- All Superinterfaces:
- CodeUnit,- MemBuffer,- PropertySet,- Settings
- All Known Implementing Classes:
- DataStub,- PseudoData
Interface for interacting with data at an address in a program.
- 
Field SummaryFields inherited from interface ghidra.program.model.listing.CodeUnitCOMMENT_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.SettingsEMPTY_STRING_ARRAY
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddValueReference(Address refAddr, RefType type) Add a memory reference to the value.If the dataType is a typeDef, then the typeDef's base type is returned, otherwise, the datatType is returned.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) Deprecated, for removal: This API element is subject to removal in a future version.method name has been changed to better reflect behavior.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 a string that represents the data value without markup.Get the field name of this data item if it is "inside" another data item, otherwise return null.intReturn the number of components that make up this data item.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.getPrimitiveAt(int offset) Returns the primitive component containing this offset (i.e., one that does not have sub-components).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.getValue()Returns the value of the data item.Class<?> Get the class used to express the value of this data.Get the references for the value.booleanReturns true if this data corresponds to string data.booleanisArray()Returns true if this data item is an Array of DataTypesbooleanDetermine 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.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.voidremoveValueReference(Address refAddr) Remove a reference to the value.Methods inherited from interface ghidra.program.model.listing.CodeUnitaddMnemonicReference, addOperandReference, compareTo, contains, getAddress, getAddressString, getBytes, getBytesInCodeUnit, getComment, getComment, getCommentAsArray, getCommentAsArray, getExternalReference, getLabel, getLength, getMaxAddress, getMinAddress, getMnemonicReferences, getMnemonicString, getNumOperands, getOperandReferences, getPrimaryReference, getPrimarySymbol, getProgram, getReferenceIteratorTo, getReferencesFrom, getScalar, getSymbols, removeExternalReference, removeMnemonicReference, removeOperandReference, setComment, setComment, setCommentAsArray, setCommentAsArray, setPrimaryMemoryReference, setRegisterReference, setStackReferenceMethods inherited from interface ghidra.program.model.mem.MemBuffergetAddress, getBigInteger, getByte, getBytes, getInputStream, getInputStream, getInt, getLong, getMemory, getShort, getUnsignedByte, getUnsignedInt, getUnsignedShort, getVarLengthInt, getVarLengthUnsignedInt, isBigEndian, isInitializedMemoryMethods inherited from interface ghidra.program.model.util.PropertySetgetIntProperty, getObjectProperty, getStringProperty, getVoidProperty, hasProperty, propertyNames, removeProperty, setProperty, setProperty, setProperty, setPropertyMethods inherited from interface ghidra.docking.settings.SettingsclearAllSettings, clearSetting, getDefaultSettings, getLong, getNames, getString, getSuggestedValues, getValue, isChangeAllowed, isEmpty, setLong, setString, setValue
- 
Method Details- 
getValueObject getValue()Returns the value of the data item. The value may be an address, a scalar, register or null if no value.- Returns:
- the value
 
- 
getValueClassClass<?> 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.
 
- 
hasStringValueboolean 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.
 
- 
isConstantboolean isConstant()Determine 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.- Returns:
- true if data is constant, else false.
 
- 
isWritableboolean isWritable()Determine 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.- Returns:
- true if data is writable, else false.
 
- 
isVolatileboolean isVolatile()Determine 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.- Returns:
- true if data is volatile, else false.
 
- 
isDefinedboolean 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.- Returns:
- true if is defined
 
- 
getDataTypeDataType getDataType()Get the Data type for the data.- Returns:
- the data type
 
- 
getBaseDataTypeDataType getBaseDataType()If the dataType is a typeDef, then the typeDef's base type is returned, otherwise, the datatType is returned.- Returns:
- the data type
 
- 
getValueReferencesReference[] getValueReferences()Get the references for the value.- Returns:
- the references
 
- 
addValueReferenceAdd a memory reference to the value.- Parameters:
- refAddr- address referenced.
- type- the type of reference to be added.
 
- 
removeValueReferenceRemove a reference to the value.- Parameters:
- refAddr- address of reference to be removed.
 
- 
getFieldNameString 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.
 
- 
getPathNameString getPathName()Returns the full path name (dot notation) for this field. This includes the symbol name at this address.- Returns:
- the path name
 
- 
getComponentPathNameString getComponentPathName()Returns the component path name (dot notation) for this field- Returns:
- the component path name
 
- 
isPointerboolean isPointer()Returns true if this is a pointer, which implies getValue() will return an Object that is an Address.- Returns:
- true if a pointer
 
- 
isUnionboolean isUnion()Returns true if this data item is a Union.- Returns:
- true if a union
 
- 
isStructureboolean isStructure()Returns true if this data item is a Structure.- Returns:
- true if a structure
 
- 
isArrayboolean isArray()Returns true if this data item is an Array of DataTypes- Returns:
- true if an array
 
- 
isDynamicboolean isDynamic()Returns true if this data item is a dynamic DataType.- Returns:
- true if is dynamic
 
- 
getParentData getParent()Get the immediate parent data item of this data item or null if this data item is not contained in another data item.- Returns:
- the data
 
- 
getRootData getRoot()Get the highest level Data item in a hierarchy of structures containing this component.- Returns:
- the data
 
- 
getRootOffsetint getRootOffset()Get the offset of this Data item from the start of the root data item of some hierarchy of structures.- Returns:
- the offset
 
- 
getParentOffsetint getParentOffset()Get the offset of this Data item from the start of its immediate parent.- Returns:
- the offset
 
- 
getComponentReturns the immediate n'th component or null if none exists.- Parameters:
- index- the index of the component to get.
- Returns:
- the component
 
- 
getComponentGet 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.
- Returns:
- the component
 
- 
getComponentPathint[] 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 their component path.- Returns:
- the path
 
- 
getNumComponentsint 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.- Returns:
- the number of components
 
- 
getComponentAtDeprecated, for removal: This API element is subject to removal in a future version.method name has been changed to better reflect behavior. The methodgetComponentContaining(int)should be used instead.Return 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 (seegetComponentsContaining(int)).- 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
 
- 
getComponentContainingReturn 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 (seegetComponentsContaining(int)).- 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.
 
- 
getComponentsContainingReturns 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. - 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.
 
- 
getPrimitiveAtReturns 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).- Parameters:
- offset- the offset
- Returns:
- primitive component containing this offset
 
- 
getComponentIndexint getComponentIndex()Get the index of this component in its parent- Returns:
- -1 if this data item is not a component of another data item.
 
- 
getComponentLevelint 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.
 
- 
getDefaultValueRepresentationString getDefaultValueRepresentation()Returns a string that represents the data value without markup.- Returns:
- the string
 
- 
getDefaultLabelPrefixReturns the appropriate string to use as the default label prefix or null if it has no preferred default label prefix;- Parameters:
- options- the options
- Returns:
- the prefix
 
 
-