让GDB保存断点列表 [英] Getting GDB to save a list of breakpoints
问题描述
好, 信息中断 列表断点,但格式不适合使用--command 此问题中的重用它们的格式 。 GDB是否有一种方法可以将它们转储到可以再次输入的文件中?有时在调试会话中,有必要在建立一组用于测试的断点之后重新启动GDB。
OK, info break lists the breakpoints, but not in a format that would work well with reusing them using the --command as in this question. Does GDB have a method for dumping them into a file acceptable for input again? Sometimes in a debugging session, it is necessary to restart GDB after building up a set of breakpoints for testing.
.gdbinit文件与--command一样存在问题。 info break 命令没有列出命令,而是一个供人类使用的表。
The .gdbinit file has the same problem as --command. The info break command does not list commands, but rather a table for human consumption.
为详细说明,以下是的示例info break :
(gdb) info break
Num Type Disp Enb Address What
1 breakpoint keep y 0x08048517 <foo::bar(void)+7>
推荐答案
从GDB 7.2(2011-08-23)开始,您现在可以使用 保存断点 命令。
As of GDB 7.2 (2011-08-23) you can now use the save breakpoints command.
save breakpoints <filename>
Save all current breakpoint definitions to a file suitable for use
in a later debugging session. To read the saved breakpoint
definitions, use the `source' command.
使用 source< filename>
可以从文件中恢复保存的断点。
Use source <filename>
to restore the saved breakpoints from the file.
这篇关于让GDB保存断点列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!