无法从.gdbinit获取源文件

问题描述 投票:0回答:1

我有一个包含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中使用时会出错?

c gdb breakpoints gdbinit
1个回答
0
投票

一种解决方案是在处理.gdbinit之后加载断点。这可以通过-x option

完成
-x
© www.soinside.com 2019 - 2024. All rights reserved.