gdb调试断点的保存
2014-06-09 17:53
260 查看
今天使用gdb调试了一整天,在好多关键的地方添加了断点,快要下班的时候,因为要关闭远程连接,为了便于明天继续测试,我想把所有的断点都 保存下来。但是因为断点太多了,使用“info b”虽然可以查看到断点,但是,断点的位置得自己找出来,然后保存,感觉有点麻烦。
上网想查看一下gdb是否有保存断点的方式,不过值搜到了“python 保存断点”的方法,看到使用“save breakpoints”命令,所以我来到gdb调试环境,查看了gdb是否有参数“save”,如下:
看到的确有“save breakpoints ”,禁不住窃喜,使用help查看该命令的含义:
看了一下解释,果然可以满足我的要求——把所有的断点进行保存,保存到“gdb.cfg”中,如下:
最前面的是显示的行号,可以看到,我的断点的确保存了。
我又仔细看了一下上面的对于“save breakpoints”的注释,在另一个gdb session中可以使用“source”命令restore(恢复,还原)它们(断点)。测试一下:先删除所有断点,然后使用source恢复所有保存的断点,如下:
多看一眼说明文档,又学到一个新的技巧,记录下来,希望对大家有帮助。
扩展阅读: http://ccshell.com/archives/92.html python 保存断点
(gdb) info b Num Type Disp Enb Address What 1 breakpoint keep y 0x000000000040336d in main(int, char**) at RecvMain.cpp:290 breakpoint already hit 1 time 2 breakpoint keep y 0x00002aaab049c7ef in CRealCreditEventAb::LoopEventCreditCtrl(int) ……
上网想查看一下gdb是否有保存断点的方式,不过值搜到了“python 保存断点”的方法,看到使用“save breakpoints”命令,所以我来到gdb调试环境,查看了gdb是否有参数“save”,如下:
(gdb) save "save" must be followed by the name of a save subcommand. List of save subcommands: save breakpoints -- Save current breakpoint definitions as a script save gdb-index -- Save a save tracepoints -- Save current tracepoint definitions as a script Type "help save" followed by save subcommand name for full documentation. Type "apropos word" to search for commands related to "word". Command name abbreviations are allowed if unambiguous. (gdb)
看到的确有“save breakpoints ”,禁不住窃喜,使用help查看该命令的含义:
(gdb) help save breakpoints Save current breakpoint definitions as a script. This includes all types of breakpoints (breakpoints, watchpoints, catchpoints, tracepoints). Use the 'source' command in another debug session to restore them. (gdb)
看了一下解释,果然可以满足我的要求——把所有的断点进行保存,保存到“gdb.cfg”中,如下:
(gdb) save breakpoints gdb.cfg Saved to file 'gdb.cfg'. (gdb) ^Z [1]+ Stopped gdb RecvMain [billing_dx@bmcs1 creditctl]$vi gdb.cfg 1 break main 2 break CRealCreditEventAb::LoopEventCreditCtrl 3 break AssignStopTask ……
最前面的是显示的行号,可以看到,我的断点的确保存了。
我又仔细看了一下上面的对于“save breakpoints”的注释,在另一个gdb session中可以使用“source”命令restore(恢复,还原)它们(断点)。测试一下:先删除所有断点,然后使用source恢复所有保存的断点,如下:
(gdb) D #删除所有断点 Delete all breakpoints? (y or n) y (gdb) info b #查看断点 No breakpoints or watchpoints. (gdb) source gdb.cfg #加载断点 Breakpoint 9 at 0x40336d: file RecvMain.cpp, line 290. Breakpoint 10 at 0x2aaab049c7ef: file CRealCreditEventAb.cpp, line 80. …… (gdb) info b #查看断点 Num Type Disp Enb Address What 9 breakpoint keep y 0x000000000040336d in main(int, char**) at RecvMain.cpp:290 10 breakpoint keep y 0x00002aaab049c7ef in CRealCreditEventAb::LoopEventCreditCtrl(int) at CRealCreditEventAb.cpp:80 ……
多看一眼说明文档,又学到一个新的技巧,记录下来,希望对大家有帮助。
扩展阅读: http://ccshell.com/archives/92.html python 保存断点
相关文章推荐
- Eclipse替代ndk-gdb断点调试Android NDK程序
- gdb调试之断点篇
- gdb断点调试的两个技巧-condition和ignore
- Android中app调试:gdb如何在动态链接库中设断点
- 单纯gdb调试android的so断点
- GDB和LLDB断点调试指令
- Linux启动gdb调试模式二——断点调试
- gdb调试宏、条件断点、命令行参数
- linux下的gdb调试工具--断点调试
- Linux高级编程--04.GDB调试程序(设置断点)
- 一起talk GDB吧(第三回:GDB断点调试)
- gdb如何保存和读取断点
- gdb调试--汇编指令处断点
- GDB 多线程调试:只停止断点的线程,其他线程任然执行; 或只运行某些线程 其他线程中断
- gdb如何保存和读取断点
- gdb调试(二)断点设置(英文板)
- gdb调试断点不生效问题
- GDB 调试积累心得,断点,查栈,下一步,跳入,跳出等简单操作
- gdb保存断点信息问题
- 随笔—gdb调试多文件工程加断点