1

Is there a way to access the call string of a CALLOTHER Pcode instruction when iterating over the Pcode in Java? The listing below shows an example of what I mean:

048
                             LAB_0001b034                                    XREF[1]:     0001b024(j)  
        0001b034 36 7f ff e6     rbit       r7,r6
                                                      r7 = CALLOTHER "ReverseBitOrder", r6

In this example, I'd like to get the string "ReverseBitOrder".
Unfortunately, there is no hint in the instruction info except for this input object:

const:0x3c

Which does not translate into the given string and I also cannot click on the string to find a location in memory. I also looked through the API docs of Pcode, Instruction etc., but did not find anything useful.

1
  • If this is about Ghidra and not generic Java, say so and add proper tags.
    – Igor Skochinsky
    Oct 8 '20 at 18:39
1

There is a ghidra_script that current does this, see https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra/Features/Base/ghidra_scripts/MarkCallOtherPcode.java

basically:

op = getInstructionAt(toAddr(0x1b034)).getPcode()[0]
currentProgram.getLanguage().getUserDefinedOpName(op.getInput(0).getOffset()))
1
  • Thanks a lot! That's what I needed.
    – Melvin
    Oct 6 '20 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.