-
I can't find any way of going through all the classes in a program and getting their values like for example, these vtables |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I believe you are looking for SymbolTable.getClassNamespaces. The I don't really like to advertise my own stuff like this but considering what you have there you may find it useful. It is a bit buggy but it will do a large portion of the work for you especially if there was no debug information. (It appears you have some though). https://github.com/astrelsky/Ghidra-Cpp-Class-Analyzer |
Beta Was this translation helpful? Give feedback.
-
Using the mechanism @astrelsky mentioned is how to find symbols in a class namespace. The figuring out of class members is not currently automated in Ghidra so unless you have a way to identify them first and put them in the correct class namespace, you will not get the complete list of class members using that mechanism. The Ghidra team has been developing a prototype script for windows and gcc RTTI that will figure out class virtual functions and where possible, constructors, destructors, deleting destructors, and more. It will also figure out class hierarchy and create class data structures and apply them so that the data type information is seen in the decompiled view of the class member functions. There are options to print or output class information and to graph the class hierarchy. This script is relying on convention to work correctly (ie same name of class in symbol table and in the data type manager). There is a larger redesign for the data type model that is necessary before some of the concepts are part of the API. However, as a first step, we anticipate the prototype script being released in the next release or a version soon after. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
I believe you are looking for SymbolTable.getClassNamespaces. The
SymbolTable
may be obtained from the scripting api viacurrentProgram.getSymbolTable()
. Then for eachGhidraClass
you can use Namespace.getSymbol and then get all the "members" using SymbolTable.getChildren.I don't really like to advertise my own stuff like this but considering what you have there you may find it useful. It is a bit buggy but it will do a large portion of the work for you especially if there was no debug information. (It appears you have some though). https://github.com/astrelsky/Ghidra-Cpp-Class-Analyzer