Class ClassTypeInfoUtils

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

public class ClassTypeInfoUtils
extends Object
  • Method Details

    • findVtable

      public static Vtable findVtable​(Program program, Address address, TaskMonitor monitor) throws CancelledException
      Finds the Vtable for the corresponding TypeInfo
      Parameters:
      program - the program to be searched
      address - the address of the TypeInfo Model's DataType
      monitor - 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 CancelledException
      Finds the Vtable for the corresponding TypeInfo
      Parameters:
      program - the program to be searched
      type - the typeinfo to find the vtable for
      monitor - 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

      public static Structure getPlaceholderStruct​(ClassTypeInfo type, DataTypeManager dtm)
      Gets the placeholder struct for a ClassTypeInfo in a specified DataTypeManager
      Parameters:
      type - the ClassTypeInfo
      dtm - the DataTypeManager
      Returns:
      the placeholder struct for a ClassTypeInfo in a specified DataTypeManager
    • isPlaceholder

      public static boolean isPlaceholder​(Structure struct)
      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

      public static Function getClassFunction​(Program program, ClassTypeInfo type, Address address)
      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

      public static void setClassFunction​(ClassTypeInfo type, Function function)
      Sets the provided function to be a class function for the provided type
      Parameters:
      type - the class type
      function - the function
      Throws:
      IllegalArgumentException - if the function is external
    • sortByMostDerived

      public static void sortByMostDerived​(Program program, List<ClassTypeInfo> classes, TaskMonitor monitor) throws CancelledException
      Sorts a list of classes in order of most derived
      Parameters:
      program - the program containing the list of ClassTypeInfo
      classes - the list of ClassTypeInfo
      monitor - the task monitor
      Throws:
      CancelledException - if the operation is cancelled
    • getVptrDataType

      public static DataType getVptrDataType​(Program program, ClassTypeInfo type)
      Gets the DataType representation of the _vptr for the specified ClassTypeInfo.
      Parameters:
      program - the program containing the ClassTypeInfo
      type - 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 ignored
      Gets the DataType representation of the _vptr for the specified ClassTypeInfo.
      Parameters:
      program - the program containing the ClassTypeInfo
      type - the ClassTypeInfo
      path - The category path to place the datatype in.
      Returns:
      the ClassTypeInfo's _vptr DataType
    • getBaseOffsets

      public static Map<ClassTypeInfo,​Integer> getBaseOffsets​(ClassTypeInfo type)
    • getGhidraClassFromTypeName

      public static GhidraClass getGhidraClassFromTypeName​(Program program, String typename)
    • getMaxVtableCount

      public static int getMaxVtableCount​(ClassTypeInfo type)