From: Eli Zaretskii <eliz@gnu.org>
To: Kevin Buettner <kevinb@redhat.com>
Cc: aburgess@redhat.com, gdb-patches@sourceware.org
Subject: Re: [PATCHv2 1/2] gdb: fix 'list' for multiple source file results
Date: Fri, 05 Dec 2025 09:14:41 +0200 [thread overview]
Message-ID: <86ikelz9ge.fsf@gnu.org> (raw)
In-Reply-To: <20251204131835.289e5644@f41-zbm-amd> (message from Kevin Buettner on Thu, 4 Dec 2025 13:18:35 -0700)
> Date: Thu, 4 Dec 2025 13:18:35 -0700
> From: Kevin Buettner <kevinb@redhat.com>
> Cc: gdb-patches@sourceware.org
>
> On Wed, 19 Nov 2025 10:32:37 +0000
> Andrew Burgess <aburgess@redhat.com> wrote:
>
> > From: Andrew Burgess <aburgess@redhat.com>
> > To: gdb-patches@sourceware.org
> > Cc: Andrew Burgess <aburgess@redhat.com>
> > Subject: [PATCHv2 1/2] gdb: fix 'list' for multiple source file results
> > Date: Wed, 19 Nov 2025 10:32:37 +0000
> >
> > This commit:
> >
> > commit c7a45b98a61451f05ff654c4fb72a9c9cb2fba36
> > Date: Thu Jun 12 15:37:50 2025 +0000
> >
> > gdb, linespec: avoid multiple locations with same PC
> >
> > broke GDB's ability to list multiple source files using a 'list'
> > command. In GDB 16 and earlier something like 'list foo.c:10' could
> > print multiple results if there were multiple 'foo.c' files compiled
> > into the executable.
> >
> > The above commit added a filter to add_sal_to_sals (linespec.c) such
> > that multiple sals in the same program space, but with the same pc
> > value, could not be added, only the first sal would actually be
> > recorded. The problem with this is that add_sal_to_sals is used from
> > decode_digits_list_mode (also linespec.c) where the pc value is forced
> > to zero. This force to zero makes sense I think as there might not be
> > any compiled code for the requested line (this is for 'list' after
> > all), so there might not be a valid pc to use.
> >
> > I'm not a fan of using '0' as a special pc value, there are embedded
> > targets where 0 is a valid pc value, but given we're already using 0
> > here, I propose to just roll with it.
> >
> > So, my proposal is that, if the pc is 0, add_sal_to_sals should always
> > add the sal. This fixes the decode_digits_list_mode, but should keep
> > the fix that c7a45b98a614 introduced.
> >
> > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33647
> > ---
> > gdb/linespec.c | 15 ++-
> > gdb/testsuite/gdb.base/list-multi-source.c | 60 +++++++++
> > gdb/testsuite/gdb.base/list-multi-source.exp | 129 +++++++++++++++++++
> > 3 files changed, 199 insertions(+), 5 deletions(-)
> > create mode 100644 gdb/testsuite/gdb.base/list-multi-source.c
> > create mode 100644 gdb/testsuite/gdb.base/list-multi-source.exp
>
> LGTM, also. I, too, think it should go into 17.
I agree that the fix should go into GDB 17, because otherwise it will
be a bad regression.
next prev parent reply other threads:[~2025-12-05 7:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 10:28 [PATCH 0/2] Fix regression in 'list' command Andrew Burgess
2025-11-18 10:28 ` [PATCH 1/2] gdb: fix 'list' for multiple source file results Andrew Burgess
2025-11-18 10:42 ` Andreas Schwab
2025-11-18 14:28 ` Andrew Burgess
2025-11-18 10:28 ` [PATCH 2/2] gdb: display a symbol more often in multi-file list output Andrew Burgess
2025-11-19 10:32 ` [PATCHv2 0/2] Fix regression in 'list' command Andrew Burgess
2025-11-19 10:32 ` [PATCHv2 1/2] gdb: fix 'list' for multiple source file results Andrew Burgess
2025-12-04 16:48 ` Tom Tromey
2025-12-05 10:50 ` Andrew Burgess
2025-12-04 20:18 ` Kevin Buettner
2025-12-05 7:14 ` Eli Zaretskii [this message]
2025-11-19 10:32 ` [PATCHv2 2/2] gdb: display a symbol more often in multi-file list output Andrew Burgess
2025-12-04 16:53 ` Tom Tromey
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=86ikelz9ge.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
/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