public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Show locno for 'multi location' breakpoint hit msg+conv var $bkptno $locno.
Date: Sun, 17 Apr 2022 18:27:54 +0200	[thread overview]
Message-ID: <b105a5269fe614102ddcc5a8c6d37de011e2d310.camel@skynet.be> (raw)
In-Reply-To: <83h76ry9eo.fsf@gnu.org>

Thanks for the feedback.
I will handle your comments for the RFA v2.

One question below.
Philippe

On Sun, 2022-04-17 at 19:14 +0300, Eli Zaretskii wrote:
> > Date: Sun, 17 Apr 2022 17:53:11 +0200
> > From: Philippe Waroquiers via Gdb-patches <gdb-patches@sourceware.org>
> > 
> > Before this patch, when a breakpoint that has multiple locations is reached,
> > GDB printed:
> >   Thread 1 "zeoes" hit Breakpoint 1, some_func () at somefunc1.c:5
> > 
> > This patch changes the message so that bkpt_print_id prints the precise
> > encountered breakpoint:
> >   Thread 1 "zeoes" hit Breakpoint 1.2, some_func () at somefunc1.c:5
> > 
> > In mi mode, bkpt_print_id also (optionally) prints a new table field "locno":
> >   locno is printed when the breakpoint has more than one location.
> > Note that according to the GDB user manual node 'GDB/MI Development and Front
> > Ends', it is ok to add new fields without changing the MI version.
> 
> Thanks.  I think this should be an optional feature.  Not everyone is
> interested in the particular location that breaks.  Having to disable
> the breakpoints by locations is definitely an annoyance.

For the GDB CLI, when the above message is displayed, 
the user can decide to type
   disable 1
or
   disable 1.2
or can define aliases such as
   alias bdisable = disable $bkptno
   alias ldisable = disable $bkptno.$locno
to disable the complete breakpoint or only the specific location.

I might submit a later patch to define the above aliases by default,
so that disabling the last breakpoint or location will imply only to 
type 'bd' or 'ld'.

Similarly, a front end using MI will (by default) just skip the new locno field.
So, I am not sure to understand what is the annoyance.

> 
> > diff --git a/gdb/NEWS b/gdb/NEWS
> > index 760cb2b7abc..673607dfbb3 100644
> > --- a/gdb/NEWS
> > +++ b/gdb/NEWS
> > @@ -14,6 +14,20 @@
> >    emit to indicate where a breakpoint should be placed to break in a function
> >    past its prologue.
> >  
> > +* When a breakpoint with multiple locations is hit, GDB now also prints the location
> > +  using the syntax <breakpoint_number>.<location_number> such as in:
> > +     Thread 1 "zeoes" hit Breakpoint 2.3, some_func () at zeoes.c:8
> > +
> > +* When a breakpoint is hit, GDB now sets the convenience variables $bkpno and
> > +  $locno to the hit breakpoint number and location number.
> > +  This allows to disable the last hit breakpoint using for example
> > +     (gdb) disable $bkptno
> > +   or
> > +     (gdb) disable $bkptno.$locno
> > +  These commands can be used inside the command list of a breakpoint to
> > +  automatically disable the just encountered breakpoint (or breakpoint
> > +  specific location).
> > +
> >  * New commands
> > [...]
> > +* MI changes
> > +
> > + ** The 'breakpoint-hit' stopped reason async record now contains an optional field
> > +    locno giving the location number when the breakpoint has multiple locations.
> > +
> 
> This part is OK.
> 
> > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> > index c1e9b09e833..8408928648e 100644
> > --- a/gdb/doc/gdb.texinfo
> > +++ b/gdb/doc/gdb.texinfo
> > @@ -4338,9 +4338,15 @@ are operated on.
> >  @cindex latest breakpoint
> >  Breakpoints are set with the @code{break} command (abbreviated
> >  @code{b}).  The debugger convenience variable @samp{$bpnum} records the
> > -number of the breakpoint you've set most recently; see @ref{Convenience
> > -Vars,, Convenience Variables}, for a discussion of what you can do with
> > -convenience variables.
> > +number of the breakpoint you've set most recently.
> > +A breakpoint may be mapped to multiple locations for example with
> > +inlined functions, Ada generics, c++ templates or overloaded function names.
>                                     ^^^
> I believe we use "C@t{++}" markup for C++ language in the manual.
> 
> > +When your program stops on a breakpoint, the convenience variables
> > +@samp{$bpkpno} and @samp{$locno} are respectively set to the number of
> > +the encountered breakpoint and the number of the breakpoint location.
> 
> Please add here index entries for these two variables.
> 
> > +For a @samp{breakpoint-hit} stopped reason, when the breakpoint
> > +encountered has multiple locations, the field @samp{bkptno} is
> > +followed by the field @samp{locno}.
> 
> How about an example here?
> 
> Thanks.



  reply	other threads:[~2022-04-17 16:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-17 15:53 Philippe Waroquiers
2022-04-17 16:14 ` Eli Zaretskii
2022-04-17 16:27   ` Philippe Waroquiers [this message]
2022-04-17 17:55     ` Eli Zaretskii
2022-04-29 16:26 ` Philippe Waroquiers
2022-05-07  5:44   ` Philippe Waroquiers
2022-05-13 16:49   ` Philippe Waroquiers
2022-05-22 18:43   ` Philippe Waroquiers
2022-05-30 19:08   ` Philippe Waroquiers
2022-06-03 20:40     ` Keith Seitz
2022-06-04  6:23       ` Eli Zaretskii
2022-06-04 17:27         ` Matt Rice
2022-06-04 17:45           ` Philippe Waroquiers
2022-06-04 17:37       ` Philippe Waroquiers

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=b105a5269fe614102ddcc5a8c6d37de011e2d310.camel@skynet.be \
    --to=philippe.waroquiers@skynet.be \
    --cc=eliz@gnu.org \
    --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).