-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting a function signature from script #1126
Comments
I was a bit surprised at just how unobvious this actually was (I would have expected more related methods in the scripting API). The 'Ghidra Way' of modifying items that are stored in the database, such as a function, involves using an existing Command (or creating one as needed). In this case, you should be using the Command objects represent capsules/units of work that get performed together. Further, when a command is run, it is wrapped in a database transaction, which means the entire operation is atomic. Finally, this atomicity allows the undo/redo feature to work correctly. |
Perfect! I found the ApplyFunctionSignatureCmd class, but could not figure out how to run the command after it was constructed. I was looking for an execute(cmd) and totally missed the runCommand(cmd). Thanks! |
Can also use cmd.applyTo(currentProgram) |
I wrote a Ghidra script which does the correction automatically. https://gist.github.com/crashingstatic/71f9ca586e43178fbea3317a93e1df59 |
For the life of me I cannot fine a script API call for setting a functions signature. I have found, FunctionUtility.updateFunction(dst,src), and how the GUI does it in EditFunctionSignatureDialog.java. I have been able to setVarArgs(). Does script API call exist for setting a function's arguments? If so can someone point me to it?
The text was updated successfully, but these errors were encountered: