gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 16:46:23 24 4
gpt4 key购买 nike

假设我有一个将迭代 100 次的循环,我想跳过 50 次迭代,但我想从那里继续按 next 以查看每一行。

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

有没有办法在 GDB 中做到这一点?怎么办?

附言我不想从头到尾一直按 next。这很耗时...

最佳答案

在循环中设置断点,然后调用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 - 如何跳过 GDB 中循环的多次迭代?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27388729/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com