微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

原文地址:https://www.jb51.cc/c/119678.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐