Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gdb: (no debugging symbols found)

Tags:

c++

g++

ubuntu

gdb

I have a file called test. Even after compiling it with -g, when I run it in gdb, it says no debugging symbols found. I have also tried using -ggdb but it too was off no use. Please help.

Output for : gdb test

This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/test...(no debugging symbols found)...done.
like image 803
psyc0der Avatar asked Aug 12 '13 15:08

psyc0der


2 Answers

The issue is that you are attempting to debug the wrong program.

Your program is called test and yet you are debugging /usr/bin/test (a system program that will almost certainly be shipped without symbols; even if it did contain symbols, they wouldn't relate to your source code).

gdb will search $PATH to find the executable. From here:

exec-file [ filename ] Specify that the program to be run (but not the symbol table) is found in filename. gdb searches the environment variable PATH if necessary to locate your program. Omitting filename means to discard information on the executable file.

Try using the command:

$ gdb ./test
like image 105
trojanfoe Avatar answered Sep 23 '22 21:09

trojanfoe


Remove a.out and then try again. It worked for me as I was also getting the same error.

rm a.out
gcc -g your_code.c
like image 40
pankaj kushwaha Avatar answered Sep 19 '22 21:09

pankaj kushwaha