I am using the ghidra api. I have written a script which nothing but prints the instructions of selected functions. I am iterating from the entrypoint of particular function (say main) and fetching the instructions using getInstructionAt(instruction), but I am getting instructions in the unlabeled format - something like:
00400595 MOV EDX,dword ptr [RBP + -0x1c]
Instead of say:
00400595 MOV EDX,dword ptr [RBP + p]
Here p is the variable label (I can get this information from ghidra gui by analyzing the binary, but I just can't get this information using scripts and ghidra api).
Is there any way (any function in an api) to print this labeled information?
How about:
getCodeUnitFormat().getRepresentationString(currentProgram.getListing().getCodeUnitAt(currentAddress))
This is great thanks so much! @ryanmkurtz
Most helpful comment
How about:
getCodeUnitFormat().getRepresentationString(currentProgram.getListing().getCodeUnitAt(currentAddress))