我有一个包含GDB断点的文件~/.gdb_bps
。我用save breakpoints .gdb_bps
生成了这个文件。我正在尝试在GDB启动时通过将此行添加到~/.gdbinit
:
source .gdb_bps
启动GDB时出现错误:
No symbol table is loaded. Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
但是,在GDB会话期间的采购工作按预期进行:
(gdb) source .gdb_bps
Breakpoint 1 at 0x401227: file test/varargs2_test.c, line 22.
Breakpoint 2 at 0x4012a3: file test/varargs2_test.c, line 27.
Breakpoint 3 at 0x40117b: file test/varargs2_test.c, line 9.
Breakpoint 4 at 0x401256: file test/varargs2_test.c, line 25.
我的问题是为什么source .gdb_bps
在~/.gdbinit
中使用时会出错?
一种解决方案是在处理.gdbinit之后加载断点。这可以通过-x
option:
-x