When I load Fedora 28\'s /usr/bin/ls
file into GDB, I can access to the symbol abformat_init
, even if it is not present as a string nor in the symb
Is there a program that allows to extract them outside of GDB?
Yes, you can use nm
to extract the symbol, but you should look for the symbol in a separate debug info file, because the binary itself is stripped.
You can use readelf
or objdump
to know separate debug info file name, see How to know the name and/or path of the debug symbol file which is linked to a binary executable?:
$ objdump -s -j .gnu_debuglink /usr/bin/ls
/usr/bin/ls: file format elf64-x86-64
Contents of section .gnu_debuglink:
0000 6c732d38 2e33302d 362e6663 32392e78 ls-8.30-6.fc29.x
0010 38365f36 342e6465 62756700 5cddcc98 86_64.debug.\...
On Fedora 29 the separate debug info file name for /usr/bin/ls
is ls-8.30-6.fc29.x86_64.debug
.
Normally, on Fedora, separate debug info is installed to /usr/lib/debug/
directory so the full path to debug info file is /usr/lib/debug/usr/bin/ls-8.30-6.fc29.x86_64.debug
.
Now you can look for the symbol with nm
:
$ nm /usr/lib/debug/usr/bin/ls-8.30-6.fc29.x86_64.debug | grep abformat_init
0000000000006d70 t abformat_init
Note that separate debug info should be installed with debuginfo-install
, this is what gdb is telling you.