Package ghidra.program.model.data
Class DynamicDataType
java.lang.Object
ghidra.program.model.data.AbstractDataType
ghidra.program.model.data.DataTypeImpl
ghidra.program.model.data.BuiltIn
ghidra.program.model.data.DynamicDataType
- All Implemented Interfaces:
BuiltInDataType,DataType,Dynamic,ExtensionPoint
- Direct Known Subclasses:
AndroidElfRelocationTableDataType,BitmapResourceDataType,CountedDynamicDataType,DialogResourceDataType,GroupIconResourceDataType,IndexedDynamicDataType,MenuResourceDataType,MUIResourceDataType,PERichTableDataType,PEx64UnwindInfoDataType,RepeatCountDataType,RepeatedDynamicDataType,RTTIDataType,StructuredDynamicDataType,WEVTResourceDataType
Interface for dataTypes that don't get applied, but instead generate dataTypes
on the fly based on the data.
-
Field Summary
Fields inherited from class ghidra.program.model.data.DataTypeImpl
defaultSettingsFields inherited from class ghidra.program.model.data.AbstractDataType
categoryPath, dataMgr, nameFields inherited from interface ghidra.program.model.data.DataType
CONFLICT_SUFFIX, DEFAULT, NO_LAST_CHANGE_TIME, NO_SOURCE_SYNC_TIME, TYPEDEF_ATTRIBUTE_PREFIX, TYPEDEF_ATTRIBUTE_SUFFIX, VOID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDynamicDataType(CategoryPath path, String name) protectedDynamicDataType(CategoryPath path, String name, DataTypeManager dtm) protectedDynamicDataType(String name) protectedDynamicDataType(String name, DataTypeManager dtm) -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanDetermine if the length may be specified for an instanceof this datatype (e.g.,Data,Array,DataTypeComponent, etc.).protected abstract DataTypeComponent[]Get all dynamic components associated with the specified MemBufferfinal DataTypeComponentgetComponent(int ordinal, MemBuffer buf) Returns the immediate n'th component of this data type.final DataTypeComponentgetComponentAt(int offset, MemBuffer buf) Returns the first component containing the byte at the given offset.final DataTypeComponent[]getComponents(MemBuffer buf) Returns an array of components that make up this data type.protected DataTypeComponent[]intGet the length (number of 8-bit bytes) of this DataType.final intCompute the length for this data-type which corresponds to the specified memory location.final intGets the number of component data types in this data type.Returns a suitable replacement base data-type for pointers and arrays when exporting to C codevoidMethods inherited from class ghidra.program.model.data.BuiltIn
addParent, copy, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, getBuiltInSettingsDefinitions, getCTypeDeclaration, getCTypeDeclaration, getCTypeDeclaration, getCTypeDeclaration, getDecompilerDisplayName, getLastChangeTime, getSettingsDefinitions, getUniversalID, isEquivalent, removeParent, setCategoryPath, setDefaultSettings, setName, setNameAndCategoryMethods inherited from class ghidra.program.model.data.DataTypeImpl
equals, getAlignment, getDefaultSettings, getLastChangeTimeInSourceArchive, getParents, getPathName, getSourceArchive, getValueClass, hashCode, notifyAlignmentChanged, notifyDeleted, notifyNameChanged, notifyParents, notifyReplaced, notifySizeChanged, replaceWith, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setSourceArchiveMethods inherited from class ghidra.program.model.data.AbstractDataType
dataTypeAlignmentChanged, encodeRepresentation, encodeValue, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDisplayName, getDocs, getMnemonic, getName, getTypeDefSettingsDefinitions, hasLanguageDependantLength, isDeleted, isEncodable, isNotYetDefined, isZeroLength, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ghidra.program.model.data.BuiltInDataType
getCTypeDeclaration, setDefaultSettingsMethods inherited from interface ghidra.program.model.data.DataType
addParent, clone, copy, dataTypeAlignmentChanged, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, encodeRepresentation, encodeValue, getAlignment, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDescription, getDisplayName, getDocs, getLastChangeTime, getLastChangeTimeInSourceArchive, getMnemonic, getName, getParents, getPathName, getRepresentation, getSettingsDefinitions, getSourceArchive, getTypeDefSettingsDefinitions, getUniversalID, getValue, getValueClass, hasLanguageDependantLength, isDeleted, isEncodable, isEquivalent, isNotYetDefined, isZeroLength, removeParent, replaceWith, setCategoryPath, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setName, setNameAndCategory, setSourceArchive
-
Constructor Details
-
DynamicDataType
-
DynamicDataType
-
DynamicDataType
-
DynamicDataType
-
-
Method Details
-
canSpecifyLength
public final boolean canSpecifyLength()Description copied from interface:DynamicDetermine if the length may be specified for an instanceof this datatype (e.g.,Data,Array,DataTypeComponent, etc.).- Specified by:
canSpecifyLengthin interfaceDynamic- Returns:
- true if a user-specified length can be used, else false
-
getNumComponents
Gets the number of component data types in this data type.- Parameters:
buf- a memory buffer to be used by dataTypes that change depending on their data context.- Returns:
- the number of components that make up this data prototype - if this is an Array, return the number of elements in the array. - if this datatype is a subcomponent of another datatype and it won't fit in it's defined space, return -1.
-
getComps
-
getComponent
Returns the immediate n'th component of this data type.- Parameters:
ordinal- the components ordinal (zero based).buf- a memory buffer to be used by dataTypes that change depending on their data context.- Returns:
- the component data type or null if there is no component at the indicated index.
- Throws:
ArrayIndexOutOfBoundsException- if index is out of bounds
-
getComponents
Returns an array of components that make up this data type. Could return null if there are no subcomponents.- Parameters:
buf- a memory buffer to be used by dataTypes that change depending on their data context.- Returns:
- datatype component array or null.
-
getComponentAt
Returns the first component containing the byte at the given offset. It is possible with zero-length components (seeDataType.isZeroLength()) and bitfields (see @DataTypeComponent#isBitFieldComponent()} for multiple components to share the same offset.- Parameters:
offset- the offset into the dataTypebuf- the memory buffer containing the bytes.- Returns:
- the first component containing the byte at the given offset or null if no component defined. A zero-length component may be returned.
-
getAllComponents
Get all dynamic components associated with the specified MemBuffer- Parameters:
buf- memory buffer positioned at start of data type instance- Returns:
- all components or null if memory data is not valid for this data type.
-
getLength
Description copied from interface:DynamicCompute the length for this data-type which corresponds to the specified memory location.- Specified by:
getLengthin interfaceDynamic- Parameters:
buf- memory locationmaxLength- maximum number of bytes to consume in computing length, or -1 for unspecified.- Returns:
- data length or -1 if it could not be determined. Returned length may exceed maxLength if data-type does not supported constrained lengths.
-
getLength
public int getLength()Description copied from interface:DataTypeGet the length (number of 8-bit bytes) of this DataType.NOTE: No datatype should ever return 0, even if
DataType.isZeroLength(), and onlyDynamicdatatypes should return -1. IfDataType.isZeroLength()is true a length of 1 should be returned. Where a zero-length datatype can be handled (e.g.,Composite) theDataType.isZeroLength()method should be used. -
invalidateCache
public void invalidateCache() -
getReplacementBaseType
Description copied from interface:DynamicReturns a suitable replacement base data-type for pointers and arrays when exporting to C code- Specified by:
getReplacementBaseTypein interfaceDynamic- Returns:
- suitable base data-type for this Dynamic data-type
-