按行号打断点gdb main
按函数名打断点break 7
启动程序break anyFunctionWithSourceCode
带参数启动run
打印变量run -c config.json
变量赋值print I_am_a_int
调用函数,打印返回值set I_am_a_int = 5
print compute_sum(I_am_a_int , I_am_a_int)
如果报错
Cannot resolve function compute_sum to any overloaded instance
输入
set overload-resolution off
注意函数参数必须是已在内存里的变量
否则报错
Attempt to take address of value not located in memory
后续介绍如何调试一个会崩溃的程序,通过查询堆栈定位崩溃点
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)