public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: bauerman@br.ibm.com (Thiago Jung Bauermann)
Cc: gdb-patches@sourceware.org (gdb-patches ml)
Subject: Re: [RFA] Implement support for PowerPC BookE ranged breakpoints
Date: Mon, 14 Mar 2011 21:02:00 -0000	[thread overview]
Message-ID: <201103142022.p2EKMO0u006929@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <1299890187.9288.185.camel@hactar> from "Thiago Jung Bauermann" at Mar 11, 2011 09:36:27 PM

Thiago Jung Bauermann wrote:
> On Mon, 2011-02-28 at 17:52 +0100, Ulrich Weigand wrote:
> > Thiago Jung Bauermann wrote:
> > > > This adds the SAY_WHERE parameter so that the caller will go ahead to
> > > > add location information.  However, for a range breakpoint, this will
> > > > just be the start of the range, which may or may not be particularly
> > > > useful ...   Shouldn't we either:
> > > > - output the full range (start and end),  or
> > > > - output nothing ... we'll see the actual location where we stopped anyway
> > > > 
> > > > (Either way, the API change to add SAY_WHERE is no longer needed.)
> > > 
> > > I think it's useful. You have a point in that it makes more sense to
> > > print the end of the range as well. I'd have to extend struct breakpoint
> > > to save the source file and line number of the end of the range if I
> > > were to print them. I'm not sure it's worth it, so I changed
> > > print_mention_ranged_breakpoint to print only the start and end address
> > > of the range. And dropped the say_where argument. What do you think? 
> > 
> > Don't you have to know the end of the range anyway, in order to be
> > able to re-set the breakpoint?
> 
> I was thinking of the struct breakpoint's source_file and line_number,
> which are used mostly for printing (clear_command uses it for finding
> breakpoints). For print_mention_ranged_breakpoint I'd need
> source_file_range_end and line_number_range_end, but decided against it.
> 
> But now that you mention breakpoint re-setting, I just realised that I
> need to add addr_string_range_end and make breakpoint_re_set_one use it.
> As the patch currently stands, ranged breakpoints will be dropped when
> loading new binaries... I'm currently working on this but decided to
> send this patch as it is since it addresses all the other points you
> raised.

Well, but you do have this:

 static void
 print_recreate_ranged_breakpoint (struct breakpoint *b, struct ui_file *fp)
 {
   fprintf_unfiltered (fp, "break-range %s", b->exp_string);
 }

So I thought b->exp_string would already include the original start and
end, but simply in an un-parsed fashion.   If this could maybe be formatted
consistently, you might be able to use it for print_details as well, I guess.

> > It seems oddly asymmetrical to use parse_breakpoint_sals above but
> > decode_line_1 here.  Shouldn't start and end of the range use the
> > same symtab defaulting rules and other extra treatment done by
> > parse_breakpoint_sals?
> 
> No, the end location should default to the same file and line number as
> the start location. This makes it possible to have ranges like:
> 
> (gdb) break-range foo.c:27, +14
> 
> Had I used parse_breakpoint_sals, GDB would interpret "+14" as "14 lines
> from the current file and line number", and not "14 lines from the start
> location". As for the extra treatment, I had a look at them before and
> didn't think they applied in the context of resolving the end location.

Ah, good point, this does make sense.  Maybe a brief comment in the source
to that effect would be useful here?

> This was pointed out to me by Jan when reviewing another patch [1]:
> 
> > > --- a/gdb/target.c
> > > +++ b/gdb/target.c
> > > @@ -601,11 +601,16 @@ update_current_target (void)
> > >        INHERIT (to_files_info, t);
> > >        INHERIT (to_insert_breakpoint, t);
> > >        INHERIT (to_remove_breakpoint, t);
> > > +      INHERIT (to_can_use_special_hw_point, t);
> > 
> > There are now two target interface styles in use.  This inheriting one and the
> > runtime-inheriting one (see target_pid_to_str and others).  I was told the
> > target_pid_to_str style is now preferred and it makes sense to me.  Please
> > convert the new target vector methods to the new style.
> 
> So I just followed his advice and used the new method instead of the
> deprecated one which is used by the other breakpoint-related functions.

I agree in general that new target methods should use the new style.  The only
issue that makes me a bit nervous is that the two styles do have slightly
different effects (the struct target_ops that is passed in to the callback
may be a different one); so I'm wondering if it is a good idea to mix the
two methods within a group of closely related target methods ...

But then again, in this particular case it probably doesn't matter much,
as typical implementations of your newly added callback ought to be
straightforward, and probably won't care about the target_ops they get.
So I guess I withdraw my objection :-)

The rest of the patch looks fine to me now.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com

  parent reply	other threads:[~2011-03-14 20:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-28  1:54 Thiago Jung Bauermann
2011-01-28  9:39 ` Eli Zaretskii
2011-01-31 19:07   ` Thiago Jung Bauermann
2011-01-31 20:39     ` Eli Zaretskii
2011-02-17 15:49 ` Ulrich Weigand
2011-02-23 20:50   ` Thiago Jung Bauermann
2011-02-24 20:45     ` [rfc] More intelligent indenting of multi-line table entries (Re: [RFA] Implement support for PowerPC BookE ranged breakpoints) Ulrich Weigand
2011-02-25 14:46       ` Pedro Alves
2011-02-28 15:33         ` [rfc] More intelligent indenting of multi-line table entries (Re: [RFA] Implement support for PowerPC BookE ranged breakpoin Ulrich Weigand
2011-02-28 16:34           ` [commit] Remove unused parameter (Re: [rfc] More intelligent indenting of multi-line table entries) Ulrich Weigand
2011-02-25 15:33       ` [rfc] More intelligent indenting of multi-line table entries (Re: [RFA] Implement support for PowerPC BookE ranged breakpoints) Thiago Jung Bauermann
2011-02-28 17:08     ` [RFA] Implement support for PowerPC BookE ranged breakpoints Ulrich Weigand
2011-03-12  2:03       ` Thiago Jung Bauermann
2011-03-12 16:44         ` Thiago Jung Bauermann
2011-03-14 20:50           ` Ulrich Weigand
2011-03-16  6:07             ` Thiago Jung Bauermann
2011-03-16 18:00               ` Ulrich Weigand
2011-03-14 21:02         ` Ulrich Weigand [this message]
2011-03-28 16:50           ` Thiago Jung Bauermann
2011-03-29 13:10             ` Ulrich Weigand
2011-03-31 15:41               ` Thiago Jung Bauermann
2011-03-31 16:04                 ` Thiago Jung Bauermann

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=201103142022.p2EKMO0u006929@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=bauerman@br.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).