本文介绍了无法在.gdbinit中设置挂起的断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
gdb-6.8如果程序或库未加载,手动设置挂起断点的操作很奇怪,但不能通过 .gdbinit
。
[手动方式]
(gdb )break foo.cc:111
没有名为foo.cc的源文件。
在将来的共享库加载时使断点处于待处理状态? (y或[n])y
断点1(foo.cc)挂起。
(gdb)info break
Num Type Disp Enb Address什么
1断点保持y< PENDING> foo.cc
(gdb)运行myprogram
[gdbinit way]
Add .gdbinit
$ b
在$ b $上设置断点b break foo.cc:111
启动时Gdb显示下面的错误。
> gdb myprogram
(输入gdb shell)
/home/<username>/.gdbinit:2:源文件中的错误:
没有加载符号表。使用文件命令。
解决方案
这是一个在2008年修复的错误,升级你的gdb或使用/移植修复问题的以下补丁。
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.
pending breakpoints without any symbols loaded yet
这篇关于无法在.gdbinit中设置挂起的断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!