From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 682C73858D1E for ; Sun, 17 Apr 2022 16:14:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 682C73858D1E Received: from fencepost.gnu.org ([2001:470:142:3::e]:52186) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng7Xq-0007Et-7h; Sun, 17 Apr 2022 12:14:38 -0400 Received: from [87.69.77.57] (port=2958 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng7Xp-00048G-Kb; Sun, 17 Apr 2022 12:14:38 -0400 Date: Sun, 17 Apr 2022 19:14:23 +0300 Message-Id: <83h76ry9eo.fsf@gnu.org> From: Eli Zaretskii To: Philippe Waroquiers Cc: gdb-patches@sourceware.org In-Reply-To: <20220417155311.3487509-1-philippe.waroquiers@skynet.be> (message from Philippe Waroquiers via Gdb-patches on Sun, 17 Apr 2022 17:53:11 +0200) Subject: Re: [RFA] Show locno for 'multi location' breakpoint hit msg+conv var $bkptno $locno. References: <20220417155311.3487509-1-philippe.waroquiers@skynet.be> X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Apr 2022 16:14:42 -0000 > Date: Sun, 17 Apr 2022 17:53:11 +0200 > From: Philippe Waroquiers via Gdb-patches > > 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. > 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 . 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.