gdb: "No symbol table is loaded"

c gdb
user994165 picture user994165 · Feb 12, 2012 · Viewed 191.1k times · Source

I keep getting this error mesage when trying to add a breakpoint in gdb.

I've used these commands to compile:

gcc -g main.c utmpib2.c -o main.o
and:
cc -g main.c utmpib2.c -o main.o
and also:
g++ -g main.c utmpib2.c -o main.o

I also tried "-ggdb" instead of "-g" and I still get that error message.

I then execute gdb:

$gdb

In gdb:

(gdb)exec-file main.o
(gdb)break 59
No symbol table is loaded. Use the "file" command.

Answer

kralex picture kralex · Oct 9, 2012

You have to add extra parameter -g, which generates source level debug information. It will look like:

gcc -g prog.c

After that you can use gdb in common way.