Fix CParserUtils.parseSignature API for Ghidra 11+#11
Fix CParserUtils.parseSignature API for Ghidra 11+#11andresj-sanchez wants to merge 1 commit intoakiselev:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves critical compilation and runtime issues in Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
| ghidra.program.model.data.FunctionDefinitionDataType funcDef = | ||
| ghidra.app.util.cparser.C.CParserUtils.parseSignature( | ||
| this, currentProgram, sigStr); | ||
| state.getTool(), currentProgram, sigStr); |
There was a problem hiding this comment.
For improved readability and to leverage the existing wildcard import import ghidra.program.model.data.*;, you can use the simple class name for FunctionDefinitionDataType instead of the fully qualified name.
| ghidra.program.model.data.FunctionDefinitionDataType funcDef = | |
| ghidra.app.util.cparser.C.CParserUtils.parseSignature( | |
| this, currentProgram, sigStr); | |
| state.getTool(), currentProgram, sigStr); | |
| FunctionDefinitionDataType funcDef = | |
| ghidra.app.util.cparser.C.CParserUtils.parseSignature( | |
| state.getTool(), currentProgram, sigStr); |
Fix
CParserUtils.parseSignatureAPI compatibility for Ghidra 11+Fixes #10
Problem
GhidraCliBridge.javafails to compile under Ghidra 11.x with the following errors:parseSignature(GhidraCliBridge, Program, String)—GhidraScriptdoes not implementServiceProvider, so passingthisis invalid.parseResults.getDataType()—CParseResultsno longer has agetDataType()method;parseSignaturenow returnsFunctionDefinitionDataTypedirectly.This causes the bridge to fail at startup with a
ClassNotFoundException.Fix
CParserUtils.CParseResultswithFunctionDefinitionDataTypeas the return type.state.getTool()instead ofthisas theServiceProviderargument — the Ghidra tool properly implementsServiceProviderand allows the parser to resolve data types correctly.Before
After
Tested on
ghidra startandghidra function listwork correctly.