Package ghidra.app.cmd.data.rtti.gcc
Class TypeInfoUtils
java.lang.Object
ghidra.app.cmd.data.rtti.gcc.TypeInfoUtils
public class TypeInfoUtils extends Object
-
Method Summary
Modifier and Type Method Description static TypeInfo
findTypeInfo(Program program, AddressSetView set, String typename, TaskMonitor monitor)
Locates the TypeInfo with the specified typenamestatic TypeInfo
findTypeInfo(Program program, String typename, TaskMonitor monitor)
Locates the TypeInfo with the specified ID_STRINGstatic CategoryPath
getCategoryPath(TypeInfo type)
Retrieves the CategoryPath for the represented datatypestatic DataTypePath
getDataTypePath(TypeInfo type)
Retrieves the DataTypePath for the represented datatypestatic String
getErrorMessage(Program program, Address address, String id)
Generates an appropriate error message for when an invalid type_info is encounteredstatic String
getIDString(Program program, Address address)
Gets the identifier string for the "type_info" at the specified address.static Namespace
getNamespaceFromTypeName(Program program, TypeInfo type)
Gets the Namespace for the corresponding typeinfostatic Namespace
getNamespaceFromTypeName(Program program, String typename)
Gets the Namespace for the corresponding typenamestatic Program
getProgram(TypeInfo type)
Gets the program this TypeInfo is instatic String
getSymbolName(TypeInfo type)
Gets the symbol name for the ClassTypeInfostatic String
getTypeName(Program program, Address address)
Gets the typename for the "type_info" at the specified addressstatic boolean
isTypeInfo(Program program, Address address)
Deprecated, for removal: This API element is subject to removal in a future version.static boolean
isTypeInfo(MemBuffer buf)
Deprecated, for removal: This API element is subject to removal in a future version.please useTypeInfoManager.isTypeInfo(Address)
static boolean
isTypeInfoPointer(Program program, Address address)
Checks if a typeinfo* is located at the specified addressstatic boolean
isTypeInfoPointer(MemBuffer buf)
Checks if a typeinfo* is present at the buffer's address
-
Method Details
-
getTypeName
Gets the typename for the "type_info" at the specified address- Parameters:
program
- the program to be searchedaddress
- the address of the TypeInfo Model's DataType- Returns:
- the TypeInfo's typename string or "" if invalid
-
findTypeInfo
public static TypeInfo findTypeInfo(Program program, String typename, TaskMonitor monitor) throws CancelledExceptionLocates the TypeInfo with the specified ID_STRING- Parameters:
program
- the program to be searchedtypename
- the typename of the typeinfo to search formonitor
- the active task monitor- Returns:
- the TypeInfo with the corresponding typename or invalid if it doesn't exist
- Throws:
CancelledException
- if the search is cancelled- See Also:
TypeInfoModel.ID_STRING
-
findTypeInfo
public static TypeInfo findTypeInfo(Program program, AddressSetView set, String typename, TaskMonitor monitor) throws CancelledExceptionLocates the TypeInfo with the specified typename- Parameters:
program
- the program to be searchedset
- the address set to be searchedtypename
- the typename to search formonitor
- the active task monitor- Returns:
- the TypeInfo with the corresponding typename or null if it doesn't exist
- Throws:
CancelledException
- if the search is cancelled
-
getIDString
Gets the identifier string for the "type_info" at the specified address.- Parameters:
program
- the program to be searchedaddress
- the address of the TypeInfo Model's DataType- Returns:
- The TypeInfo's identifier string or "" if invalid
- See Also:
TypeInfoModel.ID_STRING
-
isTypeInfoPointer
Checks if a typeinfo* is located at the specified address- Parameters:
program
- the program to be searchedaddress
- the address of the suspected pointer- Returns:
- true if a typeinfo* is present at the address
-
isTypeInfoPointer
Checks if a typeinfo* is present at the buffer's address- Parameters:
buf
- the buffer containing the data- Returns:
- true if a typeinfo* is present at the buffer's address
-
isTypeInfo
@Deprecated(since="1.5", forRemoval=true) public static boolean isTypeInfo(Program program, Address address)Deprecated, for removal: This API element is subject to removal in a future version.please useTypeInfoManager.isTypeInfo(Address)
Checks if a valid TypeInfo is located at the address in the program.- Parameters:
program
- the program containing the TypeInfoaddress
- the address of the TypeInfo- Returns:
- true if the buffer contains a valid TypeInfo
-
isTypeInfo
Deprecated, for removal: This API element is subject to removal in a future version.please useTypeInfoManager.isTypeInfo(Address)
Checks if a valid TypeInfo is located at the start of the buffer- Parameters:
buf
- the memory buffer containing the TypeInfo data- Returns:
- true if the buffer contains a valid TypeInfo
-
getNamespaceFromTypeName
Gets the Namespace for the corresponding typeinfo- Parameters:
program
- the program containing the namespacetype
- the typeinfo- Returns:
- the Namespace for the corresponding typeinfo
-
getNamespaceFromTypeName
Gets the Namespace for the corresponding typename- Parameters:
program
- the program containing the namespacetypename
- the typename corresponding to the namespace- Returns:
- the Namespace for the corresponding typename
-
getCategoryPath
Retrieves the CategoryPath for the represented datatype- Parameters:
type
- the TypeInfo- Returns:
- the TypeInfo's datatype CategoryPath
-
getDataTypePath
Retrieves the DataTypePath for the represented datatype- Parameters:
type
- the TypeInfo- Returns:
- the TypeInfo's datatype DataTypePath
-
getErrorMessage
Generates an appropriate error message for when an invalid type_info is encountered- Parameters:
program
- the program containing the dataaddress
- the address of the dataid
- the expected type_info identification string- Returns:
- an appropriate error message
-
getProgram
Gets the program this TypeInfo is in- Parameters:
type
- the TypeInfo- Returns:
- the program containing the TypeInfo
-
getSymbolName
Gets the symbol name for the ClassTypeInfo- Parameters:
type
- the ClassTypeInfo- Returns:
- the type info symbol nane
-
TypeInfoManager.isTypeInfo(Address)