【Linux开发】GDB的使用

1、GDB常用命令及缩写:

https://blog.csdn.net/gnuhpc/article/details/4368831

https://www.jianshu.com/p/6cdd79ed7dfb

https://www.cnblogs.com/me115/p/3837960.html

 

2、How to Debug C Program using gdb in 6 Simple Steps:

https://www.thegeekstuff.com/2010/03/debug-c-program-using-gdb/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%253A+TheGeekStuff+%2528The+Geek+Stuff%2529#commentform

 

3、GDB保存断点信息

GDB下命令 save xxx 可以保存当前的断点等环境为脚本文件xxx,help命令查看save breakpoint的详细信息:

(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.

使用 source xxx 命令用于加载之前保存过的脚本文件,其实脚本文件中保存的其实就是GDB的命令集,source命令加载脚本文件之后GDB会依次执行脚本中的命令,包括创建断点等等工作,所以我们可以为每一个工程创建 一个GDB脚本,用于保存所有的断点等配置信息。

猜你喜欢

转载自blog.csdn.net/tq384998430/article/details/100582851