Replies: 2 comments 8 replies
-
It is a giant hack but it is guaranteed to be there. Since you are writing an private DataTypeManagerService getDataTypeManagerService(Program program) {
AutoAnalysisManager man = AutoAnalysisManager.getAnalysisManager(program);
if (man == null) {
// unlikely edge case
return null;
}
return man.getDataTypeManagerService();
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am writing an analysis and during that I need to check if a datatype with a certain name already exists in any of the open data type archives. Specifically there is a high chance that the datatype is already defined in a file archive that is opened by default, like the
mac_osx
archive.The
FindDataTypeScript
searches all open datatype managers viatool.getService(DataTypeManagerService.class)
ghidra/Ghidra/Features/Base/ghidra_scripts/FindDataTypeScript.java
Lines 72 to 80 in fafbaac
but the
tool
object isn't obviously available insideghidra.app.services.Analyzer#added(Program program, AddressSetView set, TaskMonitor monitor, MessageLog log)
and the suppliedProgram.getDataTypeManager
will be only theDataTypeManager
for the program itself.@astrelsky has a snippet that searches the consumers of the
Program
object for aPluginTool
, but this seems like a giant hackhttps://github.com/astrelsky/Ghidra-Cpp-Class-Analyzer/blob/933cc702fe7abcca62a5090dbc67b25f15e3c020/src/main/java/cppclassanalyzer/utils/CppClassAnalyzerUtils.java#L42-L49
Beta Was this translation helpful? Give feedback.
All reactions