Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

no debugging symbols found when using gdb

Tags:

c++

gdb

GNU gdb Fedora (6.8-37.el5) Kernal 2.6.18-164.el5

I am trying to debug my application. However, everytime I pass the binary to the gdb it says:

(no debugging symbols found) 

Here is the file output of the binary, and as you can see it is not stripped:

vid: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped 

I am compiling with the following CFLAGS:

CFLAGS = -Wall -Wextra -ggdb -O0 -Wunreachable-code 

Can anyone tell me if I am missing some simple here?

like image 444
ant2009 Avatar asked Mar 09 '11 10:03

ant2009


People also ask

How do I add debug symbols in GDB?

To add additional symbols you might use add-symbol-file . The add-symbol-file command reads additional symbol table information from the file filename. You would use this command when filename has been dynamically loaded (by some other means) into the program that is running.

What does no debugging symbols mean?

The most frequent cause of "no debugging symbols found" when -g is present is that there is some "stray" -s or -S argument somewhere on the link line. From man ld : -s --strip-all Omit all symbol information from the output file.

What are debugging symbols in GDB?

A Debugging Symbol Table maps instructions in the compiled binary program to their corresponding variable, function, or line in the source code. This mapping could be something like: Program instruction ⇒ item name, item type, original file, line number defined.

What are debug symbols C++?

A debug symbol is a special kind of symbol that attaches additional information to the symbol table of an object file, such as a shared library or an executable.


2 Answers

The most frequent cause of "no debugging symbols found" when -g is present is that there is some "stray" -s or -S argument somewhere on the link line.

From man ld:

   -s    --strip-all        Omit all symbol information from the output file.     -S    --strip-debug        Omit debugger symbol information (but not all symbols) from the output file. 
like image 65
Employed Russian Avatar answered Sep 26 '22 04:09

Employed Russian


The application has to be both compiled and linked with -g option. I.e. you need to put -g in both CPPFLAGS and LDFLAGS.

like image 44
Maxim Egorushkin Avatar answered Sep 26 '22 04:09

Maxim Egorushkin