public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] gdb-17.2-rebase-f44: Fix "sect_index_data not initialized" internal error. (RHBZ 2042664,
Date: Sun, 28 Jun 2026 00:00:34 GMT [thread overview]
Message-ID: <178260483436.1.8134611082546295514.rpms-gdb-6a0ae4aca360@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/gdb
Branch : gdb-17.2-rebase-f44
Commit : 6a0ae4aca3609401ffe2cd3e905148300fc55f6e
Author : Kevin Buettner <kevinb@redhat.com>
Date : 2022-02-01T13:14:01-07:00
Stats : +139/-1 in 5 file(s)
URL : https://src.fedoraproject.org/rpms/gdb/c/6a0ae4aca3609401ffe2cd3e905148300fc55f6e?branch=gdb-17.2-rebase-f44
Log:
Fix "sect_index_data not initialized" internal error. (RHBZ 2042664,
Kevin Buettner).
---
diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include
index 6b1ecc6..62e69cb 100644
--- a/_gdb.spec.Patch.include
+++ b/_gdb.spec.Patch.include
@@ -355,3 +355,7 @@ Patch085: gdb-rhbz2024875-pr27026.patch
# (RHBZ 2042257, Keith Seitz, Andrew Burgess)
Patch086: gdb-rhbz2042257-ftbs-updates.patch
+# Backport fix which fixes internal error due to libcc_s lacking a
+# .data section.
+Patch087: gdb-rhbz2042664-fix-sect_index_data-internal-error
+
diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include
index 965fc8c..470a7be 100644
--- a/_gdb.spec.patch.include
+++ b/_gdb.spec.patch.include
@@ -84,3 +84,4 @@
%patch084 -p1
%patch085 -p1
%patch086 -p1
+%patch087 -p1
diff --git a/_patch_order b/_patch_order
index b3eb6ce..4d9b861 100644
--- a/_patch_order
+++ b/_patch_order
@@ -84,3 +84,4 @@ gdb-rhbz2024875-fix-unittest-failure.patch
gdb-rhbz202487-rework-set-debuginfod.patch
gdb-rhbz2024875-pr27026.patch
gdb-rhbz2042257-ftbs-updates.patch
+gdb-rhbz2042664-fix-sect_index_data-internal-error
diff --git a/gdb-rhbz2042664-fix-sect_index_data-internal-error b/gdb-rhbz2042664-fix-sect_index_data-internal-error
new file mode 100644
index 0000000..0a2a459
--- /dev/null
+++ b/gdb-rhbz2042664-fix-sect_index_data-internal-error
@@ -0,0 +1,128 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Kevin Buettner <kevinb@redhat.com>
+Date: Tue, 1 Feb 2022 11:32:48 -0700
+Subject: gdb-rhbz2042664-fix-sect_index_data-internal-error
+
+;; Backport fix which fixes internal error due to libcc_s lacking a
+;; .data section.
+
+Fix GDB internal error by using text (instead of data) section offset
+
+Fedora Rawhide is now using gcc-12.0. As part of updating to the
+gcc-12.0 package set, Rawhide is also now using a version of libgcc_s
+which lacks a .data section. This causes gdb to fail in the following
+fashion while debugging a program (such as gdb) which uses libgcc_s:
+
+ (top-gdb) run
+ Starting program: rawhide-master/bld/gdb/gdb
+ ...
+ objfiles.h:467: internal-error: sect_index_data not initialized
+ A problem internal to GDB has been detected,
+ further debugging may prove unreliable.
+ ...
+
+I snipped the backtrace from the above output. Instead, here's a
+portion of a backtrace obtained using GDB's backtrace command.
+(Obviously, in order to obtain it, I used a GDB which has been patched
+with this commit.)
+
+ #0 internal_error (
+ file=0xc6a508 "gdb/objfiles.h", line=467,
+ fmt=0xc6a4e8 "sect_index_data not initialized")
+ at gdbsupport/errors.cc:51
+ #1 0x00000000005f9651 in objfile::data_section_offset (this=0x4fa48f0)
+ at gdb/objfiles.h:467
+ #2 0x000000000097c5f8 in relocate_address (address=0x17244, objfile=0x4fa48f0)
+ at gdb/stap-probe.c:1333
+ #3 0x000000000097c630 in stap_probe::get_relocated_address (this=0xa1a17a0,
+ objfile=0x4fa48f0)
+ at gdb/stap-probe.c:1341
+ #4 0x00000000004d7025 in create_exception_master_breakpoint_probe (
+ objfile=0x4fa48f0)
+ at gdb/breakpoint.c:3505
+ #5 0x00000000004d7426 in create_exception_master_breakpoint ()
+ at gdb/breakpoint.c:3575
+ #6 0x00000000004efcc1 in breakpoint_re_set ()
+ at gdb/breakpoint.c:13407
+ #7 0x0000000000956998 in solib_add (pattern=0x0, from_tty=0, readsyms=1)
+ at gdb/solib.c:1001
+ #8 0x00000000009576a8 in handle_solib_event ()
+ at gdb/solib.c:1269
+ ...
+
+The function 'relocate_address' in gdb/stap-probe.c attempts to do
+its "relocation" by using objfile->data_section_offset(). That
+method, data_section_offset() is defined as follows in objfiles.h:
+
+ CORE_ADDR data_section_offset () const
+ {
+ return section_offsets[SECT_OFF_DATA (this)];
+ }
+
+The internal error occurs when the SECT_OFF_DATA macro finds that the
+'sect_index_data' field is -1:
+
+ #define SECT_OFF_DATA(objfile) \
+ ((objfile->sect_index_data == -1) \
+ ? (internal_error (__FILE__, __LINE__, \
+ _("sect_index_data not initialized")), -1) \
+ : objfile->sect_index_data)
+
+relocate_address() is obtaining the section offset in order to compute
+a relocated address. For some ABIs, such as the System V ABI, the
+section offsets will all be the same. So for those ABIs, it doesn't
+matter which offset is used. However, other ABIs, such as the FDPIC
+ABI, will have different offsets for the various sections. Thus, for
+those ABIs, it is vital that this and other relocation code use the
+correct offset.
+
+In stap_probe::get_relocated_address, the address to which to add the
+offset (thus forming the relocated address) is obtained via
+this->get_address (); get_address is a getter for m_address in
+probe.h. It's documented/defined as follows (also in probe.h):
+
+ /* The address where the probe is inserted, relative to
+ SECT_OFF_TEXT. */
+ CORE_ADDR m_address;
+
+(Thanks to Tom Tromey for this observation.)
+
+So, based on this, the current use of data_section_offset /
+SECT_OFF_DATA is wrong. This relocation code should have been using
+text_section_offset / SECT_OFF_TEXT all along. That being the
+case, I've adjusted the stap-probe.c relocation code accordingly.
+
+Searching the sources turned up one other use of data_section_offset,
+in gdb/dtrace-probe.c, so I've updated that code as well. The same
+reasoning presented above applies to this case too.
+
+Summary:
+
+ * gdb/dtrace-probe.c (dtrace_probe::get_relocated_address):
+ Use method text_section_offset instead of data_section_offset.
+ * gdb/stap-probe.c (relocate_address): Likewise.
+
+diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
+--- a/gdb/dtrace-probe.c
++++ b/gdb/dtrace-probe.c
+@@ -684,7 +684,7 @@ dtrace_probe::is_enabled () const
+ CORE_ADDR
+ dtrace_probe::get_relocated_address (struct objfile *objfile)
+ {
+- return this->get_address () + objfile->data_section_offset ();
++ return this->get_address () + objfile->text_section_offset ();
+ }
+
+ /* Implementation of the get_argument_count method. */
+diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
+--- a/gdb/stap-probe.c
++++ b/gdb/stap-probe.c
+@@ -1330,7 +1330,7 @@ stap_probe::parse_arguments (struct gdbarch *gdbarch)
+ static CORE_ADDR
+ relocate_address (CORE_ADDR address, struct objfile *objfile)
+ {
+- return address + objfile->data_section_offset ();
++ return address + objfile->text_section_offset ();
+ }
+
+ /* Implementation of the get_relocated_address method. */
diff --git a/gdb.spec b/gdb.spec
index 6c8de94..26a7ef9 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -37,7 +37,7 @@ Version: 11.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: 11%{?dist}
+Release: 12%{?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
# Do not provide URL for snapshots as the file lasts there only for 2 days.
@@ -1144,6 +1144,10 @@ fi
%endif
%changelog
+* Mon Jan 31, 2022 Kevin Buettner <kevinb@redhat.com> - 11.1-12
+- Fix "sect_index_data not initialized" internal error. (RHBZ 2042664,
+ Kevin Buettner).
+
* Mon Jan 31 2022 Keith Seitz <keiths@redhat.com> - 11.1-11
- Fix buld issues. (RHBZ 2042257, Keith Seitz, Andrew Burgess)
- Update libipt to 2.0.5.
reply other threads:[~2026-06-28 0:00 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=178260483436.1.8134611082546295514.rpms-gdb-6a0ae4aca360@fedoraproject.org \
--to=kevinb@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