Search code examples
memoryarmdecodeobjdump

Problems about decoding the data dumped from ARM memory


Now I got some content dumped from the memory of an ARM machine. The thing is actually they are ARM instructions, but I don't know how to convert those hex numbers to ARM instructions. What I have now is the "arm-elf-objdump" can read .bin file and disassemble the content in the .bin file. But I just have the texts of hex numbers which is different from the binary file. How can I do this decode?

E.g.

  800104:       e3a00000        mov     r0, #0  ; 0x0
  800108:       e59f104c        ldr     r1, [pc, #76]   ; 80015c <_jump_main+0x4>
  80010c:       e59f204c        ldr     r2, [pc, #76]   ; 800160 <_jump_main+0x8>

Actually the "e3a00000" means "mov r0, #0". There should be a tool to do this. Any one can give me some suggestions?


Solution

  • Convert your text file to a binary file which should be trivial even you have to write a script/application yourself then use objdump to disassemble.

    objdump -D -b binary -marm <binary_file>
    

    However also be careful to instruction encoding, you'll get wildly different results if you select arm for thumb encoding. See objdump manual part about --disassembler-options=force-thumb.