[Bug cli/33647] New: multi-file list output broken in gdb 17 branch (and on HEAD)

aburgess at redhat dot com sourceware-bugzilla@sourceware.org
Tue Nov 18 10:23:16 GMT 2025


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

            Bug ID: 33647
           Summary: multi-file list output broken in gdb 17 branch (and on
                    HEAD)
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: cli
          Assignee: unassigned at sourceware dot org
          Reporter: aburgess at redhat dot com
  Target Milestone: ---

Created attachment 16475
  --> https://sourceware.org/bugzilla/attachment.cgi?id=16475&action=edit
Test an possible fix.

Consider a project that contains multiple files called 'foo.c', the source tree
might look like:

 src/test.c
 src/a/foo.c
 src/b/foo.c

Using GDB 16, a debug session might look like this:

  (gdb) list foo.c:6
  file: "a/foo.c", line number: 6, symbol: "???"
  1     #include "the_header.h"
  2     
  3     int
  4     function_a ()
  5     {
  6       return 0;
  7     }
  file: "b/foo.c", line number: 6, symbol: "???"
  1     #include "the_header.h"
  2     
  3     int
  4     function_b ()
  5     {
  6       return 0;
  7     }
  (gdb) 

But using the GDB 17 branch we now get:

  (gdb) list foo.c:6
  1     #include "the_header.h"
  2     
  3     int
  4     function_a ()
  5     {
  6       return 0;
  7     }
  (gdb) 

I believe this was an unintended consequence of commit:

      commit c7a45b98a61451f05ff654c4fb72a9c9cb2fba36
      Date:   Thu Jun 12 15:37:50 2025 +0000

          gdb, linespec: avoid multiple locations with same PC

I'm going to mark this as a blocker for the GDB 17 release as this is (I think)
a regression.  I've attached the patch that I'm about to post to the mailing
list, but I need to open this first so I can add a 'Bug:' link to the commit
message.

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


More information about the Gdb-prs mailing list