开发者

How to skip past loops in ddd (gdb)

开发者 https://www.devze.com 2022-12-22 23:19 出处:网络
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

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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号