2011年10月13日星期四

gdb调试的常用命令

gdb
file ./srl #调用可执行程序
set args -inputfile test.txt #设置参数
break SRL/srl.cpp:1105 #在srl.cpp的1105行设置断点
run #运行程序
print iNumSent #查看变量值

next (n)单步执行, 如有函数调用, 不会进入
step (s) 单步执行, 如有函数调用, 会进入
continue (c) 恢复继续执行, 程序结束或至个断点为止

disable 使所有的断点无效
disable 1使断点1无效
enable同样的道理

condition SRL/srl.cpp:1105 iNumSent==5, 设置条件断点
condition SRL/srl.cpp:1105, 取消条件断点

没有评论: