I compiled a C++ program and want to debug it with gdb now. Version of gcc is gcc (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
, of gdb it's GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
, so this doesn't seem to be a problem in my case.
Starting gdb like $ gdb --args ./my_program /path/to/a/file
works, but it yields the following message:
Reading symbols from ./my_program...(no debugging symbols found)...done.
I can still run the program using run
, but anything that requires debug symbols will fail, like setting breakpoints on lines, or using i line
or i locals
.
So as suggested in this answer, I ran $ objdump --debugging ./my_program
, and the output fills a few thousand lines, so I'm fairly certain that debugging symbols are indeed available.
There's also this question but it seems to be more related to shared libraries. Running info sharedlibrary
in gdb shows that those don't have debugging info in my case, but I don't think I need to be concerned about that.
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
0x00007ffff7ddab00 0x00007ffff7df5660 Yes /lib64/ld-linux-x86-64.so.2
0x00007ffff74f1250 0x00007ffff74f1dc3 Yes (*) /usr/lib/x86_64-linux-gnu/libboost_system.so.1.54.0
0x00007ffff72e0a80 0x00007ffff72eb5e0 Yes (*) /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.54.0
0x00007ffff70a5810 0x00007ffff70b6a43 Yes (*) /usr/lib/x86_64-linux-gnu/libexif.so.12
[...]
(*): Shared library is missing debugging information.
As suggested in the comments, I also checked for stripping:
$ file ./my_program
./shore_evaluate: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux),
dynamically linked (uses shared libs), for GNU/Linux 2.6.24,
BuildID[sha1]=aa85fb21d388828eced5bd0be4202a50bbba1b90, not stripped
What can I do to make GDB find the debugging symbols?