public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/30087] New: "What" column of a thread-specific multi-location breakpoint shows "thread N" instead of "thread INF.THR"
@ 2023-02-06 17:39 pedro at palves dot net
  2023-02-07 14:42 ` [Bug breakpoints/30087] " cvs-commit at gcc dot gnu.org
  2023-02-07 14:47 ` aburgess at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: pedro at palves dot net @ 2023-02-06 17:39 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30087

            Bug ID: 30087
           Summary: "What" column of a thread-specific multi-location
                    breakpoint shows "thread N" instead of "thread
                    INF.THR"
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: pedro at palves dot net
  Target Milestone: ---

The "What" column of a thread-specific multi-location breakpoint shows "thread
N" instead of "thread INF.THR" when there are multiple inferiors.  Vis:

 (gdb) b main thread 1.1
 Breakpoint 1 at 0x1285: main. (2 locations)
 (gdb) info breakpoints 
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   <MULTIPLE>          thread 1
         stop only in thread 1.1
 1.1                         y   0x0000000000001285 in main at 
 gdb.multi/goodbye.c:61 inf 2
 1.2                         y   0x00005555555551f0 in main at 
 gdb.multi/hello.c:51 inf 1

I haven't checked the code to check what we're printing there exactly.  Maybe
we're printing the thread id as-if in single-inferior mode, or maybe it's the
thread global id leaking out.  Whatever it is, it looks wrong.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug breakpoints/30087] "What" column of a thread-specific multi-location breakpoint shows "thread N" instead of "thread INF.THR"
  2023-02-06 17:39 [Bug breakpoints/30087] New: "What" column of a thread-specific multi-location breakpoint shows "thread N" instead of "thread INF.THR" pedro at palves dot net
@ 2023-02-07 14:42 ` cvs-commit at gcc dot gnu.org
  2023-02-07 14:47 ` aburgess at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-07 14:42 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30087

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Burgess <aburgess@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=944b1b181799c1d353a0e5f167837e625fd88a36

commit 944b1b181799c1d353a0e5f167837e625fd88a36
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Mon Nov 7 17:18:55 2022 +0000

    gdb: fix display of thread condition for multi-location breakpoints

    This commit addresses the issue in PR gdb/30087.

    If a breakpoint with multiple locations has a thread condition, then
    the 'info breakpoints' output is a little messed up, here's an example
    of the current output:

      (gdb) break foo thread 1
      Breakpoint 2 at 0x401114: foo. (3 locations)
      (gdb) break bar thread 1
      Breakpoint 3 at 0x40110a: file
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c, line 32.
      (gdb) info breakpoints
      Num     Type           Disp Enb Address            What
      2       breakpoint     keep y   <MULTIPLE>          thread 1
              stop only in thread 1
      2.1                         y   0x0000000000401114 in foo at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25
      2.2                         y   0x0000000000401146 in foo at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25
      2.3                         y   0x0000000000401168 in foo at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25
      3       breakpoint     keep y   0x000000000040110a in bar at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:32 thread 1
              stop only in thread 1

    Notice that, at the end of the location for breakpoint 3, the 'thread
    1' condition is printed, but this is then repeated on the next line
    with 'stop only in thread 1'.

    In contrast, for breakpoint 2, the 'thread 1' appears randomly, in the
    "What" column, though slightly offset, non of the separate locations
    have the 'thread 1' information.  Additionally for breakpoint 2 we
    also get a 'stop only in thread 1' line.

    There's two things going on here.  First the randomly placed 'thread
    1' for breakpoint 2 is due to a bug in print_one_breakpoint_location,
    where we check the variable part_of_multiple instead of
    header_of_multiple.

    If I fix this oversight, then the output is now:

      (gdb) break foo thread 1
      Breakpoint 2 at 0x401114: foo. (3 locations)
      (gdb) break bar thread 1
      Breakpoint 3 at 0x40110a: file
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c, line 32.
      (gdb) info breakpoints
      Num     Type           Disp Enb Address            What
      2       breakpoint     keep y   <MULTIPLE>
              stop only in thread 1
      2.1                         y   0x0000000000401114 in foo at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 thread 1
      2.2                         y   0x0000000000401146 in foo at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 thread 1
      2.3                         y   0x0000000000401168 in foo at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 thread 1
      3       breakpoint     keep y   0x000000000040110a in bar at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:32 thread 1
              stop only in thread 1

    The 'thread 1' condition is now displayed at the end of each location,
    which makes the output the same for single location breakpoints and
    multi-location breakpoints.

    However, there's still some duplication here.  Both breakpoints 2 and
    3 include a 'stop only in thread 1' line, and it feels like the
    additional 'thread 1' is redundant.  In fact, there's a comment to
    this very effect in the code:

      /* FIXME: This seems to be redundant and lost here; see the
         "stop only in" line a little further down.  */

    So, lets fix this FIXME.  The new plan is to remove all the trailing
    'thread 1' markers from the CLI output, we now get this:

      (gdb) break foo thread 1
      Breakpoint 2 at 0x401114: foo. (3 locations)
      (gdb) break bar thread 1
      Breakpoint 3 at 0x40110a: file
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c, line 32.
      (gdb) info breakpoints
      Num     Type           Disp Enb Address            What
      2       breakpoint     keep y   <MULTIPLE>
              stop only in thread 1
      2.1                         y   0x0000000000401114 in foo at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25
      2.2                         y   0x0000000000401146 in foo at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25
      2.3                         y   0x0000000000401168 in foo at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25
      3       breakpoint     keep y   0x000000000040110a in bar at
/tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:32
              stop only in thread 1

    All of the above points are also true for the Ada 'task' breakpoint
    condition, and the changes I've made also update how the task
    information is printed, though in the case of the Ada task there was
    no 'stop only in task XXX' line printed, so I've added one of those.

    Obviously it can't be quite that easy.  For MI backwards compatibility
    I've retained the existing code (but now only for MI like outputs),
    which ensures we should generate backwards compatible output.

    I've extended an Ada test to cover the new task related output, and
    updated all the tests I could find that checked for the old output.

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30087

    Approved-By: Pedro Alves <pedro@palves.net>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug breakpoints/30087] "What" column of a thread-specific multi-location breakpoint shows "thread N" instead of "thread INF.THR"
  2023-02-06 17:39 [Bug breakpoints/30087] New: "What" column of a thread-specific multi-location breakpoint shows "thread N" instead of "thread INF.THR" pedro at palves dot net
  2023-02-07 14:42 ` [Bug breakpoints/30087] " cvs-commit at gcc dot gnu.org
@ 2023-02-07 14:47 ` aburgess at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: aburgess at redhat dot com @ 2023-02-07 14:47 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30087

Andrew Burgess <aburgess at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |aburgess at redhat dot com
         Resolution|---                         |FIXED

--- Comment #2 from Andrew Burgess <aburgess at redhat dot com> ---
I think this issue is now resolved.  At least for now.

I guess if this series[1] makes it upstream then we should be careful not to
reintroduce this issue, but that isn't in GDB yet, so, for now at least, I
think this issue is fixed.

Please feel free to reopen if you disagree.

[1] https://sourceware.org/pipermail/gdb-patches/2022-May/189253.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-07 14:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 17:39 [Bug breakpoints/30087] New: "What" column of a thread-specific multi-location breakpoint shows "thread N" instead of "thread INF.THR" pedro at palves dot net
2023-02-07 14:42 ` [Bug breakpoints/30087] " cvs-commit at gcc dot gnu.org
2023-02-07 14:47 ` aburgess at redhat dot com

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).