ashish
ashish

Reputation: 943

gdb scripting restart continue while loop

What is the equivalent of continue in gdb scripts? I tried using loop_continue but it didn't work. Gdb threw error saying undefined command.

I want something like

    while $thr
     if $thr->procedureId != 28
        set $thr = $thr->cnext
         loop_continue; // this doesn't work
     end
     print $thr
     set $thr = $thr->cnext
   end

Upvotes: 0

Views: 686

Answers (1)

Tom Tromey
Tom Tromey

Reputation: 22549

The problem here, surprisingly, is the ;. For me this causes gdb to say:

Undefined command: "loop_continue". Try "help".

However, if I leave out the ;, it works:

(gdb) set $x = 0
(gdb) while $x < 5
 >if $x < 3
  >set $x = 72
  >loop_continue
  >end
 >end
(gdb) print $x
$1 = 72

Upvotes: 2

Related Questions