Package ghidra.program.model.data
Class MissingBuiltInDataType
- java.lang.Object
-
- ghidra.program.model.data.DataTypeImpl
-
- ghidra.program.model.data.MissingBuiltInDataType
-
- All Implemented Interfaces:
BuiltInDataType,DataType,Dynamic,ExtensionPoint,java.io.Serializable,java.util.EventListener,javax.swing.event.ChangeListener
public class MissingBuiltInDataType extends DataTypeImpl implements Dynamic
Provides an implementation of a data type that stands-in for a missing Built-In data type.This field is not meant to be loaded by the
ClassSearcher, hence the X in the name.- See Also:
- Serialized Form
-
-
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
categoryPath, defaultSettings, 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 Constructor Description MissingBuiltInDataType(CategoryPath path, java.lang.String missingBuiltInName, java.lang.String missingBuiltInClassPath, DataTypeManager dtm)Construct a Missing Data Type
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanSpecifyLength()Returns true if a user-specified length can be usedDataTypeclone(DataTypeManager dtm)Returns a new instance of this DataType with its universalID and SourceArchive identity retained.DataTypecopy(DataTypeManager dtm)Returns a new instance of this DataType with a new identity.voiddataTypeDeleted(DataType dt)Informs this dataType that the given dataType has been deleted.voiddataTypeNameChanged(DataType dt, java.lang.String oldName)Informs this data type that its name has changed from the indicated old name.voiddataTypeReplaced(DataType oldDt, DataType newDt)Informs this data type that the given oldDT has been replaced with newDT
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!voiddataTypeSizeChanged(DataType dt)Notification that the given dataType's size has changed.booleandependsOn(DataType dt)Returns true if this dataType depends on the existence of the given dataType.java.lang.StringgetCTypeDeclaration(DataOrganization dataOrganization)Generate a suitable C-type declaration for this data-type as a #define or typedef.java.lang.StringgetDescription()Get a String briefly describing this DataType.longgetLastChangeTime()Get the timestamp corresponding to the last time this type was changed within its data type managerintgetLength()Get the length (number of 8-bit bytes) of this DataType.intgetLength(MemBuffer buf, int maxLength)Compute the length for this data-type which corresponds to the specified memory location.java.lang.StringgetMissingBuiltInClassPath()Returns classpath of missing built-in datatype for which this type is standing-in forjava.lang.StringgetMissingBuiltInName()Returns name of missing built-in datatype for which this type is standing-in forjava.lang.StringgetMnemonic(Settings settings)Get the mnemonic for this DataType.DataTypegetReplacementBaseType()Returns a suitable replacement base data-type for pointers and arrays when exporting to C codejava.lang.StringgetRepresentation(MemBuffer buf, Settings settings, int length)Get bytes from memory in a printable format for this type.java.lang.ObjectgetValue(MemBuffer buf, Settings settings, int length)Get the data in the form of the appropriate Object for this DataType.booleanisDynamicallySized()Indicates if this data-type is dynamically sized based upon DataOrganization.booleanisEquivalent(DataType dt)Returns true if the given dataType is equivalent to this dataType.protected voidsetCategory()set the category for this data typevoidsetCategoryPath(CategoryPath path)voidsetName(java.lang.String name)Sets the name of the dataTypevoidsetNameAndCategory(CategoryPath path, java.lang.String name)Sets the name and category of a dataType at the same time.-
Methods inherited from class ghidra.program.model.data.DataTypeImpl
addParent, equals, getAlignment, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDisplayName, getDocs, getLastChangeTimeInSourceArchive, getName, getParents, getPathName, getSettingsDefinitions, getSourceArchive, getUniversalID, getValueClass, hashCode, isDeleted, isNotYetDefined, notifyDeleted, notifyNameChanged, notifyReplaced, notifySizeChanged, removeParent, replaceWith, setDefaultSettings, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setSourceArchive, stateChanged, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ghidra.program.model.data.DataType
addParent, getAlignment, getCategoryPath, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDisplayName, getDocs, getLastChangeTimeInSourceArchive, getName, getParents, getPathName, getSettingsDefinitions, getSourceArchive, getUniversalID, getValueClass, isDeleted, isNotYetDefined, removeParent, replaceWith, setDefaultSettings, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setSourceArchive
-
-
-
-
Constructor Detail
-
MissingBuiltInDataType
public MissingBuiltInDataType(CategoryPath path, java.lang.String missingBuiltInName, java.lang.String missingBuiltInClassPath, DataTypeManager dtm)
Construct a Missing Data Type- Parameters:
path- category pathmissingBuiltInName- name of missing built-in datatype for which this will standin for.missingBuiltInClassPath- classpath of missing built-in datatype for which this will standin for.
-
-
Method Detail
-
setCategory
protected void setCategory()
set the category for this data type
-
getMissingBuiltInName
public java.lang.String getMissingBuiltInName()
Returns name of missing built-in datatype for which this type is standing-in for
-
getMissingBuiltInClassPath
public java.lang.String getMissingBuiltInClassPath()
Returns classpath of missing built-in datatype for which this type is standing-in for
-
getMnemonic
public java.lang.String getMnemonic(Settings settings)
Description copied from interface:DataTypeGet the mnemonic for this DataType.- Specified by:
getMnemonicin interfaceDataType- Returns:
- the mnemonic for this DataType.
-
getLength
public int getLength()
Description copied from interface:DataTypeGet the length (number of 8-bit bytes) of this DataType.
-
isDynamicallySized
public boolean isDynamicallySized()
Description copied from interface:DataTypeIndicates if this data-type is dynamically sized based upon DataOrganization.- Specified by:
isDynamicallySizedin interfaceDataType- See Also:
DataType.isDynamicallySized()
-
canSpecifyLength
public boolean canSpecifyLength()
Description copied from interface:DynamicReturns true if a user-specified length can be used- Specified by:
canSpecifyLengthin interfaceDynamic
-
getLength
public int getLength(MemBuffer buf, int maxLength)
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.
- See Also:
Dynamic.getLength(ghidra.program.model.mem.MemBuffer, int)
-
getDescription
public java.lang.String getDescription()
Description copied from interface:DataTypeGet a String briefly describing this DataType.- Specified by:
getDescriptionin interfaceDataType- Returns:
- a one-liner describing this DataType.
-
getRepresentation
public java.lang.String getRepresentation(MemBuffer buf, Settings settings, int length)
Description copied from interface:DataTypeGet bytes from memory in a printable format for this type.- Specified by:
getRepresentationin interfaceDataType- 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.
-
getValue
public java.lang.Object getValue(MemBuffer buf, Settings settings, int length)
Description copied from interface:DataTypeGet the data in the form of the appropriate Object for this DataType. For instance if the data type is an AddressDT, return an Address object. a Byte, return a Scalar* (maybe this should be a Byte) a Float, return a Float
-
clone
public DataType clone(DataTypeManager dtm)
Description copied from interface:DataTypeReturns a new instance of this DataType with its universalID and SourceArchive identity retained. Note: for built-in DataType's, clone and copy should have the same affect.
-
copy
public final DataType copy(DataTypeManager dtm)
Description copied from interface:DataTypeReturns a new instance of this DataType with a new identity. Note: for built-in DataType's, clone and copy should have the same affect.- Specified by:
copyin interfaceDataType- Parameters:
dtm- the data-type manager instance whose data-organization should apply.- See Also:
DataType.copy(ghidra.program.model.data.DataTypeManager)
-
dataTypeDeleted
public void dataTypeDeleted(DataType dt)
Description copied from interface:DataTypeInforms this dataType that the given dataType has been deleted.
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!- Specified by:
dataTypeDeletedin interfaceDataType- Parameters:
dt- the dataType that has been deleted.
-
dataTypeNameChanged
public void dataTypeNameChanged(DataType dt, java.lang.String oldName)
Description copied from interface:DataTypeInforms this data type that its name has changed from the indicated old name.
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!- Specified by:
dataTypeNameChangedin interfaceDataType- Parameters:
dt- the data type whose name changedoldName- the data type's old name
-
dataTypeReplaced
public void dataTypeReplaced(DataType oldDt, DataType newDt)
Description copied from interface:DataTypeInforms this data type that the given oldDT has been replaced with newDT
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!- Specified by:
dataTypeReplacedin interfaceDataType- Parameters:
oldDt- old data typenewDt- new data type
-
dataTypeSizeChanged
public void dataTypeSizeChanged(DataType dt)
Description copied from interface:DataTypeNotification 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 and should be removed from the public DataType interface!!- Specified by:
dataTypeSizeChangedin interfaceDataType- Parameters:
dt- the dataType that has changed.
-
dependsOn
public boolean dependsOn(DataType dt)
Description copied from interface:DataTypeReturns true 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.
-
isEquivalent
public boolean isEquivalent(DataType dt)
Description copied from interface:DataTypeReturns true if the given dataType is equivalent to this dataType. The precise meaning of "equivalent" is dataType dependent.- Specified by:
isEquivalentin interfaceDataType- Parameters:
dt- the dataType being tested for equivalence.- Returns:
- true if the if the given dataType is equivalent to this dataType.
-
setCategoryPath
public void setCategoryPath(CategoryPath path) throws DuplicateNameException
- Specified by:
setCategoryPathin interfaceDataType- Parameters:
path- set the categoryPath associated with this data type- Throws:
DuplicateNameException
-
setName
public void setName(java.lang.String name) throws InvalidNameException, DuplicateNameExceptionDescription copied from interface:DataTypeSets the name of the dataType- Specified by:
setNamein interfaceDataType- Parameters:
name- the new name for this dataType.- Throws:
InvalidNameException- if the given name does not form a valid name.DuplicateNameException
-
setNameAndCategory
public void setNameAndCategory(CategoryPath path, java.lang.String name) throws InvalidNameException, DuplicateNameException
Description copied from interface:DataTypeSets the name and category of a dataType at the same time.- Specified by:
setNameAndCategoryin interfaceDataType- Parameters:
path- the new category path.name- the new name- Throws:
InvalidNameException- if the name is invalidDuplicateNameException- if a dataType already exists with that name and
-
getLastChangeTime
public long getLastChangeTime()
Description copied from interface:DataTypeGet the timestamp corresponding to the last time this type was changed within its data type manager- Specified by:
getLastChangeTimein interfaceDataType- Overrides:
getLastChangeTimein classDataTypeImpl- Returns:
- timestamp of last change within data type manager
-
getCTypeDeclaration
public java.lang.String getCTypeDeclaration(DataOrganization dataOrganization)
Description copied from interface:BuiltInDataTypeGenerate a suitable C-type declaration for this data-type as a #define or typedef. Since the length of a Dynamic datatype is unknown, such datatypes should only be referenced in C via a pointer. FactoryDataTypes should never be referenced and will always return null.- Specified by:
getCTypeDeclarationin interfaceBuiltInDataType- Parameters:
dataOrganization- or null for default- Returns:
- definition C-statement (e.g., #define or typedef) or null if type name is a standard C-primitive name or if type is FactoryDataType or Dynamic.
- See Also:
BuiltInDataType.getCTypeDeclaration(ghidra.program.model.data.DataOrganization)
-
getReplacementBaseType
public DataType 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
-
-