From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id D19B13856DD2; Wed, 25 May 2022 18:56:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D19B13856DD2 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Show enabled locations with disabled breakpoint parent as "y-" X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: 3ac9da49378ccb061e3e33e4342c35949bf368a9 X-Git-Newrev: fbcda577011d73fdcf1ebf86160b6fc8ddd95299 Message-Id: <20220525185640.D19B13856DD2@sourceware.org> Date: Wed, 25 May 2022 18:56:40 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2022 18:56:40 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dfbcda577011d= 73fdcf1ebf86160b6fc8ddd95299 commit fbcda577011d73fdcf1ebf86160b6fc8ddd95299 Author: Pedro Alves Date: Tue May 24 19:30:10 2022 +0100 Show enabled locations with disabled breakpoint parent as "y-" =20 Currently, breakpoint locations that are enabled while their parent breakpoint is disabled are displayed with "y" in the Enb colum of "info breakpoints": =20 (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep n 1.1 y 0x00000000000011b6 in ... 1.2 y 0x00000000000011c2 in ... 1.3 n 0x00000000000011ce in ... =20 Such locations won't trigger a break, so to avoid confusion, show "y-" instead. For example: =20 (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep n 1.1 y- 0x00000000000011b6 in ... 1.2 y- 0x00000000000011c2 in ... 1.3 n 0x00000000000011ce in ... =20 The "-" sign is inspired on how the TUI represents breakpoints on the left side of the source window, with "b-" for a disabled breakpoint. =20 Change-Id: I9952313743c51bf21b4b380c72360ef7d4396a09 Diff: --- gdb/NEWS | 10 +++++++++ gdb/breakpoint.c | 37 ++++++++++++++++++++++++++-= ---- gdb/doc/gdb.texinfo | 13 +++++++++++ gdb/testsuite/gdb.cp/ena-dis-br-range.exp | 28 +++++++++++------------ 4 files changed, 68 insertions(+), 20 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index a72fee81550..52ffdc4c83a 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -3,6 +3,16 @@ =20 *** Changes since GDB 12 =20 +* "info breakpoints" now displays enabled breakpoint locations of + disabled breakpoints as in the "y-" state. For example: + + (gdb) info breakpoints + Num Type Disp Enb Address What + 1 breakpoint keep n + 1.1 y- 0x00000000000011b6 in ... + 1.2 y- 0x00000000000011c2 in ... + 1.3 n 0x00000000000011ce in ... + * Support for Thread Local Storage (TLS) variables on FreeBSD arm and aarch64 architectures. =20 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index eac6410a578..ed932a19ed7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -6234,13 +6234,38 @@ print_one_breakpoint_location (struct breakpoint *b, =20 /* 4 */ annotate_field (3); - /* For locations that are disabled because of an invalid condition, - display "N*" on CLI, where "*" refers to a footnote below the - table. For MI, simply display a "N" without a footnote. */ - const char *N =3D (uiout->is_mi_like_p ()) ? "N" : "N*"; if (part_of_multiple) - uiout->field_string ("enabled", (loc->disabled_by_cond ? N - : (loc->enabled ? "y" : "n"))); + { + /* For locations that are disabled because of an invalid + condition, display "N*" on the CLI, where "*" refers to a + footnote below the table. For MI, simply display a "N" + without a footnote. On the CLI, for enabled locations whose + breakpoint is disabled, display "y-". */ + auto get_enable_state =3D [uiout, loc] () -> const char * + { + if (uiout->is_mi_like_p ()) + { + if (loc->disabled_by_cond) + return "N"; + else if (!loc->enabled) + return "n"; + else + return "y"; + } + else + { + if (loc->disabled_by_cond) + return "N*"; + else if (!loc->enabled) + return "n"; + else if (!breakpoint_enabled (loc->owner)) + return "y-"; + else + return "y"; + } + }; + uiout->field_string ("enabled", get_enable_state ()); + } else uiout->field_fmt ("enabled", "%c", bpenables[(int) b->enable_state]); =20 diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index e5c1ee33aac..68679982919 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -4668,6 +4668,19 @@ in which case @value{GDBN} acts on all the locations= in the range (inclusive). Disabling or enabling the parent breakpoint (@pxref{Disabling}) affects all of the locations that belong to that breakpoint. =20 +Locations that are enabled while their parent breakpoint is disabled +won't trigger a break, and are denoted by @code{y-} in the @code{Enb} +column. For example: + +@smallexample +(@value{GDBP}) info breakpoints +Num Type Disp Enb Address What +1 breakpoint keep n +1.1 y- 0x00000000000011b6 in ... +1.2 y- 0x00000000000011c2 in ... +1.3 n 0x00000000000011ce in ... +@end smallexample + @cindex pending breakpoints It's quite common to have a breakpoint inside a shared library. Shared libraries can be loaded and unloaded explicitly, diff --git a/gdb/testsuite/gdb.cp/ena-dis-br-range.exp b/gdb/testsuite/gdb.= cp/ena-dis-br-range.exp index 782756e9ab1..83c9838aa42 100644 --- a/gdb/testsuite/gdb.cp/ena-dis-br-range.exp +++ b/gdb/testsuite/gdb.cp/ena-dis-br-range.exp @@ -44,10 +44,10 @@ proc make_info_breakpoint_reply_re {b1 b2 b21 b22 b23 b= 24} { "1${ws}breakpoint keep ${b1}${ws}.* in marker\\(\\) at .*" \ "${ws}breakpoint already hit 1 time.*" \ "2${ws}breakpoint${ws}keep${ws}${b2}${ws}.*" \ - "2.1${ws}${b21}.*" \ - "2.2${ws}${b22}.*" \ - "2.3${ws}${b23}.*" \ - "2.4${ws}${b24}.*" \ + "2.1${ws}${b21}${ws}.*" \ + "2.2${ws}${b22}${ws}.*" \ + "2.3${ws}${b23}${ws}.*" \ + "2.4${ws}${b24}${ws}.*" \ ] } =20 @@ -74,18 +74,18 @@ proc test_enable_disable {cmd b1 b2 b21 b22 b23 b24} { test_enable_disable "disable 1" n y y y y y test_enable_disable "enable 1" y y y y y y =20 -# Check that we can disable/disable a breakpoint with multiple +# Check that we can disable/enable a breakpoint with multiple # locations. -test_enable_disable "disable 2" y n y y y y -test_enable_disable "enable 2" y y y y y y +test_enable_disable "disable 2" y n y- y- y- y- +test_enable_disable "enable 2" y y y y y y =20 -# Check that we can disable/disable a range of breakpoints. -test_enable_disable "disable 1-2" n n y y y y -test_enable_disable "enable 1-2" y y y y y y +# Check that we can disable/enable a range of breakpoints. +test_enable_disable "disable 1-2" n n y- y- y- y- +test_enable_disable "enable 1-2" y y y y y y =20 -# Check that we can disable/disable a list of breakpoints. -test_enable_disable "disable 1 2" n n y y y y -test_enable_disable "enable 1 2" y y y y y y +# Check that we can disable/enable a list of breakpoints. +test_enable_disable "disable 1 2" n n y- y- y- y- +test_enable_disable "enable 1 2" y y y y y y =20 # Check that we can disable/enable a single location breakpoint. test_enable_disable "disable 2.2" y y y n y y @@ -100,7 +100,7 @@ test_enable_disable "enable 2.2-3" y y y y y y test_enable_disable "disable 2.2-2" y y y n y y test_enable_disable "enable 2.2-2" y y y y y y =20 -# Check that we can disable/disable a list of breakpoints that +# Check that we can disable/enable a list of breakpoints that # includes some elements with location ranges and others without. test_enable_disable "disable 1 2.1 2.3-4" n y n y n n test_enable_disable "enable 1 2.1 2.3-4" y y y y y y