Solved: GDB: (no debugging symbols found) error message.

Sometimes when we try to debug our program, we encounter the error message “no debugging symbols found”.

Error “no debugging symbols found”

[root@nglinux c_programs]# gdb 1hello.o 
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-92.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /root/c_programs/1hello.o...(no debugging symbols found)...done.

Solution
To solve this issue, we can compile our C program again with “-g” option to include the debugging symbols.

[root@nglinux c_programs]# gcc -g  1hello.c 

[root@nglinux c_programs]# ls -ltr
total 16
-rw-r--r--. 1 root root   58 Aug  4 19:34 1hello.c
-rwxr-xr-x. 1 root root  856 Aug  4 19:35 1hello.o
-rwxr-xr-x. 1 root root 5754 Aug  4 19:37 a.out

[root@nglinux c_programs]# ./a.out 
Hello world[root@nglinux c_programs]# 

[root@nglinux c_programs]# gdb a.out 
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-92.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /root/c_programs/a.out...done.
(gdb) 

Leave a Reply

Your email address will not be published.