GDB是什么东西
GDB调试器, 可以运行你在程序运行时检查里面到底发生了什么
GDB可以做:
- 开始并设置参数
- 可以打断点,在特殊情况下停止
- 当你程序停止,检查发生了什么
搭建实验环境安装GBD
安装gdb
yum install gdb
检查gdb是否成功安装
gdb --version
Here are some of the most frequently needed GDB commands:(来自官方文件)
break [file:]function
Set a breakpoint at function (in file).
run [arglist]
Start your program (with arglist, if specified).
bt Backtrace: display the program stack.打断点
print expr
Display the value of an expression.
c Continue running your program (after stopping, e.g. at a
breakpoint).