gdb: (no debugging symbols found)

26,997

Solution 1

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

Solution 2

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
Share:
26,997
psyc0der
Author by

psyc0der

Updated on July 09, 2022

Comments

  • psyc0der
    psyc0der almost 2 years

    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.