GDB常用命令与Visual Studio对比
其他
2018-11-02 21:31:24
阅读次数: 0
两种调试器的字检查功能一览表
命令名称 |
GDB |
Visual Studio |
运行程序 |
runs [args] |
F5:Start Debugging (开始调试) |
启动程序 |
start [atgs] |
F10:Step over (逐过程) |
暂停 |
Ctrl+C |
Ctrl-Alt+Break:Break All (全部中断) |
继续运行 |
continue(cont, c) |
F5:Continue (继续) |
step over |
next |
F10:Step over (逐过程) |
step into |
step |
F11:Step into (逐语句) |
step out |
finish |
F11:Step into ; Shift+F11:Step out |
断点 |
break file:lineno |
右击Breakpoint/Insert Breakpoint (断点/插入断点) |
跟踪点 |
watch file:lineno |
右击Breakpoint/Insert Tracepoint (断点/插入跟踪点) |
观察点 |
watch expr |
Debug/New Bkpt/New Dat Bkpt (调试/新建断点/新建数据断点) |
栈跟踪 |
backtrace(bt), where |
Call Stack (条用堆栈) |
输出表达式 |
print expr |
Immediate Window (及时窗口) |
显示表达式 |
display expr |
Watch 监视窗口 |
设置环境 |
set var var=expr |
Variables 变量窗口 |
设置环境变量 |
set env var[=val] |
Properties/Debugging/Environment (属性/调试/环境) |
显示机器代码 |
disassemble |
右击Go to Disassembly (转到反汇编) |
在机器代码中执行step-over |
nexti |
F10:Step over |
在机器代码中执行step-into |
stepi |
F11:Step into |
其他常用调试命令
命令名称 |
GDB |
Visual Studio |
命令名称 |
GDB |
Visual Studio |
条件断点 |
conditon bnum |
右击Breakpoint/Condition |
事件断点 |
handle, signal |
Debug/Exceptions…(调试\异常) |
异常断点 |
catch, throw |
|
函数断点 |
break function |
Debug/New Bkpt/Break at function |
临时断点 |
tbreak |
|
列出所有断点 |
info breakpoints |
F9:Debug/Toggle Brkp,断点窗口 |
将命令连接到断点 |
command bnum |
右击Brkp/When hit(断点/命中条件) |
输出到命令行 |
printf |
右击Brkp/When hit(断点/命中条件) |
查找函数 |
info function expr |
Debug/New Brkp/Break at function |
调用函数 |
call expr |
|
修改函数返回值 |
return expr |
Immediate Window |
输出类型 |
whatis arg |
右击Go to Declaration(转到声明) |
输出类型描述 |
ptype arg |
右击Go to Definition(转到定义) |
输出内存内容 |
x arg |
|
选择帧栈 |
info fram, fram arg |
|
转载自blog.csdn.net/mergerly/article/details/83343194