[NEWBIE] How to exit from a loop

Stefano Sabatini stefano.sabatini-lala@poste.it
Mon Jun 30 15:32:00 GMT 2008


Hi all,

suppose I'm debugging some code like this:

int i;
for (i=0; i < a_big_number; i++)
    do_something(i);

out_of_the_loop:
    do_something_else();

and I'd like to jump out of the loop.

What I did everytime is to simply put a breakpoint just after
out_of_the_loop and hit continue, then I need to unset the breakpoint.

I wonder if there is a more efficient way to exit from the loop,
without the need to set a breakpoint at the rigth place, continue and
then unset the breakpoint but with just a single command/macro.

Many thanks in advance, regards.



More information about the Gdb mailing list