Unable to set pending breakpoints in .gdbinit

2019-08-11 09:39发布

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.

1条回答
你好瞎i
2楼-- · 2019-08-11 10:17

This is a bug which was fixed in 2008, try upgrading your gdb or using/porting the following patch that fixed the problem.

pending breakpoints without any symbols loaded yet

查看更多
登录 后发表回答