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)exec-file main.o (gdb)break 59 No symbol table is loaded. Use the "file" command.
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.
gcc on the compilation machine and
gdb on the testing machine have differing versions, you may be facing debuginfo format incompatibility.
To fix that, try downgrading the debuginfo format:
gcc -gdwarf-3 ... gcc -gdwarf-2 ... gcc -gstabs ... gcc -gstabs+ ... gcc -gcoff ... gcc -gxcoff ... gcc -gxcoff+ ...
gdb to the
gcc you're using.
I met this issue this morning because I used the same executable in DIFFERENT OSes: after compiling my program with
gcc -ggdb -Wall test.c -o test in my Mac(10.15.2), I ran
gdb with the executable in Ubuntu(16.04) in my VirtualBox.
Fix: recompile with the same command under Ubuntu, then you should be good.
I have the same problem and I followed this Post, it solved my problem.
Follow the following 2 steps:
-ggdbflag when compiling your program