Package ghidra.app.cmd.data.rtti.gcc
Class ClassTypeInfoUtils
java.lang.Object
ghidra.app.cmd.data.rtti.gcc.ClassTypeInfoUtils
public class ClassTypeInfoUtils extends Object
-
Method Summary
Modifier and Type Method Description static Vtable
findVtable(Program program, ClassTypeInfo type, TaskMonitor monitor)
Finds the Vtable for the corresponding TypeInfostatic Vtable
findVtable(Program program, Address address, TaskMonitor monitor)
Finds the Vtable for the corresponding TypeInfostatic Map<ClassTypeInfo,Integer>
getBaseOffsets(ClassTypeInfo type)
static Function
getClassFunction(Program program, ClassTypeInfo type, Address address)
Gets the function for the ClassTypeInfo at the specified address.static GhidraClass
getGhidraClassFromTypeName(Program program, String typename)
static int
getMaxVtableCount(ClassTypeInfo type)
static Structure
getPlaceholderStruct(ClassTypeInfo type, DataTypeManager dtm)
Gets the placeholder struct for a ClassTypeInfo in a specified DataTypeManagerstatic DataType
getVptrDataType(Program program, ClassTypeInfo type)
Gets the DataType representation of the _vptr for the specified ClassTypeInfo.static DataType
getVptrDataType(Program program, ClassTypeInfo type, CategoryPath path)
Deprecated, for removal: This API element is subject to removal in a future version.the path parameter is now ignoredstatic boolean
isPlaceholder(Structure struct)
Returns true if the Structure is a "placeholder" structure.static void
setClassFunction(ClassTypeInfo type, Function function)
Sets the provided function to be a class function for the provided typestatic void
sortByMostDerived(Program program, List<ClassTypeInfo> classes, TaskMonitor monitor)
Sorts a list of classes in order of most derived
-
Method Details
-
findVtable
public static Vtable findVtable(Program program, Address address, TaskMonitor monitor) throws CancelledExceptionFinds the Vtable for the corresponding TypeInfo- Parameters:
program
- the program to be searchedaddress
- the address of the TypeInfo Model's DataTypemonitor
- the taskmonitor to be used while searching for the vtable- Returns:
- The TypeInfo's Vtable Model or null if none exists
- Throws:
CancelledException
- if the search is cancelled
-
findVtable
public static Vtable findVtable(Program program, ClassTypeInfo type, TaskMonitor monitor) throws CancelledExceptionFinds the Vtable for the corresponding TypeInfo- Parameters:
program
- the program to be searchedtype
- the typeinfo to find the vtable formonitor
- the taskmonitor to be used while searching for the vtable- Returns:
- The TypeInfo's Vtable Model or null if none exists
- Throws:
CancelledException
- if the search is cancelled
-
getPlaceholderStruct
Gets the placeholder struct for a ClassTypeInfo in a specified DataTypeManager- Parameters:
type
- the ClassTypeInfodtm
- the DataTypeManager- Returns:
- the placeholder struct for a ClassTypeInfo in a specified DataTypeManager
-
isPlaceholder
Returns true if the Structure is a "placeholder" structure.- Parameters:
struct
- the Structure to check.- Returns:
- true if the Structure is a "placeholder" structure.
-
getClassFunction
Gets the function for the ClassTypeInfo at the specified address.- Parameters:
program
- the Program the function is in.type
- the ClassTypeInfo for the function.address
- the Address of the function.- Returns:
- the requested ClassTypeInfo's function.
-
setClassFunction
Sets the provided function to be a class function for the provided type- Parameters:
type
- the class typefunction
- the function- Throws:
IllegalArgumentException
- if the function is external
-
sortByMostDerived
public static void sortByMostDerived(Program program, List<ClassTypeInfo> classes, TaskMonitor monitor) throws CancelledExceptionSorts a list of classes in order of most derived- Parameters:
program
- the program containing the list of ClassTypeInfoclasses
- the list of ClassTypeInfomonitor
- the task monitor- Throws:
CancelledException
- if the operation is cancelled
-
getVptrDataType
Gets the DataType representation of the _vptr for the specified ClassTypeInfo.- Parameters:
program
- the program containing the ClassTypeInfotype
- the ClassTypeInfo- Returns:
- the ClassTypeInfo's _vptr DataType
-
getVptrDataType
@Deprecated(forRemoval=true) public static DataType getVptrDataType(Program program, ClassTypeInfo type, CategoryPath path)Deprecated, for removal: This API element is subject to removal in a future version.the path parameter is now ignoredGets the DataType representation of the _vptr for the specified ClassTypeInfo.- Parameters:
program
- the program containing the ClassTypeInfotype
- the ClassTypeInfopath
- The category path to place the datatype in.- Returns:
- the ClassTypeInfo's _vptr DataType
-
getBaseOffsets
-
getGhidraClassFromTypeName
-
getMaxVtableCount
-