Viewing and changing variables at run-time is a huge part of debugging. Try giving functions invalid inputs or running other test cases to find the root of problems. Typically, you will view/set variables when the program is paused. print x Print current value of variable x. Being able to...
通过show values 可以显示历史中的最后10个值 举例 代码语言:javascript 复制 (gdb) show values $1 = 1431651824 $2 = 5 $3 = 10 $4 = 10 (gdb) 值的历史的访问变量和说明 变量 说明 $ 值历史中的最后一个值 $n 值历史的第n个值 $$ 值历史的倒数第二个值 $$n 值历史的倒数第n个值 $_ x...
watchpoints: 观察断点 watch [variable]: 监控变量 [variable] 当变量的值发生变化时命中该断点 watch [varibale_1] + [variable_2]: 监控两个变量值 watch(type)[address]: 通过内存地址间接设置断点 watch [variable] thread [thread_number]: 监控线程[number]修改变量时触发中断 info watchpoints: 查看数据...
(gdb) p num (gdb) print file::variable (gdb) print function::variable 1. 2. 3. 4. 其中file用于指定具体的文件名,funciton 用于指定具体所在函数的函数名,variable表示要查看的目标变量或表达式。 另外,print也可以打印出类或者结构体变量的值。 (2)打印数组 查看一段连续的内存空间的值。比如数组的一...
6.1 set variable 变量=值 7. 使中断失效或有效 === disable / enable 7.1 disable 断点编号 可以使某个断点失效 如diable main 可使break main 命令失效 7.2 enable 断点编号 可以使某个断点恢复有效 8. 删除断点 ===clean / delete disable只是让某个断点暂时失效,断点依然存在于程序中.如果要彻底删除某个...
~"There is absolutely no warranty for GDB. Type \"show warranty\" for details.\ n" ~"This GDB was configured as \"i686-pc-cygwin\"." ~"\n" (gdb) quit &"quit\n" D:\exercise\c\test> mi的命令总共分为以下几个部分: 1.断点(Breakpoint) ...
value.h varobj-iter.h varobj.c varobj.h vax-bsd-nat.c vax-netbsd-tdep.c vax-tdep.c vax-tdep.h version.in windows-nat.c windows-nat.h windows-tdep.c windows-tdep.h x86-bsd-nat.c x86-bsd-nat.h x86-fbsd-nat.c x86-fbsd-nat.h x86-gnu-nat.c x86-linux-nat.c x86-linux-nat...
show paths 查看程序的运行路径。 set environment varname [=value] 设置环境变量。如:set env USER=hchen show environment [varname] 查看环境变量。 8.观察点(WatchPoint) 观察点一般来观察某个表达式(变量也是一种表达式)的值是否有变化了,如果有变化,马上停住程 序。我们有下面的几种方法来设置观察点: ...
(gdb)show args 命令可以查看设置好的运行参数。 2、其他参数 3.5 常用的调试步骤 1、断点的添加 使用break 或者b命令 2、断点的删除 3、程序运行进度调试 (1)连续执行程序,直到遇到断点 (gdb)run|r (2)继续执行程序,直到下个断点 (gdb) continue|c ...
show print pretty 查看GDB是如何显示结构体的 set print array set print array on 打开数组显示,打开后当数组显示时,每个元素占一行,如果不打开的话,每个元素则以逗号分隔。这个选项默认是关闭的 set print null-stop <on/off> 如果打开了这个选项,那么当显示字符串时,遇到结束符则停止显示。这个选项默认为off...