Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: Elena Zannoni <ezannoni@redhat.com>
Cc: Michael Elizabeth Chastain <mec@shout.net>,
	drow@mvista.com, gdb-patches@sources.redhat.com
Subject: Re: [RFA/PATCH] breakpoint.c: fix until command
Date: Fri, 03 Jan 2003 23:13:00 -0000	[thread overview]
Message-ID: <3E1618F7.601A1127@redhat.com> (raw)
In-Reply-To: <15894.4882.468536.407063@localhost.redhat.com>

Elena Zannoni wrote:
> 
> Michael Snyder writes:
>  > Elena Zannoni wrote:
>  > >
>  > > Michael Elizabeth Chastain writes:
>  > >  > I think the problem is inherent in the design.  'until' with no argument
>  > >  > is meant for getting past loops in the current stack frame.  (The manual
>  > >  > says that).  So it makes sense that it skips over all subroutine calls
>  > >  > and also stops if the current stack frame inadvertently exits before
>  > >  > getting past the end of a loop.
>  > >  >
>  > >  > 'until LOCATION' is quite different.  The manual says:
>  > >  >
>  > >  >   `until LOCATION'
>  > >  >   `u LOCATION'
>  > >  >        Continue running your program until either the specified location
>  > >  >        is reached, or the current stack frame returns.  LOCATION is any of
>  > >  >        the forms of argument acceptable to `break' (*note Setting
>  > >  >        breakpoints: Set Breaks).  This form of the command uses
>  > >  >        breakpoints, and hence is quicker than `until' without an argument.
>  > >  >
>  > >  > Read this way, it looks like 'until LOCATION' is mostly a synonym for
>  > >  > 'tbreak LOCATION; continue', with one extra tbreak at the return address
>  > >  > in the superior frame.  (break.exp says as much but they forgot about
>  > >  > the case where the current stack frame returns).
>  > >
>  > > See the thread from November on gdb@sources.
>  > >
>  > >  >
>  > >  > I think this is bad.  We already have 'tbreak'.  I think it's weird and
>  > >  > redundant to have another 'until LOCATION' which is a lot like 'tbreak'
>  > >  > and not much like 'until'.
>  > >  >
>  > >  > Also I trust Michael Snyder's interpretation of the original intent more
>  > >  > than this particular section of The Fine Manual.  It's bad when the manual
>  > >  > talks about the implementation of both 'until' and 'until LOCATION' and
>  > >  > points out that they are different.  It implies that the original designers
>  > >  > knew they had some inconsistency between 'until' and 'until LOCATION'.
>  > >  >
>  > >
>  > > Which tells me that the design was flawed.
>  >
>  > 'Design'?   ;-)
>  >
>  >
>  > >  > How about this:
>  > >  >
>  > >  >   . require that LOCATION in 'until LOCATION' to be in the current
>  > >  >     function and after $PC.  If it's not, then error.
>  > >  >
>  > >  >   . use the same steppy implementation for 'until LOCATION' as 'until',
>  > >  >     not a breakpointy implementation.  In fact, 'until' with no arguments
>  > >  >     simply becomes 'until LOCATION' where gdb picks a location by default.
>  > >  >
>  > >  >   . change the manual to reflect this
>  > >  >
>  > >
>  > > Definitely the description in the manual needs more detail.  I prefer
>  > > the until == tbreak behavior, which seems the most intuitive, given
>  > > the replies to the November thread.
>  > >
>  > > I think that using decode_line_1 may be the real problem, because that
>  > > allows all kind of arguments to be used, just like for a breakpoint.
>  >
>  > Well, but that's the stated intent.  Maybe it was over-ambitious?
>  >
> 
> very likely so. If you accept the arguments that 'break' accepts, then
> 'until foo' should do something meaningful. Otherwise, why go through
> the effort. Apparently they thought it did something useful. I tried
> to build 4.16 but I cannot find a host where it builds. Maybe it
> really worked both ways back then?

I confess that it never occurred to me to say "until foo".


>  > >  > Specifically, in Elena's case of the factorial: if the user wants to
>  > >  > stop at line 99 in ANY frame, they can use 'tbreak 99' or 'break 99'.
>  > >  > If the user wants to stop at line 99 in the CURRENT frame, they can use
>  > >  > 'until 99'.
>  > >  >
>  > >  > And in Elena's second case: what if you are in 'bar' at the moment and you
>  > >  > say 'until bar'?  I think that should be an error, because 'bar' is in
>  > >  > the current function, but it is not after $PC.
>  > >
>  > > My case was when bar is recursive. you will execute the beginning of
>  > > bar again, so 'until bar' would make sense in this case. I think this
>  > > is what throws a wrench in the works.
>  >
>  > What happens if you're at line 100 and you say "until 99"?
>  >
> 
> Well, you could be at the last line in the body of a loop, and you may
> want to go to the first line of the body of the loop, for instance. So
> you cannot discharge that.

The question I meant to ask was "what does it currently/traditionally do?",
but if you're thinking of "what _should_ it do", that's a good question too.

>  > >  > Similarly if you are currently in 'bar' and say 'until quux'.  Just error it.
>  > >  > Don't turn it into a tbreak.
>  > >  >
>  > >  > This would make both forms of 'until' behave the same, all the time.
>  > >  > The user can still do whatever they want.  Want to progress a little in
>  > >  > the same frame?  Call 'until', with or without an argument.  Want to be
>  > >  > somewhere and not care if the frames change?  Call 'break' or 'tbreak'.
>  > >  >
>  > >
>  > > Don't know, I don't like it, but whatever we do we need to
>  > > disambiguate the behavior. It's just plain confusing right now.
>  >
>  > That it is, but forbidding usage that was formerly allowed
>  > is just another way of changing the documented (or in this
>  > case, un-documented) behavior.
> 
> Well, the recursive behavior is the one that is undocumented. Look at
> the output of 'help until'. I think somebody was sniffing something
> powerful that day.

I know, I know...
It could be me, since so far I seem to be the only one who
remembers it that way... but damned if I don't seem to remember
reading about it in a comment -- probably in breakpoint.c.


  reply	other threads:[~2003-01-03 23:13 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-03  4:15 Michael Elizabeth Chastain
2003-01-03  4:59 ` Daniel Jacobowitz
2003-01-03 21:52   ` Michael Snyder
2003-01-03 21:54     ` Daniel Jacobowitz
2003-01-03 22:39       ` Elena Zannoni
2003-01-03 23:09         ` Michael Snyder
2003-01-03 14:43 ` Elena Zannoni
2003-01-03 22:06   ` Michael Snyder
2003-01-03 22:43     ` Elena Zannoni
2003-01-03 23:13       ` Michael Snyder [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-01-11  1:04 Michael Elizabeth Chastain
2003-01-07  4:05 Michael Elizabeth Chastain
2003-01-07  3:53 Michael Elizabeth Chastain
2003-01-04  0:37 Michael Elizabeth Chastain
2003-01-05 17:02 ` Andrew Cagney
2003-01-07  1:30   ` Michael Snyder
2003-01-03 18:03 Michael Elizabeth Chastain
2003-01-03 17:40 Michael Elizabeth Chastain
2003-01-03 17:07 Michael Elizabeth Chastain
2003-01-03 17:51 ` Elena Zannoni
2003-01-03 16:48 Michael Elizabeth Chastain
2003-01-03 23:33 ` Michael Snyder
2003-01-03 16:38 Michael Elizabeth Chastain
2003-01-03 16:57 ` Daniel Jacobowitz
2003-01-03  6:49 Michael Elizabeth Chastain
2003-01-03 15:17 ` Daniel Jacobowitz
2002-12-20 10:19 Elena Zannoni
2002-12-23 15:55 ` Michael Snyder
2002-12-23 16:13   ` Daniel Jacobowitz
2002-12-23 16:59     ` Michael Snyder
2002-12-23 19:23       ` Daniel Jacobowitz
2003-01-02 20:25         ` Michael Snyder
2003-01-02 20:34           ` Elena Zannoni
2003-01-02 20:40             ` Michael Snyder
2003-01-03  0:12             ` Elena Zannoni
2003-01-03  1:44               ` Michael Snyder
2003-01-03  1:50                 ` Daniel Jacobowitz
2003-01-03  2:37                   ` Michael Snyder
2003-01-03 14:29                     ` Elena Zannoni
2003-01-03 23:51                       ` Michael Snyder
2003-01-03 23:53                         ` Elena Zannoni
2003-01-04  0:05                           ` Michael Snyder
2003-01-04  1:54                             ` Daniel Jacobowitz
2003-01-06 22:06                               ` Elena Zannoni
2003-01-07  1:27                                 ` Michael Snyder
2003-01-07  1:45                                   ` Elena Zannoni
2003-01-07  2:09                                     ` Michael Snyder
2003-01-07  4:31                                       ` Daniel Jacobowitz
2003-01-08 22:08                                         ` Elena Zannoni
2003-01-09  1:52                                           ` Daniel Jacobowitz
2003-01-10 22:25                                             ` Elena Zannoni
2003-01-10 22:28                                               ` Daniel Jacobowitz
2003-01-10 23:20                                                 ` Elena Zannoni
2003-01-03 14:15                   ` Elena Zannoni
2003-01-03 23:31                     ` Michael Snyder
2003-01-03 23:51                       ` Elena Zannoni
2003-01-03 23:58                         ` Michael Snyder
2003-01-03 14:13                 ` Elena Zannoni
2003-01-03 23:28                   ` Michael Snyder
2003-01-02 20:01       ` Elena Zannoni
2003-01-02 20:29         ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E1618F7.601A1127@redhat.com \
    --to=msnyder@redhat.com \
    --cc=drow@mvista.com \
    --cc=ezannoni@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mec@shout.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox