0

If I load a library in to gdb and do info symbol 0xB0153C I get something like function + offset

Is there a way to get this same information without gdb? Like some readelf/objdump option?

Thanks

TreeWater
  • 761
  • 6
  • 13
  • `objdump --dwarf` gives you all of the debug information. But why not use gdb if it already gives you the information you need? – ssbssa Aug 24 '20 at 10:20

1 Answers1

0

Is there a way to get this same information without gdb?

I don't know of any tool that will print function+offset.

Use addr2line to get the enclosing function name:

(gdb) info sym 0x108a
main + 10 in section .text

addr2line -fe a.out 0x108a
main
??:?

Or use objdump -d with scripting to compute the offset (here 0x108a - 0x1080):

objdump -d a.out | egrep '>:| 108a:' | grep -B1 '108a:'
0000000000001080 <main>:
    108a:       48 83 ec 38             sub    $0x38,%rsp
Employed Russian
  • 199,314
  • 34
  • 295
  • 362