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.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With