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
,java.util.EventListener
,javax.swing.event.ChangeListener
- Direct Known Subclasses:
BitmapResourceDataType
,CountedDynamicDataType
,DialogResourceDataType
,GroupIconResourceDataType
,IndexedDynamicDataType
,MenuResourceDataType
,MUIResourceDataType
,PERichTableDataType
,RepeatCountDataType
,RepeatedDynamicDataType
,RTTIDataType
,StructuredDynamicDataType
,WEVTResourceDataType
public abstract class DynamicDataType extends BuiltIn implements Dynamic
Interface for dataTypes that don't get applied, but instead generate dataTypes on the fly based on the data.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ghidra.util.classfinder.ExtensionPoint
ExtensionPoint.Exclude, ExtensionPoint.Util
-
-
Field Summary
-
Fields inherited from class ghidra.program.model.data.DataTypeImpl
defaultSettings
-
Fields inherited from class ghidra.program.model.data.AbstractDataType
categoryPath, dataMgr, name
-
Fields inherited from interface ghidra.program.model.data.DataType
CONFLICT_SUFFIX, DEFAULT, NO_LAST_CHANGE_TIME, NO_SOURCE_SYNC_TIME, VOID
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DynamicDataType(CategoryPath path, java.lang.String name)
protected
DynamicDataType(CategoryPath path, java.lang.String name, DataTypeManager dtm)
protected
DynamicDataType(java.lang.String name)
protected
DynamicDataType(java.lang.String name, DataTypeManager dtm)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canSpecifyLength()
Returns true if a user-specified length can be usedprotected abstract DataTypeComponent[]
getAllComponents(MemBuffer buf)
DataTypeComponent
getComponent(int index, MemBuffer buf)
Returns the immediate n'th component of this data type.DataTypeComponent
getComponentAt(int offset, MemBuffer buf)
Returns the component containing the byte at the given offsetDataTypeComponent[]
getComponents(MemBuffer buf)
Returns an array of DataTypes that make up this data type.int
getLength()
Get the length (number of 8-bit bytes) of this DataType.int
getLength(MemBuffer buf, int maxLength)
Compute the length for this data-type which corresponds to the specified memory location.int
getNumComponents(MemBuffer buf)
Gets the number of component data types in this data type.DataType
getReplacementBaseType()
Returns a suitable replacement base data-type for pointers and arrays when exporting to C codevoid
invalidateCache()
boolean
isDynamicallySized()
Indicates if this data-type is dynamically sized based upon DataOrganization.-
Methods 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, setName, setNameAndCategory
-
Methods inherited from class ghidra.program.model.data.DataTypeImpl
equals, getAlignment, getDefaultSettings, getLastChangeTimeInSourceArchive, getParents, getPathName, getSourceArchive, getValueClass, hashCode, notifyDeleted, notifyNameChanged, notifyReplaced, notifySizeChanged, replaceWith, setDefaultSettings, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setSourceArchive, stateChanged
-
Methods inherited from class ghidra.program.model.data.AbstractDataType
getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDisplayName, getDocs, getMnemonic, getName, isDeleted, isNotYetDefined, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ghidra.program.model.data.BuiltInDataType
getCTypeDeclaration
-
Methods inherited from interface ghidra.program.model.data.DataType
addParent, clone, copy, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, getAlignment, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDescription, getDisplayName, getDocs, getLastChangeTime, getLastChangeTimeInSourceArchive, getMnemonic, getName, getParents, getPathName, getRepresentation, getSettingsDefinitions, getSourceArchive, getUniversalID, getValue, getValueClass, isDeleted, isEquivalent, isNotYetDefined, removeParent, replaceWith, setCategoryPath, setDefaultSettings, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setName, setNameAndCategory, setSourceArchive
-
-
-
-
Constructor Detail
-
DynamicDataType
protected DynamicDataType(java.lang.String name)
-
DynamicDataType
protected DynamicDataType(java.lang.String name, DataTypeManager dtm)
-
DynamicDataType
protected DynamicDataType(CategoryPath path, java.lang.String name)
-
DynamicDataType
protected DynamicDataType(CategoryPath path, java.lang.String name, DataTypeManager dtm)
-
-
Method Detail
-
canSpecifyLength
public final boolean canSpecifyLength()
Description copied from interface:Dynamic
Returns true if a user-specified length can be used- Specified by:
canSpecifyLength
in interfaceDynamic
-
isDynamicallySized
public boolean isDynamicallySized()
Description copied from interface:DataType
Indicates if this data-type is dynamically sized based upon DataOrganization.- Specified by:
isDynamicallySized
in interfaceDataType
- Overrides:
isDynamicallySized
in classAbstractDataType
- See Also:
DataType.isDynamicallySized()
-
getNumComponents
public final int getNumComponents(MemBuffer buf)
Gets the number of component data types in this data type.- Parameters:
buf
- a membuffer to be used by dataTypes that change depending on their data context. A null value is acceptable to indicate that a memory context is not available. DataTypes that need a context will return -1 if the context is null.- 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.
-
getComponent
public final DataTypeComponent getComponent(int index, MemBuffer buf)
Returns the immediate n'th component of this data type.- Parameters:
index
- the components index (zero based).buf
- a membuffer to be used by dataTypes that change depending on their data context. A null value is acceptable to indicate that a memory context is not available. DataTypes that need a context will return -1 if the context is null.- Returns:
- the component data type or null if there is no component at the indicated index.
-
getComponents
public final DataTypeComponent[] getComponents(MemBuffer buf)
Returns an array of DataTypes that make up this data type. Could return null if there are no subcomponents. If this is an Array, then only one element will be returned which is the Data Prototype for the elements in the array. Will return null if this is a subcomponent that doesn't fit in it's alloted space.- Parameters:
buf
- a membuffer to be used by dataTypes that change depending on their data context. A null value is acceptable to indicate that a memory context is not available. DataTypes that need a context will return -1 if the context is null.
-
getComponentAt
public final DataTypeComponent getComponentAt(int offset, MemBuffer buf)
Returns the component containing the byte at the given offset- Parameters:
offset
- the offset into the dataTypebuf
- the memoryBuffer containing the bytes.- Returns:
- the component containing the byte at the given offset
-
getAllComponents
protected abstract DataTypeComponent[] getAllComponents(MemBuffer buf)
-
getLength
public final int getLength(MemBuffer buf, int maxLength)
Description copied from interface:Dynamic
Compute the length for this data-type which corresponds to the specified memory location.- Specified by:
getLength
in 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:DataType
Get the length (number of 8-bit bytes) of this DataType.
-
invalidateCache
public void invalidateCache()
-
getReplacementBaseType
public DataType getReplacementBaseType()
Description copied from interface:Dynamic
Returns a suitable replacement base data-type for pointers and arrays when exporting to C code- Specified by:
getReplacementBaseType
in interfaceDynamic
- Returns:
- suitable base data-type for this Dynamic data-type
-
-