2

I am new to gdb. When I debug my program I only get backtraces like below.

Program received signal SIGSEGV, Segmentation fault.
0x000000003075a238 in ?? ()
(gdb) backtrace
#0  0x000000003075a238 in ?? ()
#1  0x00007fff72825da8 in ?? ()
#2  0x0000000000000008 in ?? ()
#3  0x000000003063c340 in ?? ()
#4  0x0000000000000000 in ?? ()
(gdb) 

I guess there are some symbol infos missing. I get this message

Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found).

so I tried (gdb) symbol-file /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.13.so at startup of gdb it didn't help.

How do I know which symbol info is missing? The code of the whole project is compiled with gcc -g.

hlitz
  • 635
  • 6
  • 24
  • You probably won't need the symbols from the standard C library unless you're debugging _it_ -- chances are significantly higher that any `SIGSEGV` problems are in _your_ code. Are you confident that your code is not stripped after it is compiled? ... On the other hand, #4 there is a null pointer. Perhaps the whole stack is junk. – sarnold May 22 '12 at 00:23
  • 2
    `gcc -g` should work. Make sure any linking also preserves symbols. – Keith Randall May 22 '12 at 00:23

1 Answers1

0

This problem can happen when you compile the application statically (-static in gcc). In this case, the libraries of the build machine might be different from the libraries of the execution machine and gdb cannot find the symbols of the build-machine libraries.

I had this problem and the only solution that worked for me was to build the application on the same machine that the it was executing.

See: GDB cannot show the stack and shows "#1 0x0000000000000000 in ?? ()"

Community
  • 1
  • 1
Shayan Pooya
  • 1,049
  • 1
  • 13
  • 22