【发布时间】:2017-01-02 19:31:01
【问题描述】:
抱歉标题不伦不类,想不出更好的了。
当我通过 GDB 运行我的程序以查找分段错误时,我得到 数千 行这样的垃圾:
(gdb) step
_IO_new_file_xsputn (f=0x76fa0b40 <_IO_2_1_stdout_>, data=0x7efff284, n=7) at fileops.c
1279 fileops.c: No such file or directory.
(gdb) step
1273 in fileops.c
(gdb) step
1279 in fileops.c
(gdb) step
1286 in fileops.c
(gdb) step
1288 in fileops.c
(gdb) step
1289 in fileops.c
(gdb) step
1292 in fileops.c
(gdb) step
1294 in fileops.c
(gdb) step
1292 in fileops.c
...不断地不断地。它使调试非常变得困难和乏味,因为:
- 我必须重复输入
step(或按Enter)。 - 我几乎看不到程序的输出,因为它隐藏在无意义的信息中。
- 如果我反复按 Enter,我经常会错过我正在寻找的 Seg Fault。
如何让 gdb 停止打印这样的行?
1273 in fileops.c
我可以使用一些配置文件或命令行选项吗?
【问题讨论】:
-
您确定需要单步执行
fileops.c中的glibc 代码吗?您可以只finish退出_IO_new_file_xsputn函数并继续调试您的代码。 -
@ks1322 我想这就是我要找的;我很快就会试试看。你可以把它放在答案中吗?
-
相关:Preventing GDB from stepping into a function (or file)。请参阅
skip命令。