本文共 815 字,大约阅读时间需要 2 分钟。
GDB初学
- 什么是GDB GDB(GNU symbolic debugger)简单地说就是一个调试工具。主要应用在Linux/Unix平台上。
- 如何使用GDB 2.1:首先让你的.c或.cpp文件以debug形式生成(这里的test.c 以及mytest都是自己touch的)
gcc -o mytest test.c -g "以debug形式生成mytest
gcc -o mytest test.c -g ".c文件以debug形式生成mytest g++ -o mytest test.cpp -g ".cpp文件以debug形式生成mytest gdb mytest "如果显示common not found 表示你没有安装gdb 这时你应该使用这个命令
yum install gcc gdb vim "然后让他装一会儿
- GDB的主要命令
b function 在function函数入口处打断点 next 单步跟踪,函数调用当作一条简单语句执行,可简写为n step 单步跟踪,函数调进入被调用函数体内,可简写为s until 在一个循环体内单步跟踪时,这个命令可以运行程序直到退出循环体,可简写为u。 转载地址:http://mvgbb.baihongyu.com/