public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/gdb] gdb-17.2-rebase-f44: Fix -D_GLIBCXX_DEBUG gdb-add-index regression (RH BZ 1540559).
@ 2026-06-27 23:58 Jan Kratochvil
  0 siblings, 0 replies; only message in thread
From: Jan Kratochvil @ 2026-06-27 23:58 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/gdb
Branch : gdb-17.2-rebase-f44
Commit : 188c9fbf90e503935ad0216e74537a0c93bc5b07
Author : Jan Kratochvil <jan.kratochvil@redhat.com>
Date   : 2018-02-04T21:04:11+01:00
Stats  : +144/-1 in 5 file(s)
URL    : https://src.fedoraproject.org/rpms/gdb/c/188c9fbf90e503935ad0216e74537a0c93bc5b07?branch=gdb-17.2-rebase-f44

Log:
Fix -D_GLIBCXX_DEBUG gdb-add-index regression (RH BZ 1540559).

---
diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include
index ee306fd..d9dc3fc 100644
--- a/_gdb.spec.Patch.include
+++ b/_gdb.spec.Patch.include
@@ -517,3 +517,6 @@ Patch123: gdb-archer.patch
 # Revert upstream commit 469412dd9ccc4de5874fd3299b105833f36b34cd
 Patch124: gdb-vla-intel-fix-print-char-array.patch
 
+# Fix -D_GLIBCXX_DEBUG gdb-add-index regression (RH BZ 1540559).
+Patch125: gdb-rhbz1540559-gdbaddindex-glibcdebug-regression.patch
+

diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include
index 97f12c4..bd3879e 100644
--- a/_gdb.spec.patch.include
+++ b/_gdb.spec.patch.include
@@ -122,3 +122,4 @@
 %patch122 -p1
 %patch123 -p1
 %patch124 -p1
+%patch125 -p1

diff --git a/_patch_order b/_patch_order
index e5a85da..55d22e1 100644
--- a/_patch_order
+++ b/_patch_order
@@ -122,3 +122,4 @@ gdb-rhbz1398387-tab-crash-test.patch
 gdb-testsuite-readline63-sigint.patch
 gdb-archer.patch
 gdb-vla-intel-fix-print-char-array.patch
+gdb-rhbz1540559-gdbaddindex-glibcdebug-regression.patch

diff --git a/gdb-rhbz1540559-gdbaddindex-glibcdebug-regression.patch b/gdb-rhbz1540559-gdbaddindex-glibcdebug-regression.patch
new file mode 100644
index 0000000..e3d12ab
--- /dev/null
+++ b/gdb-rhbz1540559-gdbaddindex-glibcdebug-regression.patch
@@ -0,0 +1,135 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Jan Kratochvil <jan.kratochvil@redhat.com>
+Date: Sun, 4 Feb 2018 20:55:04 +0100
+Subject: gdb-rhbz1540559-gdbaddindex-glibcdebug-regression.patch
+
+FileName: gdb-rhbz1540559-gdbaddindex-glibcdebug-regression.patch
+
+;; Fix -D_GLIBCXX_DEBUG gdb-add-index regression (RH BZ 1540559).
+
+gdb: Out-of-bounds vector access while running gdb-add-index
+https://bugzilla.redhat.com/show_bug.cgi?id=1540559
+
+Fedora Rawhide started to use -D_GLIBCXX_DEBUG which made gdb-add-index
+failing.
+
+/usr/include/c++/7/debug/safe_iterator.h:270:
+Error: attempt to dereference a past-the-end iterator.
+Objects involved in the operation:
+    iterator "this" @ 0x0x7fffffffcb90 {
+      type = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<unsigned char*, std::__cxx1998::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > >, std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > > (mutable iterator);
+      state = past-the-end;
+      references sequence with type 'std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > >' @ 0x0x7fffffffcc50
+    }
+
+/usr/include/c++/7/debug/vector:417:
+Error: attempt to subscript container with out-of-bounds index 556, but
+container only holds 556 elements.
+Objects involved in the operation:
+    sequence "this" @ 0x0x2e87af8 {
+      type = std::__debug::vector<partial_symbol*, std::allocator<partial_symbol*> >;
+    }
+
+I do not know if anyone regression-tests GDB with -D_GLIBCXX_DEBUG,
+I have just checked -D_GLIBCXX_DEBUG run against gdb-add-index.
+
+The two -D_GLIBCXX_DEBUG regressions were made by:
+
+commit bc8f2430e08cc2a520db49a42686e0529be4a3bc
+Author: Jan Kratochvil <jan.kratochvil@redhat.com>
+Date:   Mon Jun 12 16:29:53 2017 +0100
+    Code cleanup: C++ify .gdb_index producer
+
+commit af5bf4ada48ff65b6658be1fab8f9c8f8ab5f319
+Author: Simon Marchi <simon.marchi@ericsson.com>
+Date:   Sat Oct 14 08:06:29 2017 -0400
+    Replace psymbol_allocation_list with std::vector
+
+gdb/ChangeLog
+2018-02-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* dwarf2read.c (data_buf::grow) (write_one_signatured_type)
+	(recursively_write_psymbols) (debug_names::recursively_write_psymbols)
+	(debug_names::write_one_signatured_type): Fix -D_GLIBCXX_DEBUG
+	regression.
+---
+ gdb/dwarf2read.c | 22 +++++++++++++---------
+ 1 file changed, 13 insertions(+), 9 deletions(-)
+
+diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+index 64329af71e..3c9b9dc188 100644
+--- a/gdb/dwarf2read.c
++++ b/gdb/dwarf2read.c
+@@ -25696,7 +25696,7 @@ private:
+   gdb_byte *grow (size_t size)
+   {
+     m_vec.resize (m_vec.size () + size);
+-    return &*m_vec.end () - size;
++    return &*(m_vec.end () - size);
+   }
+ 
+   gdb::byte_vector m_vec;
+@@ -26130,12 +26130,14 @@ write_one_signatured_type (void **slot, void *d)
+ 
+   write_psymbols (info->symtab,
+ 		  info->psyms_seen,
+-		  &info->objfile->global_psymbols[psymtab->globals_offset],
++		  (info->objfile->global_psymbols.data()
++		   + psymtab->globals_offset),
+ 		  psymtab->n_global_syms, info->cu_index,
+ 		  0);
+   write_psymbols (info->symtab,
+ 		  info->psyms_seen,
+-		  &info->objfile->static_psymbols[psymtab->statics_offset],
++		  (info->objfile->static_psymbols.data()
++		   + psymtab->statics_offset),
+ 		  psymtab->n_static_syms, info->cu_index,
+ 		  1);
+ 
+@@ -26185,12 +26187,12 @@ recursively_write_psymbols (struct objfile *objfile,
+ 
+   write_psymbols (symtab,
+ 		  psyms_seen,
+-		  &objfile->global_psymbols[psymtab->globals_offset],
++		  objfile->global_psymbols.data() + psymtab->globals_offset,
+ 		  psymtab->n_global_syms, cu_index,
+ 		  0);
+   write_psymbols (symtab,
+ 		  psyms_seen,
+-		  &objfile->static_psymbols[psymtab->statics_offset],
++		  objfile->static_psymbols.data() + psymtab->statics_offset,
+ 		  psymtab->n_static_syms, cu_index,
+ 		  1);
+ }
+@@ -26379,10 +26381,10 @@ public:
+ 				    psyms_seen, cu_index);
+ 
+     write_psymbols (psyms_seen,
+-		    &objfile->global_psymbols[psymtab->globals_offset],
++		    objfile->global_psymbols.data() + psymtab->globals_offset,
+ 		    psymtab->n_global_syms, cu_index, false, unit_kind::cu);
+     write_psymbols (psyms_seen,
+-		    &objfile->static_psymbols[psymtab->statics_offset],
++		    objfile->static_psymbols.data() + psymtab->statics_offset,
+ 		    psymtab->n_static_syms, cu_index, true, unit_kind::cu);
+   }
+ 
+@@ -26738,11 +26740,13 @@ private:
+     struct partial_symtab *psymtab = entry->per_cu.v.psymtab;
+ 
+     write_psymbols (info->psyms_seen,
+-		    &info->objfile->global_psymbols[psymtab->globals_offset],
++		    (info->objfile->global_psymbols.data()
++		     + psymtab->globals_offset),
+ 		    psymtab->n_global_syms, info->cu_index, false,
+ 		    unit_kind::tu);
+     write_psymbols (info->psyms_seen,
+-		    &info->objfile->static_psymbols[psymtab->statics_offset],
++		    (info->objfile->static_psymbols.data()
++		     + psymtab->statics_offset),
+ 		    psymtab->n_static_syms, info->cu_index, true,
+ 		    unit_kind::tu);
+ 
+-- 
+2.14.3
+

diff --git a/gdb.spec b/gdb.spec
index 5b86126..83d3057 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -26,7 +26,7 @@ Version: 8.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: 3%{?dist}
+Release: 4%{?dist}
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
 Group: Development/Debuggers
@@ -1017,6 +1017,9 @@ then
 fi
 
 %changelog
+* Sun Feb  4 2018 Jan Kratochvil <jan.kratochvil@redhat.com> - 8.1-4.fc28
+- Fix -D_GLIBCXX_DEBUG gdb-add-index regression (RH BZ 1540559).
+
 * Wed Jan 31 2018 Sergio Durigan Junior <sergiodj@redhat.com> - 8.1-3.fc26
 - Rebase to FSF GDB 8.1.
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-27 23:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-27 23:58 [rpms/gdb] gdb-17.2-rebase-f44: Fix -D_GLIBCXX_DEBUG gdb-add-index regression (RH BZ 1540559) Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox