gdb-执行命令n次 [英] gdb - perform a command n times
问题描述
我正在使用gdb调试器运行其中包含循环的程序(让我们坐下10个). 当我进入循环时,我不想进入循环.我知道我可以在循环后创建第二个断点,而不是c(继续).但是我也记得有可能做类似n 10的事情(下10次). n 10不起作用(gdb并没有说我做错了什么,但是没有达到我的期望).
I am using the gdb debugger to run a program that has a loop in it (let's sat of 10). When I get to the loop, I don't want to go into it. I know I can make a second breakpoint after the loop and than do c (continue). But I also remember there is a possibility to do something like n 10 (next 10 times). n 10 doesn't work (gdb doesn't say I've done something wrong, but it doesn't do what I am expecting).
是否可以运行命令n次?
Is it possible to run a command n times?
推荐答案
您知道命令until
吗?
尝试使用它直到X行.
示例:
(gdb) until 123
或
(gdb) u 123
(gdb) help until
执行直到程序到达源代码行 大于当前位置或指定位置(args与break相同) 命令).
Execute until the program reaches a source line greater than the current or a specified location (same args as break command) within the current frame.
这篇关于gdb-执行命令n次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!