简体   繁体   中英

gdb questions regarding symbols

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.

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 ?? ()"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM