public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] gdb-17.2-rebase-f44: fix rhbz2403580 - misplaced symtabs due to dwz
Date: Sun, 28 Jun 2026 00:02:20 GMT [thread overview]
Message-ID: <178260494025.1.10996661853222947610.rpms-gdb-b49e5ebee412@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/gdb
Branch : gdb-17.2-rebase-f44
Commit : b49e5ebee412b686da8d12e4265bf68983dadc98
Author : Andrew Burgess <aburgess@redhat.com>
Date : 2026-02-09T10:39:26+00:00
Stats : +164/-1 in 5 file(s)
URL : https://src.fedoraproject.org/rpms/gdb/c/b49e5ebee412b686da8d12e4265bf68983dadc98?branch=gdb-17.2-rebase-f44
Log:
fix rhbz2403580 - misplaced symtabs due to dwz
Backport upstream commit 70b66cf338b14336 to fix RH BZ 2403580.
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2403580
---
diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include
index 0a55333..8d1afcd 100644
--- a/_gdb.spec.Patch.include
+++ b/_gdb.spec.Patch.include
@@ -31,3 +31,9 @@ Patch005: gdb-rhbz2424325-c23-more-const-fixes.patch
# (RH BZ 2424325).
Patch006: gdb-rhbz2424325-c++20-implicit-lambda-capture.patch
+# Backport of upstream commit 70b66cf338b14336 to address RHBZ
+# 2402580. This backport can be dropped when rebasing to GDB 18.
+# There were some moderate merge conflicts which needed resolving
+# when backporting this fix.
+Patch007: gdb-rhbz2403580-misplaced-symtabs.patch
+
diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include
index 5885b36..f6a9246 100644
--- a/_gdb.spec.patch.include
+++ b/_gdb.spec.patch.include
@@ -4,3 +4,4 @@
%patch -p1 -P004
%patch -p1 -P005
%patch -p1 -P006
+%patch -p1 -P007
diff --git a/_patch_order b/_patch_order
index c700282..3065678 100644
--- a/_patch_order
+++ b/_patch_order
@@ -4,3 +4,4 @@ gdb-rpm-suggestion-script.patch
gdb-rhbz2424325-c23-const-build-warnings.patch
gdb-rhbz2424325-c23-more-const-fixes.patch
gdb-rhbz2424325-c++20-implicit-lambda-capture.patch
+gdb-rhbz2403580-misplaced-symtabs.patch
diff --git a/gdb-rhbz2403580-misplaced-symtabs.patch b/gdb-rhbz2403580-misplaced-symtabs.patch
new file mode 100644
index 0000000..7996d82
--- /dev/null
+++ b/gdb-rhbz2403580-misplaced-symtabs.patch
@@ -0,0 +1,151 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Andrew Burgess <aburgess@redhat.com>
+Date: Thu, 11 Dec 2025 10:33:15 +0000
+Subject: gdb-rhbz2403580-misplaced-symtabs.patch
+
+;; Backport of upstream commit 70b66cf338b14336 to address RHBZ
+;; 2402580. This backport can be dropped when rebasing to GDB 18.
+;; There were some moderate merge conflicts which needed resolving
+;; when backporting this fix.
+
+diff --git a/gdb/dwarf2/line-header.c b/gdb/dwarf2/line-header.c
+--- a/gdb/dwarf2/line-header.c
++++ b/gdb/dwarf2/line-header.c
+@@ -417,3 +417,46 @@ dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
+
+ return lh;
+ }
++
++/* See dwarf2/line-header.h. */
++
++struct symtab *
++file_entry::symtab (dwarf2_cu &cu)
++{
++ if (m_symtab == nullptr)
++ {
++ buildsym_compunit *builder = cu.get_builder ();
++ compunit_symtab *cust = builder->get_compunit_symtab ();
++
++ {
++ std::string filename_holder;
++ const char *filename = this->name;
++ const char *dirname = cu.line_header->include_dir_at (this->d_index);
++
++ /* In order not to lose the line information directory,
++ we concatenate it to the filename when it makes sense.
++ Note that the Dwarf3 standard says (speaking of filenames in line
++ information): ``The directory index is ignored for file names
++ that represent full path names''. Thus ignoring dirname in the
++ `else' branch below isn't an issue. */
++
++ if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
++ {
++ filename_holder = path_join (dirname, filename);
++ filename = filename_holder.c_str ();
++ }
++
++ std::string filename_for_id = cu.line_header->file_file_name (*this);
++ cu.get_builder ()->start_subfile (filename, filename_for_id.c_str ());
++ }
++
++ subfile *sf = builder->get_current_subfile ();
++ if (sf->symtab == nullptr)
++ sf->symtab = allocate_symtab (cust, sf->name.c_str (),
++ sf->name_for_id.c_str ());
++
++ m_symtab = sf->symtab;
++ }
++
++ return m_symtab;
++}
+diff --git a/gdb/dwarf2/line-header.h b/gdb/dwarf2/line-header.h
+--- a/gdb/dwarf2/line-header.h
++++ b/gdb/dwarf2/line-header.h
+@@ -23,6 +23,7 @@
+ #include "dwarf2/types.h"
+
+ struct dwarf2_per_objfile;
++struct dwarf2_cu;
+
+ /* dir_index is 1-based in DWARF 4 and before, and is 0-based in DWARF 5 and
+ later. */
+@@ -65,8 +66,18 @@ struct file_entry
+
+ unsigned int length {};
+
++ /* Get the symtab for this file_entry. If no symtab has yet been created
++ or set (see set_symtab) for this file_entry then a new one will be
++ created. */
++ struct symtab *symtab (struct dwarf2_cu &cu);
++
++ /* Set the symtab for this file_entry. */
++ void set_symtab (struct symtab *s)
++ { m_symtab = s; }
++
++private:
+ /* The associated symbol table, if any. */
+- struct symtab *symtab {};
++ struct symtab *m_symtab {};
+ };
+
+ /* The line number information for a compilation unit (found in the
+diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
+--- a/gdb/dwarf2/read.c
++++ b/gdb/dwarf2/read.c
+@@ -6222,8 +6222,8 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
+ sf->symtab = allocate_symtab (cust, name, name_for_id);
+ }
+
+- fe.symtab = b->get_current_subfile ()->symtab;
+- tug_unshare->symtabs[i] = fe.symtab;
++ fe.set_symtab (b->get_current_subfile ()->symtab);
++ tug_unshare->symtabs[i] = fe.symtab (*this);
+ }
+ }
+ else
+@@ -6241,7 +6241,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
+ for (i = 0; i < file_names.size (); ++i)
+ {
+ file_entry &fe = file_names[i];
+- fe.symtab = tug_unshare->symtabs[i];
++ fe.set_symtab (tug_unshare->symtabs[i]);
+ }
+ }
+
+@@ -11584,7 +11584,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
+ {
+ /* Any related symtab will do. */
+ symtab
+- = cu->line_header->file_names ()[0].symtab;
++ = cu->line_header->file_names ()[0].symtab (*cu);
+ }
+ else
+ {
+@@ -16587,6 +16587,9 @@ dwarf_decode_lines (struct line_header *lh, struct dwarf2_cu *cu,
+ if (decode_mapping)
+ dwarf_decode_lines_1 (lh, cu, lowpc);
+
++ if (cu->per_cu->is_dwz)
++ return;
++
+ /* Make sure a symtab is created for every file, even files
+ which contain only variables (i.e. no code with associated
+ line numbers). */
+@@ -16602,7 +16605,7 @@ dwarf_decode_lines (struct line_header *lh, struct dwarf2_cu *cu,
+ sf->symtab = allocate_symtab (cust, sf->name.c_str (),
+ sf->name_for_id.c_str ());
+
+- fe.symtab = sf->symtab;
++ fe.set_symtab (sf->symtab);
+ }
+ }
+
+@@ -16879,7 +16882,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
+ if (fe == NULL)
+ complaint (_("file index out of range"));
+ else
+- sym->set_symtab (fe->symtab);
++ sym->set_symtab (fe->symtab (*file_cu));
+ }
+ }
+
diff --git a/gdb.spec b/gdb.spec
index a3ef8b0..d129865 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -45,7 +45,7 @@ Version: 17.1
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 2%{?dist}
+Release: 3%{?dist}
License: GPL-3.0-or-later AND BSD-3-Clause AND FSFAP AND LGPL-2.1-or-later AND GPL-2.0-or-later AND LGPL-2.0-or-later AND LicenseRef-Fedora-Public-Domain AND GFDL-1.3-or-later AND LGPL-2.0-or-later WITH GCC-exception-2.0 AND GPL-3.0-or-later WITH GCC-exception-3.1 AND GPL-2.0-or-later WITH GNU-compiler-exception AND MIT
# Do not provide URL for snapshots as the file lasts there only for 2 days.
@@ -932,6 +932,10 @@ fi
# endif scl
%changelog
+* Wed Feb 4 2026 Andrew Burgess <aburgess@redhat.com>
+- Backport upstream commit 70b66cf338b14336 to fix RH BZ 2402580.
+ This backport will not be needed once we rebase to GDB 18.
+
* Tue Feb 3 2026 Kevin Buettner <kevinb@redhat.com>
- Remove gcc-gdb-plugin BuildRequires and build with --disable-gdb-compile
due to this feature's brokenness. Tests using this feature skip cleanly
reply other threads:[~2026-06-28 0:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=178260494025.1.10996661853222947610.rpms-gdb-b49e5ebee412@fedoraproject.org \
--to=aburgess@redhat.com \
--cc=git-commits@fedoraproject.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