Class TypeInfoUtils

java.lang.Object
ghidra.app.cmd.data.rtti.gcc.TypeInfoUtils

public class TypeInfoUtils
extends Object
  • Method Details

    • getTypeName

      public static String getTypeName​(Program program, Address address)
      Gets the typename for the "type_info" at the specified address
      Parameters:
      program - the program to be searched
      address - 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 CancelledException
      Locates the TypeInfo with the specified ID_STRING
      Parameters:
      program - the program to be searched
      typename - the typename of the typeinfo to search for
      monitor - 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 CancelledException
      Locates the TypeInfo with the specified typename
      Parameters:
      program - the program to be searched
      set - the address set to be searched
      typename - the typename to search for
      monitor - 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

      public static String getIDString​(Program program, Address address)
      Gets the identifier string for the "type_info" at the specified address.
      Parameters:
      program - the program to be searched
      address - the address of the TypeInfo Model's DataType
      Returns:
      The TypeInfo's identifier string or "" if invalid
      See Also:
      TypeInfoModel.ID_STRING
    • isTypeInfoPointer

      public static boolean isTypeInfoPointer​(Program program, Address address)
      Checks if a typeinfo* is located at the specified address
      Parameters:
      program - the program to be searched
      address - the address of the suspected pointer
      Returns:
      true if a typeinfo* is present at the address
    • isTypeInfoPointer

      public static boolean isTypeInfoPointer​(MemBuffer buf)
      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.
      Checks if a valid TypeInfo is located at the address in the program.
      Parameters:
      program - the program containing the TypeInfo
      address - the address of the TypeInfo
      Returns:
      true if the buffer contains a valid TypeInfo
    • isTypeInfo

      @Deprecated(since="1.5", forRemoval=true) public static boolean isTypeInfo​(MemBuffer buf)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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

      public static Namespace getNamespaceFromTypeName​(Program program, TypeInfo type)
      Gets the Namespace for the corresponding typeinfo
      Parameters:
      program - the program containing the namespace
      type - the typeinfo
      Returns:
      the Namespace for the corresponding typeinfo
    • getNamespaceFromTypeName

      public static Namespace getNamespaceFromTypeName​(Program program, String typename)
      Gets the Namespace for the corresponding typename
      Parameters:
      program - the program containing the namespace
      typename - the typename corresponding to the namespace
      Returns:
      the Namespace for the corresponding typename
    • getCategoryPath

      public static CategoryPath getCategoryPath​(TypeInfo type)
      Retrieves the CategoryPath for the represented datatype
      Parameters:
      type - the TypeInfo
      Returns:
      the TypeInfo's datatype CategoryPath
    • getDataTypePath

      public static DataTypePath getDataTypePath​(TypeInfo type)
      Retrieves the DataTypePath for the represented datatype
      Parameters:
      type - the TypeInfo
      Returns:
      the TypeInfo's datatype DataTypePath
    • getErrorMessage

      public static String getErrorMessage​(Program program, Address address, String id)
      Generates an appropriate error message for when an invalid type_info is encountered
      Parameters:
      program - the program containing the data
      address - the address of the data
      id - the expected type_info identification string
      Returns:
      an appropriate error message
    • getProgram

      public static Program getProgram​(TypeInfo type)
      Gets the program this TypeInfo is in
      Parameters:
      type - the TypeInfo
      Returns:
      the program containing the TypeInfo
    • getSymbolName

      public static String getSymbolName​(TypeInfo type)
      Gets the symbol name for the ClassTypeInfo
      Parameters:
      type - the ClassTypeInfo
      Returns:
      the type info symbol nane