Wednesday, 30 August 2023

Ghidra Python script to print codeunits with symbols

I'm using Ghidra to disassemble and study a 68000 binary. I want to write a Python script to get a pretty print version of the disassembly (Save as menu won't be sufficient here).

I thought about simply iterating through codeunits, printing labels if any, then the codeunit. But I get things like :

move.w #-0x5d56,(0xffffa602).w
bsr.b 0x000002c2

while in Ghidra Listing window, it was :

move.w #0xA2AA ,(ptr_to_last_updatable_bg_area).w
bsr.b  set_reg_values_2e2

How can I, at least, recover symbols from addresses (ptr_to_last_updatable_bg_area and set_reg_values_2e2), and, at best, formatted values (unsigned 0xA2AA rather than signed -0x5d56) ?



from Ghidra Python script to print codeunits with symbols

No comments:

Post a Comment