c – 如何在GDB中跳过循环的多次迭代?

前端之家收集整理的这篇文章主要介绍了c – 如何在GDB中跳过循环的多次迭代?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
假设我有一个循环,将迭代100次,我想跳过50次迭代,但我想继续从那里按下以查看每一行.

我不想在循环之后设置断点,因为这样我将跳过所有迭代,而不仅仅是我想要的数字.

有没有办法在GDB中这样做?怎么样?

附:我不想从头到尾继续按下.这很费时间……

解决方法

在循环中设置断点,然后调用c 50继续50次

Debugging with GDB

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.

猜你在找的C&C++相关文章