Package ghidra.program.model.gclass
Class ClassUtils
java.lang.Object
ghidra.program.model.gclass.ClassUtils
Utility class for Class-related software modeling.
This class is experimental and subject to unannounced changes, including changes to processing philosophies and removal of methods
-
Nested Class Summary
Nested ClassesChangeModifier and TypeClassDescriptionstatic final recordRecord containing a name and a pointer data type -
Field Summary
FieldsChangeModifier and TypeFieldDescriptionMODIFIEDstatic final StringStandard field name for a virtual base table pointer found within a classNEWstatic final StringStandard field name for a class virtual base tableMODIFIEDstatic final StringStandard field name for a virtual function table pointer found within a classNEWstatic final StringStandard field name for a class virtual function tableNEWstatic final StringStandard field name for a class virtual tableNEWstatic final StringStandard field name for a virtual table pointer found within a classstatic final PointerDataType -
Method Summary
ChangeModifier and TypeMethodDescriptionNEWstatic StringcreateVxTableDescriptionOffsetTag(long ptrOffsetInClass) Provides the __TEMPORARY__ standard special Description string for a virtual table (e.g., vtable, vbtable, vftable) that is keyed off of by the Decompiler during flattening and replacement of types within a class structure.static DataTypePathgetBaseClassDataTypePath(Composite composite) Returns the data type path for a suitable base classNEWstatic CategoryPathgetClassInternalsPath(CategoryPath category) Returns the category path for class internals for the Class CategoryPathstatic CategoryPathgetClassInternalsPath(CategoryPath path, String className) Returns the category path for class internalsstatic CategoryPathgetClassInternalsPath(Composite composite) Returns the category path for class internalsstatic CategoryPathReturns the category path for class internals for the ClassIDNEWstatic CategoryPathgetClassPath(Composite composite) Returns the category path for items belonging to this class, such as vxtablesNEWstatic CategoryPathgetClassPath(ClassID id) Returns the category path for class for the ClassIDNEWgetReplacementPointers(DataTypeManager dtm, Structure type) Finds and returns list of replacement pointer types for the specified owner class structurestatic ClassUtils.NameAndPointergetReplacementType(DataTypeComponent component, long accumulatedOffset, Map<Long, Pointer> ownerVxtptrs) Tries to provide an appropriate data type replacement for special components, particularly for class objects such as virtual function table and virtual base table pointers within a flattened class structureNEWstatic StructuregetReplacementType(Structure structure) Tries to provide an appropriate data type replacement for special components, particularly for class objects such as virtual function table and virtual base table pointers within a flattened class structureNEWstatic StructuregetReplacementType(Structure structure, boolean enabled) Tries to provide an appropriate data type replacement for special components, particularly for class objects such as virtual function table and virtual base table pointers within a flattened class structure.static CompositegetSelfBaseType(Composite composite) Returns the "self-base" composite for the specified class composite.NEWstatic CompositegetSelfBaseType(DataTypeManager dtm, ClassID id) Returns the "self-base" composite for the specified class IDstatic DataTypeReturns a default data type for a VBTstatic intReturns the size of the default data type for a VBT entryMODIFIEDstatic PointerDataTypeReturns a default data type for a VFTstatic intReturns the size of the default pointer data type for a VFT entryNEWstatic booleanhasClassAttribute(Structure structure) This method returns true if the argument structure has a class attributestatic booleanIndicates whether a label satisfies the format of a vxtable labelNEWstatic LongvalidateVtableDescriptionOffsetTag(String description) Validates a Vtable description and returns the encoded offset valueREMOVEDStringgetSpecialVxTableName(long ptrOffsetInClass) Removed
-
Field Details
-
VTABLE NEW
Standard field name for a class virtual table- See Also:
-
VBTABLE NEW
Standard field name for a class virtual base table- See Also:
-
VFTABLE NEW
Standard field name for a class virtual function table- See Also:
-
VTPTR NEW
Standard field name for a virtual table pointer found within a class- See Also:
-
VBPTR MODIFIED
constant: "{vbptr}" → "vbptr"-static java.lang.String VBPTR+static java.lang.String VBPTRStandard field name for a virtual base table pointer found within a class- See Also:
-
VFPTR MODIFIED
constant: "{vfptr}" → "vfptr"-static java.lang.String VFPTR+static java.lang.String VFPTRStandard field name for a virtual function table pointer found within a class- See Also:
-
VXPTR_TYPE
-
-
Method Details
-
getClassInternalsPath
Returns the category path for class internals- Parameters:
composite- the class composite- Returns:
- the category path
-
getClassPath NEW
Returns the category path for items belonging to this class, such as vxtables- Parameters:
composite- the class composite- Returns:
- the category path
-
getClassPath NEW
Returns the category path for class for the ClassID- Parameters:
id- the class ID- Returns:
- the category path
-
getClassInternalsPath NEW
Returns the category path for class internals for the Class CategoryPath- Parameters:
category- the class category path- Returns:
- the category path
-
getClassInternalsPath
Returns the category path for class internals for the ClassID- Parameters:
id- the class ID- Returns:
- the category path
-
getClassInternalsPath
Returns the category path for class internals- Parameters:
path- the category path of the class compositeclassName- the name of the class- Returns:
- the category path
-
getBaseClassDataTypePath
Returns the data type path for a suitable base class- Parameters:
composite- the class composite- Returns:
- the base class data type path
-
getSelfBaseType
Returns the "self-base" composite for the specified class composite. This could be the composite argument itself of could be a component of it- Parameters:
composite- the main class type- Returns:
- the self-base composite
-
getSelfBaseType NEW
Returns the "self-base" composite for the specified class ID- Parameters:
dtm- the data type managerid- the class id- Returns:
- the self-base composite
-
isVTable
Indicates whether a label satisfies the format of a vxtable label- Parameters:
type- the data type- Returns:
trueif is a vxtable label format
-
createVxTableDescriptionOffsetTag NEW
Provides the __TEMPORARY__ standard special Description string for a virtual table (e.g., vtable, vbtable, vftable) that is keyed off of by the Decompiler during flattening and replacement of types within a class structure. This is __TEMPORARY__ in that we hope to use some special attribute in the future. More details to come- Parameters:
ptrOffsetInClass- the offset of the special field within the class- Returns:
- the special name
-
validateVtableDescriptionOffsetTag NEW
Validates a Vtable description and returns the encoded offset value- Parameters:
description- the description string- Returns:
- the offset or
nullif invalid name
-
getVftDefaultEntry MODIFIED
return type: DataType → PointerDataType-static ghidra.program.model.data.DataType getVftDefaultEntry(ghidra.program.model.data.DataTypeManager dtm)+static ghidra.program.model.data.PointerDataType getVftDefaultEntry(ghidra.program.model.data.DataTypeManager dtm)Returns a default data type for a VFT- Parameters:
dtm- the data type manager- Returns:
- the pointer data type
-
getVbtDefaultEntry
Returns a default data type for a VBT- Parameters:
dtm- the data type manager- Returns:
- the data type
-
getVftEntrySize
Returns the size of the default pointer data type for a VFT entry- Parameters:
dtm- the data type manager- Returns:
- the size
-
getVbtEntrySize
Returns the size of the default data type for a VBT entry- Parameters:
dtm- the data type manager- Returns:
- the size
-
getReplacementPointers NEW
Finds and returns list of replacement pointer types for the specified owner class structure- Parameters:
dtm- the data type managertype- the class structure type- Returns:
- the map of offset to owner replacement types
-
getReplacementType
public static ClassUtils.NameAndPointer getReplacementType(DataTypeComponent component, long accumulatedOffset, Map<Long, Pointer> ownerVxtptrs) Tries to provide an appropriate data type replacement for special components, particularly for class objects such as virtual function table and virtual base table pointers within a flattened class structure- Parameters:
component- the component to be checkedaccumulatedOffset- the accumulated offset of the component due to flatteningownerVxtptrs- the map of offset to owner vxtptr types- Returns:
- the replacement data type or the original type if there is no replacement needed
-
getReplacementType NEW
Tries to provide an appropriate data type replacement for special components, particularly for class objects such as virtual function table and virtual base table pointers within a flattened class structure. Thestructureargument becomes the return type ifenabledisfalse, if the argument structure does not have class attributes, or if there is no suitable replacement for it- Parameters:
structure- the structure to processenabled-falsewill immediately return the argument type- Returns:
- the replacement data type or null if could not or did not need to be replaced
-
getReplacementType NEW
Tries to provide an appropriate data type replacement for special components, particularly for class objects such as virtual function table and virtual base table pointers within a flattened class structure- Parameters:
structure- the structure to process- Returns:
- the replacement data type or null if could not or did not need to be replaced
-
hasClassAttribute NEW
This method returns true if the argument structure has a class attribute- Parameters:
structure- the structure under question- Returns:
trueif has a class attribute
-