Search code examples
gdbelfobjdumpreadelf

How to extract symbol name from ELF file for a given offset


I have a hex offset, say 0xcccddd. Using gdb info symbol 0xcccddd I can get the symbol name, e.g. fn() in section_name.

How can I do this using the readelf or objdump command, or any other commands without running gdb?


EDIT: After using the below command

objdump -d --start-address 0xcccddd --stop-address 0xcccdde filename.axf

I am getting

filename.axf:     file format elf32-little
objdump: can't disassemble for architecture UNKNOWN!

Solution

  • Use this:

    objdump -d --start-address 0xcccddd --stop-address 0xcccdde
    

    I am getting objdump: can't disassemble for architecture UNKNOWN!

    It looks like you are cross-compiling for ARM using RealView compiler. You need to use objdump from the same NDK the compiler came from (instead of using host-native objdump).