Class DefaultDataType
- All Implemented Interfaces:
DataType
-
Field Summary
Modifier and TypeFieldDescriptionstatic DefaultDataType
A statically defined DefaultDataType used when an Undefined byte is needed.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, TYPEDEF_ATTRIBUTE_PREFIX, TYPEDEF_ATTRIBUTE_SUFFIX, VOID
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Inform this data type that it has the given parent
TODO: This method is reserved for internal DB use.clone
(DataTypeManager dtm) Returns an instance of this DataType using the specifiedDataTypeManager
to allow its use of the correspondingDataOrganization
while retaining its unique identity (seeDataType.getUniversalID()
and archive association (seeDataType.getSourceArchive()
) if applicable.copy
(DataTypeManager dtm) Returns a new instance (shallow copy) of this DataType with a new identity and no source archive association.void
Informs this datatype that the given datatype has been deleted.void
dataTypeNameChanged
(DataType dt, String oldName) Informs this datatype that its name has changed from the indicated old name.void
dataTypeReplaced
(DataType oldDt, DataType newDt) Informs this datatype that the given oldDT has been replaced with newDTvoid
Notification that the given datatype's size has changed.boolean
Check if this datatype depends on the existence of the given datatype.Get a String briefly describing this DataType.long
Get the timestamp corresponding to the last time this type was changed within its datatype managerint
Get the length of this DataType as a number of 8-bit bytes.getMnemonic
(Settings settings) Get the mnemonic for this DataType.getRepresentation
(MemBuffer buf, Settings settings, int length) Get bytes from memory in a printable format for this type.Get the Undefined byte as a Scalar.boolean
isEquivalent
(DataType dt) Check if the given datatype is equivalent to this datatype.void
removeParent
(DataType dt) Remove a parent datatypevoid
setCategoryPath
(CategoryPath path) Set the categoryPath associated with this datatypevoid
Sets the name of the datatypevoid
setNameAndCategory
(CategoryPath path, String name) Sets the name and category of a datatype at the same time.Methods inherited from class ghidra.program.model.data.DataTypeImpl
equals, getAlignedLength, getAlignment, getDefaultSettings, getLastChangeTimeInSourceArchive, getParents, getPathName, getSettingsDefinitions, getSourceArchive, getUniversalID, getValueClass, hashCode, notifyAlignmentChanged, notifyDeleted, notifyNameChanged, notifyParents, notifyReplaced, notifySizeChanged, replaceWith, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setSourceArchive
Methods inherited from class ghidra.program.model.data.AbstractDataType
dataTypeAlignmentChanged, encodeRepresentation, encodeValue, getCategoryPath, getDataOrganization, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDisplayName, getDocs, getName, getTypeDefSettingsDefinitions, hasLanguageDependantLength, isDeleted, isEncodable, isNotYetDefined, isZeroLength, toString
-
Field Details
-
dataType
A statically defined DefaultDataType used when an Undefined byte is needed.
-
-
Method Details
-
getMnemonic
Description copied from interface:DataType
Get the mnemonic for this DataType.- Specified by:
getMnemonic
in interfaceDataType
- Overrides:
getMnemonic
in classAbstractDataType
- Parameters:
settings
- settings which may influence the result or null- Returns:
- the mnemonic for this DataType.
- See Also:
-
getLength
public int getLength()Description copied from interface:DataType
Get the length of this DataType as a number of 8-bit bytes.For primitive datatypes this reflects the smallest varnode which can be used to contain its value (i.e., raw data length).
Example: For x86 32-bit gcc an 80-bit
long double
raw data length
of 10-bytes will fit within a floating point register while itsaligned-length
of 12-bytes is used by the gcc compiler for data/array/component allocations to maintain alignment (i.e.,sizeof(long double)
).NOTE: Other than the
VoidDataType
, no datatype should ever return 0, even ifDataType.isZeroLength()
, and onlyDynamic
/FactoryDataType
datatypes 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.- Returns:
- the length of this DataType
- See Also:
-
getDescription
Description copied from interface:DataType
Get a String briefly describing this DataType.- Returns:
- a one-liner describing this DataType.
- See Also:
-
getRepresentation
Description copied from interface:DataType
Get bytes from memory in a printable format for this type.- Parameters:
buf
- the data.settings
- the settings to use for the representation.length
- the number of bytes to represent.- Returns:
- the representation of the data in this format, never null.
- See Also:
-
getValue
Get the Undefined byte as a Scalar.- Parameters:
buf
- the data buffer.settings
- the display settings to use.length
- the number of bytes to get the value from.- Returns:
- the data Object.
-
clone
Description copied from interface:DataType
Returns an instance of this DataType using the specifiedDataTypeManager
to allow its use of the correspondingDataOrganization
while retaining its unique identity (seeDataType.getUniversalID()
and archive association (seeDataType.getSourceArchive()
) if applicable.This instance will be returned if this datatype's DataTypeManager matches the specified dtm. The recursion depth of a clone will stop on any datatype whose
DataTypeManager
matches the specified dtm and simply use the existing datatype instance.NOTE: In general, this method should not be used to obtain an instance to be modified. In most cases changes may be made directly to this instance if supported or to a
DataType.copy(DataTypeManager)
of this type.- Parameters:
dtm
- the data-type manager instance whose data-organization should apply.- Returns:
- cloned instance which may be the same as this instance
-
copy
Description copied from interface:DataType
Returns a new instance (shallow copy) of this DataType with a new identity and no source archive association.Any reference to other datatypes will use
DataType.clone(DataTypeManager)
.- Parameters:
dtm
- the data-type manager instance whose data-organization should apply.- Returns:
- new instanceof of this datatype
-
dataTypeSizeChanged
Description copied from interface:DataType
Notification that the given datatype's size has changed.DataTypes may need to make internal changes in response.
TODO: This method is reserved for internal DB use.- Specified by:
dataTypeSizeChanged
in interfaceDataType
- Overrides:
dataTypeSizeChanged
in classAbstractDataType
- Parameters:
dt
- the datatype that has changed.- See Also:
-
isEquivalent
Description copied from interface:DataType
Check if the given datatype is equivalent to this datatype.The precise meaning of "equivalent" is datatype dependent.
NOTE: if invoked by a DB object or manager it should be invoked on the DataTypeDB object passing the other datatype as the argument.- Parameters:
dt
- the datatype being tested for equivalence.- Returns:
- true if the if the given datatype is equivalent to this datatype.
- See Also:
-
setCategoryPath
Description copied from interface:DataType
Set the categoryPath associated with this datatype- Specified by:
setCategoryPath
in interfaceDataType
- Overrides:
setCategoryPath
in classAbstractDataType
- Parameters:
path
- the new path- Throws:
DuplicateNameException
- if an attempt to place this datatype into the specified category resulted in a name collision. This should not occur for non-DB DataType instances.- See Also:
-
setName
Description copied from interface:DataType
Sets the name of the datatype- Specified by:
setName
in interfaceDataType
- Overrides:
setName
in classAbstractDataType
- Parameters:
name
- the new name for this datatype.- See Also:
-
setNameAndCategory
public void setNameAndCategory(CategoryPath path, String name) throws InvalidNameException, DuplicateNameException Description copied from interface:DataType
Sets the name and category of a datatype at the same time.- Specified by:
setNameAndCategory
in interfaceDataType
- Overrides:
setNameAndCategory
in classAbstractDataType
- Parameters:
path
- the new category path.name
- the new name- Throws:
InvalidNameException
- if the name is invalidDuplicateNameException
- if name change on storedDataType
is a duplicate of another datatype within the same category (only applies to DB storedDataType
).- See Also:
-
dataTypeDeleted
Description copied from interface:DataType
Informs this datatype that the given datatype has been deleted.TODO: This method is reserved for internal DB use.
- Specified by:
dataTypeDeleted
in interfaceDataType
- Overrides:
dataTypeDeleted
in classAbstractDataType
- Parameters:
dt
- the datatype that has been deleted.- See Also:
-
dataTypeNameChanged
Description copied from interface:DataType
Informs this datatype that its name has changed from the indicated old name.TODO: This method is reserved for internal DB use.
- Specified by:
dataTypeNameChanged
in interfaceDataType
- Overrides:
dataTypeNameChanged
in classAbstractDataType
- Parameters:
dt
- the datatype whose name changedoldName
- the datatype's old name- See Also:
-
dataTypeReplaced
Description copied from interface:DataType
Informs this datatype that the given oldDT has been replaced with newDTTODO: This method is reserved for internal DB use.
- Specified by:
dataTypeReplaced
in interfaceDataType
- Overrides:
dataTypeReplaced
in classAbstractDataType
- Parameters:
oldDt
- old datatypenewDt
- new datatype- See Also:
-
dependsOn
Description copied from interface:DataType
Check if this datatype depends on the existence of the given datatype.For example byte[] depends on byte. If byte were deleted, then byte[] would also be deleted.
- Specified by:
dependsOn
in interfaceDataType
- Overrides:
dependsOn
in classAbstractDataType
- Parameters:
dt
- the datatype to test that this datatype depends on.- Returns:
- true if the existence of this datatype relies on the existence of the specified datatype dt.
- See Also:
-
addParent
Description copied from interface:DataType
Inform this data type that it has the given parent
TODO: This method is reserved for internal DB use.- Specified by:
addParent
in interfaceDataType
- Overrides:
addParent
in classDataTypeImpl
- Parameters:
dt
- parent data type- See Also:
-
removeParent
Description copied from interface:DataType
Remove a parent datatypeTODO: This method is reserved for internal DB use.
- Specified by:
removeParent
in interfaceDataType
- Overrides:
removeParent
in classDataTypeImpl
- Parameters:
dt
- parent datatype- See Also:
-
getLastChangeTime
public long getLastChangeTime()Description copied from interface:DataType
Get the timestamp corresponding to the last time this type was changed within its datatype manager- Specified by:
getLastChangeTime
in interfaceDataType
- Overrides:
getLastChangeTime
in classDataTypeImpl
- Returns:
- timestamp of last change within datatype manager
-