2

I keep getting "No symbol table is loaded" error while working on my GDB session. I complied my source files using the following command :

    $ gcc -g -Wall -o test exc4.3_modulus.c getop.c stack.c

When I started my GDB session as:

    $ gdb test -tui

and tried to add a break point at getop function inside getop.c as

    (gdb) b getop.c:getop

GDB is showing the following error:

    No symbol table is loaded.  Use the "file" command.
    Make breakpoint pending on future shared library load? (y or n)  

I browsed over stackoverflow and found this thread

[gdb: "No symbol table is loaded"

As suggested in the thread and in the gdb session I tried

    (gdb) file test

But what I get as an outcome is not an improvement over the scenario

    Reading symbols from /usr/bin/test...(no debugging symbols found)...done.

and problem with the break point still persists.

Can anyone point me out where I am going wrong? I am new to GDB. So an proper explanation would always be greeted thankfully.

PS : The problem is solved after I updated my GCC and GDB.

Community
  • 1
  • 1
Satadip Saha
  • 137
  • 1
  • 3
  • 11
  • do a "readelf -a binary name | less" and check if you see an entry for .debug_info and .debug_aranges under the Section Headers output (this will be the second section in the readelf output).. If not then your binary do not have debug symbols which gdb can refer to. (Which version of gcc you are using, you can get that by doing gcc --version) – abhi Aug 04 '14 at 01:21
  • GCC version is 4.6.3. "$ readelf -a test" on the object file 'test' gives an error as "no such file". – Satadip Saha Aug 04 '14 at 01:36
  • That error message shows that you are using incorrect binary name or no binary with that name is present. Recheck if you correctly specified the same command to gcc to compile that you have mentioned above.. do a ls and see if you have a binary with the name test in that directory.. My guess is that you have missed something on the command line to gcc from what you have mentioned in the question detail... (Just to make sure ..you are on a Linux box?) – abhi Aug 04 '14 at 02:06
  • try `gdb ./test`, evidently it's finding `test` in your path (re: `/usr/bin/test`). Be wary of naming YOUR files with the name names as files in your $PATH. – lornix Aug 04 '14 at 02:37
  • @abhi: I have crosschecked everything and looks like no error on that part. – Satadip Saha Aug 04 '14 at 10:20
  • @lornix : I tried changing the name .. problem still persists .. – Satadip Saha Aug 04 '14 at 10:20
  • What name did you use? – lornix Aug 04 '14 at 12:20
  • Did gcc output any error messages or warnings? If you run `ls -l test` right after gcc, what does it output? – Mark Plotnick Aug 04 '14 at 15:37
  • @mark : it shows that Test is an executable. – Satadip Saha Aug 04 '14 at 17:09
  • Can you paste the output of `ls -l test` and `file test` into your question? It is strange that gdb and readelf cannot see that file. – Mark Plotnick Aug 04 '14 at 18:03
  • @SatadipSaha If you have found a solution for your issue, post the solution for others who will search for it in future.. Yours is a peculiar case... – abhi Aug 13 '14 at 17:12
  • @abhi : It was strange that the problem got resolved with updating GCC and GDB. I was using comparatively older version of both. – Satadip Saha Aug 15 '14 at 14:15
  • 1
    @SatadipSaha That is a good news.. Which GDB version you were using previously... and did you just installed GCC and GDB using package manager or compiled and build them from source? – abhi Aug 15 '14 at 16:36

0 Answers0