wyb2ug
Last Updated: July 28, 2017
·
23.11K
· JoeyButler
E27850b3b6b8eca3bdc1f333089448ec

How fix the "No symbol table is loaded." gdb issue on Mountain Lion

When attempting to debug a C program on Mountain Lion you may encounter the "No symbol table is loaded.".

Let's say we have a hello_world program, when we attempt to debug with gdb like the following:

$ gdb hello_world
(gdb) break 5
No symbol table is loaded.  Use the "file" command.

Hmm, okay it didn't take. Hopefully gdb's feedback will work.

(gdb) file hello_world
Load new symbol table from "/Users/you/c/hello_world"? (y or n) 

Then we enter "y" to load in the symbol table.

Reading symbols from /Users/you/c/hello_world...done.

We attempt to set the breakpoint again.

(gdb) break 5
No symbol table is loaded.  Use the "file" command.

Weaksauce, following gdb's advice didn't help.

Turns out we need to specify an option when compiling our program, -ggdb should get us what we need. The full command for our example looks like gcc hello_world.c -o hello_world -ggdb.

Now when we set a breakpoint we should see the following.

$ gdb hello_world
(gdb) break 72
Breakpoint 1 at 0x100000de5: file hello_word.c, line 5.

Woot, we can now debug our program! Hopefully this saved you some time and frustration. For more info on what debugging options that gcc supports look at the docs at gcc.gnu.org.

Say Thanks
Respond

4 Responses
Add your response

14156
125px flag of egypt.svg normal

If the modification time of your symbol file has changed since the last time gdb read its
symbols, gdb discards its symbol table, and reads it again. When it does this, gdb tries to
retain your current breakpoints.

you can try: (gdb) start

The ‘start’ command does the equivalent of setting a temporary breakpoint
at the beginning of the main procedure and then invoking the ‘run’ command.

over 1 year ago ·
17018
133628 181433525201431 100000043546024 644550 483296 o normal

thank you soo much

over 1 year ago ·
21215
0  1nutqbi191 jvgjtrvxtbi8pk3xjp jr c1tb3luvzmgclgyzq8pcvxgottyn1a1rntgrxkmezf

Thank you a lot. -rupanu

over 1 year ago ·
29140

Thanks, its very helpful!!

28 days ago ·
Filed Under