假设我有一个循环,将迭代100次,我想跳过50次迭代,但我想继续从那里按下以查看每一行.
我不想在循环之后设置断点,因为这样我将跳过所有迭代,而不仅仅是我想要的数字.
有没有办法在GDB中这样做?怎么样?
附:我不想从头到尾继续按下.这很费时间……
解决方法
在循环中设置断点,然后调用c 50继续50次
5.2 Continuing and stepping
continue [ignore-count] c [ignore-count] fg [ignore-count] Resume program execution,at the address where your program last stopped; any breakpoints set at that address are bypassed. The optional argument ignore-count allows you to specify a further number of times to ignore a breakpoint at this location; its effect is like that of ignore (see section Break conditions). The argument ignore-count is meaningful only when your program stopped due to a breakpoint. At other times,the argument to continue is ignored.