* Behavior of 'until' command
@ 2002-11-13 11:26 Elena Zannoni
2002-11-13 11:33 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: Elena Zannoni @ 2002-11-13 11:26 UTC (permalink / raw)
To: gdb
The documenation says that 'until' does this:
"@item until
Continue running until a source line past the current line, in the
current stack frame, is reached. [...]@code{until} always stops your
program if it attempts to exit the current stack frame.
[...]
@item until @var{location}
Continue running your program until either the specified location is
reached, or the current stack frame returns. @var{location} is any of
the forms of argument acceptable to @code{break}. This form of the
command uses breakpoints, and hence is quicker than @code{until}
without an argument."
Note the 'will not exit the current stak frame' business.
However, nobody forbids you from saying "until foo" (since that's an
OK argument for break as well). And foo can be any function, called
by the current frame or not.
It is not clear to me what the doco describes as gdb's
behavior. Concrete example below:
1 static int x;
2
3 int fun ()
4 {
5 x = 1;
6 }
7
8 int fun2 ()
9 {
10 x = 4;
11 }
12
13 void foo()
14 {
15 x = x + 5;
16 fun2 ();
17 }
18 int main (int ac, char **av)
19 {
20 x = 3;
21 foo ();
22 fun ();
23 x = 3;
24 return 0;
25 }
If I am in 'foo' at line 15,and enter the command 'until fun', I
would expect to end up ... where? At line 22? Or should I end up at
line 5? Right now gdb ends up at 22, i.e. doesn't enter 'fun'. I think
it is consistent with the doco.
Similarly from foo line 15 where should 'until fun2' take me? Inside
fun2, at line 10? Or at line 16? Currently I end up at line 22 which
is in main. This seems clearly wrong either way.
Any thoughts?
Elena
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: Behavior of 'until' command
2002-11-13 11:26 Behavior of 'until' command Elena Zannoni
@ 2002-11-13 11:33 ` Daniel Jacobowitz
2002-11-13 11:42 ` Andrew Cagney
2002-11-13 12:34 ` Elena Zannoni
0 siblings, 2 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2002-11-13 11:33 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb
On Wed, Nov 13, 2002 at 02:19:35PM -0500, Elena Zannoni wrote:
>
> The documenation says that 'until' does this:
>
> "@item until
> Continue running until a source line past the current line, in the
> current stack frame, is reached. [...]@code{until} always stops your
> program if it attempts to exit the current stack frame.
> [...]
>
> @item until @var{location}
> Continue running your program until either the specified location is
> reached, or the current stack frame returns. @var{location} is any of
> the forms of argument acceptable to @code{break}. This form of the
> command uses breakpoints, and hence is quicker than @code{until}
> without an argument."
>
> Note the 'will not exit the current stak frame' business.
>
> However, nobody forbids you from saying "until foo" (since that's an
> OK argument for break as well). And foo can be any function, called
> by the current frame or not.
>
> It is not clear to me what the doco describes as gdb's
> behavior. Concrete example below:
>
> 1 static int x;
> 2
> 3 int fun ()
> 4 {
> 5 x = 1;
> 6 }
> 7
> 8 int fun2 ()
> 9 {
> 10 x = 4;
> 11 }
> 12
> 13 void foo()
> 14 {
> 15 x = x + 5;
> 16 fun2 ();
> 17 }
> 18 int main (int ac, char **av)
> 19 {
> 20 x = 3;
> 21 foo ();
> 22 fun ();
> 23 x = 3;
> 24 return 0;
> 25 }
>
>
> If I am in 'foo' at line 15,and enter the command 'until fun', I
> would expect to end up ... where? At line 22? Or should I end up at
> line 5? Right now gdb ends up at 22, i.e. doesn't enter 'fun'. I think
> it is consistent with the doco.
>
> Similarly from foo line 15 where should 'until fun2' take me? Inside
> fun2, at line 10? Or at line 16? Currently I end up at line 22 which
> is in main. This seems clearly wrong either way.
>
> Any thoughts?
Your reading sounds right to me. If you look at the output of 'set
debug target 1' in your example, we set and hit the breakpoint in fun2
and then decide to continue for some reason - that's got to be a bug.
If you have a chance this would make a great testcase.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: Behavior of 'until' command
2002-11-13 11:33 ` Daniel Jacobowitz
@ 2002-11-13 11:42 ` Andrew Cagney
2002-11-13 12:35 ` Elena Zannoni
2002-11-13 12:34 ` Elena Zannoni
1 sibling, 1 reply; 9+ messages in thread
From: Andrew Cagney @ 2002-11-13 11:42 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Elena Zannoni, gdb
> Similarly from foo line 15 where should 'until fun2' take me? Inside
>> fun2, at line 10? Or at line 16? Currently I end up at line 22 which
>> is in main. This seems clearly wrong either way.
>>
>> Any thoughts?
>
>
> Your reading sounds right to me. If you look at the output of 'set
> debug target 1' in your example, we set and hit the breakpoint in fun2
> and then decide to continue for some reason - that's got to be a bug.
>
> If you have a chance this would make a great testcase.
In fact I'm sure it once worked? Being able to use `until fun2' in
cases like:
foo ()
{
return (a + b + foo() + bar() + fun2(bar(bax))));
}
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: Behavior of 'until' command
2002-11-13 11:42 ` Andrew Cagney
@ 2002-11-13 12:35 ` Elena Zannoni
2002-11-14 0:19 ` Pierre Muller
2002-11-14 11:58 ` Eli Zaretskii
0 siblings, 2 replies; 9+ messages in thread
From: Elena Zannoni @ 2002-11-13 12:35 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Daniel Jacobowitz, Elena Zannoni, gdb
Andrew Cagney writes:
> > Similarly from foo line 15 where should 'until fun2' take me? Inside
> >> fun2, at line 10? Or at line 16? Currently I end up at line 22 which
> >> is in main. This seems clearly wrong either way.
> >>
> >> Any thoughts?
> >
> >
> > Your reading sounds right to me. If you look at the output of 'set
> > debug target 1' in your example, we set and hit the breakpoint in fun2
> > and then decide to continue for some reason - that's got to be a bug.
> >
> > If you have a chance this would make a great testcase.
>
> In fact I'm sure it once worked? Being able to use `until fun2' in
> cases like:
>
> foo ()
> {
> return (a + b + foo() + bar() + fun2(bar(bax))));
> }
>
Yes. So all agree that
"until fun2" == "break fun2; continue" ??
Elena
> Andrew
>
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: Behavior of 'until' command
2002-11-13 12:35 ` Elena Zannoni
@ 2002-11-14 0:19 ` Pierre Muller
2002-11-14 8:59 ` Elena Zannoni
2002-11-14 11:58 ` Eli Zaretskii
1 sibling, 1 reply; 9+ messages in thread
From: Pierre Muller @ 2002-11-14 0:19 UTC (permalink / raw)
To: Elena Zannoni, Andrew Cagney; +Cc: Daniel Jacobowitz, gdb
At 21:28 13/11/2002, Elena Zannoni wrote:
>Andrew Cagney writes:
> > > Similarly from foo line 15 where should 'until fun2' take me? Inside
> > >> fun2, at line 10? Or at line 16? Currently I end up at line 22 which
> > >> is in main. This seems clearly wrong either way.
> > >>
> > >> Any thoughts?
> > >
> > >
> > > Your reading sounds right to me. If you look at the output of 'set
> > > debug target 1' in your example, we set and hit the breakpoint in fun2
> > > and then decide to continue for some reason - that's got to be a bug.
> > >
> > > If you have a chance this would make a great testcase.
> >
> > In fact I'm sure it once worked? Being able to use `until fun2' in
> > cases like:
> >
> > foo ()
> > {
> > return (a + b + foo() + bar() + fun2(bar(bax))));
> > }
> >
>
>Yes. So all agree that
>
>"until fun2" == "break fun2; continue" ??
Isn't there still a difference, in thesense that
if you leave the current frame without calling fun2,
that we stop at the calling frame and remove the breakpoint
that exists for fun2.
But I assume that you didn't mean that the
break fun2 should survive after leaving the frame...
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: Behavior of 'until' command
2002-11-14 0:19 ` Pierre Muller
@ 2002-11-14 8:59 ` Elena Zannoni
0 siblings, 0 replies; 9+ messages in thread
From: Elena Zannoni @ 2002-11-14 8:59 UTC (permalink / raw)
To: Pierre Muller; +Cc: Elena Zannoni, Andrew Cagney, Daniel Jacobowitz, gdb
Pierre Muller writes:
> At 21:28 13/11/2002, Elena Zannoni wrote:
> >Andrew Cagney writes:
> > > > Similarly from foo line 15 where should 'until fun2' take me? Inside
> > > >> fun2, at line 10? Or at line 16? Currently I end up at line 22 which
> > > >> is in main. This seems clearly wrong either way.
> > > >>
> > > >> Any thoughts?
> > > >
> > > >
> > > > Your reading sounds right to me. If you look at the output of 'set
> > > > debug target 1' in your example, we set and hit the breakpoint in fun2
> > > > and then decide to continue for some reason - that's got to be a bug.
> > > >
> > > > If you have a chance this would make a great testcase.
> > >
> > > In fact I'm sure it once worked? Being able to use `until fun2' in
> > > cases like:
> > >
> > > foo ()
> > > {
> > > return (a + b + foo() + bar() + fun2(bar(bax))));
> > > }
> > >
> >
> >Yes. So all agree that
> >
> >"until fun2" == "break fun2; continue" ??
>
>
> Isn't there still a difference, in thesense that
> if you leave the current frame without calling fun2,
> that we stop at the calling frame and remove the breakpoint
> that exists for fun2.
> But I assume that you didn't mean that the
> break fun2 should survive after leaving the frame...
Yes, if the current function finishes, you stop at the caller. And may
not reach fun2 ever.
Elena
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Behavior of 'until' command
2002-11-13 12:35 ` Elena Zannoni
2002-11-14 0:19 ` Pierre Muller
@ 2002-11-14 11:58 ` Eli Zaretskii
1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2002-11-14 11:58 UTC (permalink / raw)
To: ezannoni; +Cc: ac131313, drow, gdb
> From: Elena Zannoni <ezannoni@redhat.com>
> Date: Wed, 13 Nov 2002 15:28:25 -0500
>
> So all agree that
>
> "until fun2" == "break fun2; continue" ??
Yes, I agree.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Behavior of 'until' command
2002-11-13 11:33 ` Daniel Jacobowitz
2002-11-13 11:42 ` Andrew Cagney
@ 2002-11-13 12:34 ` Elena Zannoni
2002-11-13 12:40 ` Daniel Jacobowitz
1 sibling, 1 reply; 9+ messages in thread
From: Elena Zannoni @ 2002-11-13 12:34 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Elena Zannoni, gdb
Daniel Jacobowitz writes:
> On Wed, Nov 13, 2002 at 02:19:35PM -0500, Elena Zannoni wrote:
> >
> > The documenation says that 'until' does this:
> >
> > "@item until
> > Continue running until a source line past the current line, in the
> > current stack frame, is reached. [...]@code{until} always stops your
> > program if it attempts to exit the current stack frame.
> > [...]
> >
> > @item until @var{location}
> > Continue running your program until either the specified location is
> > reached, or the current stack frame returns. @var{location} is any of
> > the forms of argument acceptable to @code{break}. This form of the
> > command uses breakpoints, and hence is quicker than @code{until}
> > without an argument."
> >
> > Note the 'will not exit the current stak frame' business.
> >
> > However, nobody forbids you from saying "until foo" (since that's an
> > OK argument for break as well). And foo can be any function, called
> > by the current frame or not.
> >
> > It is not clear to me what the doco describes as gdb's
> > behavior. Concrete example below:
> >
> > 1 static int x;
> > 2
> > 3 int fun ()
> > 4 {
> > 5 x = 1;
> > 6 }
> > 7
> > 8 int fun2 ()
> > 9 {
> > 10 x = 4;
> > 11 }
> > 12
> > 13 void foo()
> > 14 {
> > 15 x = x + 5;
> > 16 fun2 ();
> > 17 }
> > 18 int main (int ac, char **av)
> > 19 {
> > 20 x = 3;
> > 21 foo ();
> > 22 fun ();
> > 23 x = 3;
> > 24 return 0;
> > 25 }
> >
> >
> > If I am in 'foo' at line 15,and enter the command 'until fun', I
> > would expect to end up ... where? At line 22? Or should I end up at
> > line 5? Right now gdb ends up at 22, i.e. doesn't enter 'fun'. I think
> > it is consistent with the doco.
> >
> > Similarly from foo line 15 where should 'until fun2' take me? Inside
> > fun2, at line 10? Or at line 16? Currently I end up at line 22 which
> > is in main. This seems clearly wrong either way.
> >
> > Any thoughts?
>
> Your reading sounds right to me. If you look at the output of 'set
> debug target 1' in your example, we set and hit the breakpoint in fun2
> and then decide to continue for some reason - that's got to be a bug.
So do you agree that 'until fun2' should stop inside fun2, just like
"break fun2;continue" would? If so I have a fix.
>
> If you have a chance this would make a great testcase.
>
yes, this testcase is not in the testsuite.
Elena
> --
> Daniel Jacobowitz
> MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: Behavior of 'until' command
2002-11-13 12:34 ` Elena Zannoni
@ 2002-11-13 12:40 ` Daniel Jacobowitz
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2002-11-13 12:40 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb
On Wed, Nov 13, 2002 at 03:27:15PM -0500, Elena Zannoni wrote:
> So do you agree that 'until fun2' should stop inside fun2, just like
> "break fun2;continue" would? If so I have a fix.
Definitely. It should stop when you reach the specified location or
when you leave the current stack frame.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2002-11-14 19:58 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-13 11:26 Behavior of 'until' command Elena Zannoni
2002-11-13 11:33 ` Daniel Jacobowitz
2002-11-13 11:42 ` Andrew Cagney
2002-11-13 12:35 ` Elena Zannoni
2002-11-14 0:19 ` Pierre Muller
2002-11-14 8:59 ` Elena Zannoni
2002-11-14 11:58 ` Eli Zaretskii
2002-11-13 12:34 ` Elena Zannoni
2002-11-13 12:40 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox