* [NEWBIE] How to exit from a loop
@ 2008-06-30 15:32 Stefano Sabatini
2008-06-30 15:36 ` Daniel Jacobowitz
2008-06-30 15:36 ` Andreas Schwab
0 siblings, 2 replies; 3+ messages in thread
From: Stefano Sabatini @ 2008-06-30 15:32 UTC (permalink / raw)
To: gdb Mailing List
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.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [NEWBIE] How to exit from a loop
2008-06-30 15:32 [NEWBIE] How to exit from a loop Stefano Sabatini
@ 2008-06-30 15:36 ` Daniel Jacobowitz
2008-06-30 15:36 ` Andreas Schwab
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2008-06-30 15:36 UTC (permalink / raw)
To: gdb Mailing List
On Mon, Jun 30, 2008 at 05:33:11PM +0200, Stefano Sabatini wrote:
> 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.
Sure - take a look at the "advance" and "until" commands.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [NEWBIE] How to exit from a loop
2008-06-30 15:32 [NEWBIE] How to exit from a loop Stefano Sabatini
2008-06-30 15:36 ` Daniel Jacobowitz
@ 2008-06-30 15:36 ` Andreas Schwab
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2008-06-30 15:36 UTC (permalink / raw)
To: gdb Mailing List
Stefano Sabatini <stefano.sabatini-lala@poste.it> writes:
> 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.
(gdb) help until
Execute until the program reaches a source line greater than the current
or a specified location (same args as break command) within the current frame.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-06-30 15:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-30 15:32 [NEWBIE] How to exit from a loop Stefano Sabatini
2008-06-30 15:36 ` Daniel Jacobowitz
2008-06-30 15:36 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox