3

I have an C++ application running in Ubuntu. What I'd like to do is to strip the application binary of its symbols so that they are not part of the binary, but use the addr2line utility to get backtrace information by referencing a symbol file instead of the symbols that are part of the binary. Is this possible?

The closest I've gotten so far is to generate a symbol file using:

strip MyBinary -o thesymbols.sym

And then I tried using that file with the addr2line utility like so:

addr2line 0x779e81 -b thesymbols.sym

But this yields the complaint:

addr2line: 'a.out': No such file

So then I tried:

addr2line 0x779e81 -e MyBinary -b thesymbols.sym

But this yields the complaint:

addr2line: MyBinary: Invalid bfd target

Can someone steer my in the right direction? What am I doing wrong?

Thanks in advance for any help!

Edit:

I realize now that when I thought I was creating a file that just contained symbol information with the following:

strip MyBinary -o thesymbols.sym

that I was actually just creating a stripped binary called thesymbols.sym

That being said, my original question still stands. Any ideas?

user2062604
  • 247
  • 3
  • 16

1 Answers1

3

You can use unstripped binary with addr2line with address you got running stripped binary. The address is relative to start of .text section that is same in both stripped and unstripped binary.

Pixus.ru
  • 106
  • 3