public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug breakpoints/30087] "What" column of a thread-specific multi-location breakpoint shows "thread N" instead of "thread INF.THR"
Date: Tue, 07 Feb 2023 14:42:15 +0000	[thread overview]
Message-ID: <bug-30087-4717-1vfvUXizM4@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30087-4717@http.sourceware.org/bugzilla/>

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.

  reply	other threads:[~2023-02-07 14:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06 17:39 [Bug breakpoints/30087] New: " pedro at palves dot net
2023-02-07 14:42 ` cvs-commit at gcc dot gnu.org [this message]
2023-02-07 14:47 ` [Bug breakpoints/30087] " aburgess at redhat dot com

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=bug-30087-4717-1vfvUXizM4@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).