gdb-6.8
In case of the program or library is not loaded, it's weird that manually setting pending breakpoints works, but not through .gdbinit
. What could be wrong?
[Manual way]
(gdb) break foo.cc:111
No source file named foo.cc.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (foo.cc) pending.
(gdb) info break
Num Type Disp Enb Address What
1 breakpoint keep y <PENDING> foo.cc
(gdb) run myprogram
[gdbinit way]
Add these 2 lines in .gdbinit
set breakpoint pending on
break foo.cc:111
Gdb shows below error upon launching.
> gdb myprogram
(enter gdb shell)
/home/<username>/.gdbinit:2: Error in sourced command file:
No symbol table is loaded. Use the "file" command.
This is a bug which was fixed in 2008, try upgrading your gdb or using/porting the following patch that fixed the problem.