From Jython APIs how can i retrieve raw assembly and/or decompiled code from a function?
I can't find anything related.
Thanks.
Raw assembly:
listing = currentProgram.getListing()
currentFunction = listing.getFunctionContaining(currentAddress)
entryPoint = currentFunction.getEntryPoint()
instructions = listing.getInstructions(entryPoint, True)
for index, instruction in enumerate(instructions):
print instruction
if index > 5:
break
Decompiled code:
decompInterface = ghidra.app.decompiler.DecompInterface()
decompInterface.openProgram(currentProgram)
decompileResults = decompInterface.decompileFunction(currentFunction, 30, monitor)
if decompileResults.decompileCompleted():
decompiledFunction = decompileResults.getDecompiledFunction()
decompiledFunction.getC()
You can use also FlatAPI:
- FlatProgramAPI
- FlatDecompilerAPI
Thanks !
Most helpful comment
Raw assembly:
ListingDecompiled code:
DecompInterfaceYou can use also
FlatAPI:-
FlatProgramAPI-
FlatDecompilerAPI