如何在 ddd (gdb) 中跳过过去的循环

发布于 2024-08-25 03:25:52 字数 99 浏览 3 评论 0原文

在许多(有时是大量的)使用 DDD 的调试会话中,我偶然发现了循环。我一直按“下一步”来跳过它,如果有很多迭代,我只是在它后面设置一个断点,然后按“继续”。还有其他方法可以跳过循环吗?

During many, sometimes inundating, debugging sessions using DDD, I stumble upon loops. And I keep pressing next to get past it, and if there are many iterations, I just set a break point right after it, and press "continue." Is there any other way to go past loops?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

撕心裂肺的伤痛 2024-09-01 03:25:52

您需要“until”命令 - 请参阅 http://www.gnu.org/ 上的 gdb 手册软件/gdb/文档

继续运行直到出现源代码行
越过当前行,在当前行中
到达堆栈帧。这个命令
用于避免单步执行
通过循环不止一次。这是
就像下一个命令一样,除了
当until遇到跳转时,
自动继续执行
直到程序计数器更大
比跳转的地址。

这意味着当你到达终点时
单步执行后的循环
它,直到让你的程序继续
执行直到退出循环。在
相比之下,最后的下一个命令
循环只是简单地返回到
循环的开始,这迫使
您将逐步完成下一步
迭代。

You want the "until" command - see the gdb manual at http://www.gnu.org/software/gdb/documentation:

Continue running until a source line
past the current line, in the current
stack frame, is reached. This command
is used to avoid single stepping
through a loop more than once. It is
like the next command, except that
when until encounters a jump, it
automatically continues execution
until the program counter is greater
than the address of the jump.

This means that when you reach the end
of a loop after single stepping though
it, until makes your program continue
execution until it exits the loop. In
contrast, a next command at the end of
a loop simply steps back to the
beginning of the loop, which forces
you to step through the next
iteration.

篱下浅笙歌 2024-09-01 03:25:52

我通常使用“继续到此处”,它在该位置设置临时断点并立即继续执行。可通过鼠标按钮 3 访问它,该按钮可打开一个弹出菜单。

I typically use the "continue until here" which sets a temporary breakpoint at that location and immediately continues execution. It is accessed via mouse button 3 which opens a popup menu.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文