Repeatable comments on non-function symbols from a Ghidra script
See original GitHub issueHey guys,
In the user interface it is possible to add a repeatable comment to a symbol that is not a function (i.e. a global variable/memory reference, etc). However I didn’t find an API that would allow me to do the same from a Ghidra script. Here’s all the API functions currently available from the top level Python script environment as far as I can tell: setPlateComment
, setPreComment
, setPostComment
, setEOLComment
. I expected something like setRepeatableComment
to exist, but it unfortunately does not. 😢
The closest thing I have found was the setRepeatableComment
method in the ghidra.program.model.listing.Function
class, but that is obviously only available for functions.
I tried to find examples from the built-in Ghidra scripts (e.g. Ghidra/Features/Base/ghidra_scripts/ReplaceInComments.java), but it seems that repeatable comments are only supported for functions.
Is there something I’m missing here, or is really not supported yet?
Thanks in advance!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
the scripting takes some getting use to in order to find the right API. Try the code below and I think it will do what you’re asking.
currentProgram.getListing().setComment(currentAddress, ghidra.program.model.listing.CodeUnit.REPEATABLE_COMMENT, 'test repeatable comment')
You can ignore my last message…I saw this ticket got updated, read your Python comment (which I thought was new), thought it was you saying you were going to make an additional pull request specifically for Python, and got confused. I think I need a coffee.