From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id DDF9C3858CDB; Sat, 11 Feb 2023 17:41:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDF9C3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676137304; bh=K9p/PTLbg2rouUmLu1YH0KOptFnuYsPfeXhcLsQzMq8=; h=From:To:Subject:Date:From; b=WTDDkF/gK7PxTEw5/s19Ok6U13iX3zEQY7Di87WPDIinET7fYwiXZ7L8iuHpZ1abD Cnw3OKdWAZ7Iuj3ZCyuf4+6J0jKrFY5ZcOIqkhcE9DbmutuB9EDjjU6vNb2uIKJOUc UxM9WjkQ0Zf0yIQl26u+OuYy70Yeji7fWf0i/7Mk= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: show task number in describe_other_breakpoints X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: ce068c5f45aeebc9729499253e0a8f1f29be65c2 X-Git-Newrev: f1f517e81039f6aa673b7d87a66bfbd25a66e3d3 Message-Id: <20230211174144.DDF9C3858CDB@sourceware.org> Date: Sat, 11 Feb 2023 17:41:44 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df1f517e81039= f6aa673b7d87a66bfbd25a66e3d3 commit f1f517e81039f6aa673b7d87a66bfbd25a66e3d3 Author: Andrew Burgess Date: Wed Feb 8 13:23:14 2023 +0000 gdb: show task number in describe_other_breakpoints =20 I noticed that describe_other_breakpoints doesn't show the task number, but does show the thread-id. I can't see any reason why we'd want to not show the task number in this situation, so this commit adds this missing information, and extends gdb.ada/tasks.exp to check this case. =20 Approved-By: Pedro Alves Diff: --- gdb/breakpoint.c | 2 ++ gdb/testsuite/gdb.ada/tasks.exp | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 68163283ec6..5959013b2b4 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -7049,6 +7049,8 @@ describe_other_breakpoints (struct gdbarch *gdbarch, struct thread_info *thr =3D find_thread_global_id (b->thread); gdb_printf (" (thread %s)", print_thread_id (thr)); } + else if (b->task !=3D 0) + gdb_printf (" (task %d)", b->task); gdb_printf ("%s%s ", ((b->enable_state =3D=3D bp_disabled || b->enable_state =3D=3D bp_call_disabled) diff --git a/gdb/testsuite/gdb.ada/tasks.exp b/gdb/testsuite/gdb.ada/tasks.= exp index 88ef123865b..19aca7a4362 100644 --- a/gdb/testsuite/gdb.ada/tasks.exp +++ b/gdb/testsuite/gdb.ada/tasks.exp @@ -50,16 +50,21 @@ gdb_test "watch j task 1 task 3" "You can specify only = one task\\." # breakpoint in the list that matched the triggered-breakpoint's # address, no matter which task it was specific to. gdb_test "break break_me task 1" "Breakpoint .* at .*" +set bp_number [get_integer_valueof "\$bpnum" "INVALID" \ + "get number of breakpoint for task 1"] gdb_test "info breakpoints" "foo.adb:${decimal}\r\n\\s+stop only in task 1= " \ "check info breakpoints for task 1 breakpoint" =20 # Now, insert a breakpoint that should stop only if task 3 stops, and -# extract its number. -gdb_breakpoint "break_me task 3" message -set bp_number [get_integer_valueof "\$bpnum" -1] -if {$bp_number < 0} { - return -} +# extract its number. Use gdb_test here so that we can validate that +# the 'Breakpoint ... also set at' line correctly includes the task +# number of the previous breakpoint. +gdb_test "break break_me task 3" \ + [multi_line \ + "Note: breakpoint $bp_number \\(task 1\\) also set at pc $hex\\." \ + "Breakpoint $decimal at $hex: \[^\r\n\]+"] +set bp_number [get_integer_valueof "\$bpnum" "INVALID" \ + "get number of breakpoint for task 3"] gdb_test "info breakpoints" "foo.adb:${decimal}\r\n\\s+stop only in task 3= " \ "check info breakpoints for task 3 breakpoint"