Compare commits

...

6 Commits

Author SHA1 Message Date
David Abdurachmanov 6b9a67d331
Merge remote-tracking branch 'up/main' into main-riscv64
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2024-02-05 17:17:27 +02:00
Kevin Buettner 0ef7ce6648 Backport upstream workaround for GCC 14 problem
The GCC problem is responsible for GDB internal errors.  See:

https://sourceware.org/bugzilla/show_bug.cgi?id=31281
2024-01-29 15:59:22 -07:00
Guinevere Larsen ce2a1b8ca4 remove gdb-6.5-BEA-testsuite.patch
A similar version was accepted upstream and will make its way back here
with the next rebase.
2024-01-25 19:27:30 +01:00
Guinevere Larsen 9283c2ae14 backport gdb: fix "list ." related crash
This fixes RHBZ 2259850
2024-01-25 18:26:48 +01:00
Fedora Release Engineering c1639496fb Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-24 12:37:59 +00:00
Fedora Release Engineering 0a28429a4a Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-19 20:23:22 +00:00
7 changed files with 228 additions and 988 deletions

View File

@ -10,148 +10,144 @@ Patch002: gdb-6.3-gstack-20050411.patch
#=push+jan: It should be replaced by Infinity project.
Patch003: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
# Improved testsuite results by the testsuite provided by the courtesy of BEA.
#=fedoratest: For upstream it should be rewritten as a dejagnu test, the test of no "??" was useful.
Patch004: gdb-6.5-BEA-testsuite.patch
# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
#=fedoratest
Patch005: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Patch004: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
# Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517).
#=fedoratest
Patch006: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch005: gdb-6.6-bz229517-gcore-without-terminal.patch
# Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
#=fedoratest
Patch007: gdb-6.6-testsuite-timeouts.patch
Patch006: gdb-6.6-testsuite-timeouts.patch
# Support for stepping over PPC atomic instruction sequences (BZ 237572).
#=fedoratest
Patch008: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Patch007: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
# Test kernel VDSO decoding while attaching to an i386 process.
#=fedoratest
Patch009: gdb-6.3-attach-see-vdso-test.patch
Patch008: gdb-6.3-attach-see-vdso-test.patch
# Test leftover zombie process (BZ 243845).
#=fedoratest
Patch010: gdb-6.5-bz243845-stale-testing-zombie-test.patch
Patch009: gdb-6.5-bz243845-stale-testing-zombie-test.patch
# New locating of the matching binaries from the pure core file (build-id).
#=push+jan
Patch011: gdb-6.6-buildid-locate.patch
Patch010: gdb-6.6-buildid-locate.patch
# Fix loading of core files without build-ids but with build-ids in executables.
# Load strictly build-id-checked core files only if no executable is specified
# (Jan Kratochvil, RH BZ 1339862).
#=push+jan
Patch012: gdb-6.6-buildid-locate-solib-missing-ids.patch
Patch011: gdb-6.6-buildid-locate-solib-missing-ids.patch
#=push+jan
Patch013: gdb-6.6-buildid-locate-rpm.patch
Patch012: gdb-6.6-buildid-locate-rpm.patch
# Test PPC hiding of call-volatile parameter register.
#=fedoratest
Patch014: gdb-6.7-ppc-clobbered-registers-O2-test.patch
Patch013: gdb-6.7-ppc-clobbered-registers-O2-test.patch
# Test gcore memory and time requirements for large inferiors.
#=fedoratest
Patch015: gdb-6.5-gcore-buffer-limit-test.patch
Patch014: gdb-6.5-gcore-buffer-limit-test.patch
# Test GCORE for shmid 0 shared memory mappings.
#=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible.
Patch016: gdb-6.3-mapping-zero-inode-test.patch
Patch015: gdb-6.3-mapping-zero-inode-test.patch
# Test a crash on libraries missing the .text section.
#=fedoratest
Patch017: gdb-6.5-section-num-fixup-test.patch
Patch016: gdb-6.5-section-num-fixup-test.patch
# Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
#=fedoratest
Patch018: gdb-6.8-bz466901-backtrace-full-prelinked.patch
Patch017: gdb-6.8-bz466901-backtrace-full-prelinked.patch
# New test for step-resume breakpoint placed in multiple threads at once.
#=fedoratest
Patch019: gdb-simultaneous-step-resume-breakpoint-test.patch
Patch018: gdb-simultaneous-step-resume-breakpoint-test.patch
# Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
# Fix regression of undisplayed missing shared libraries caused by a fix for.
#=fedoratest: It should be in glibc: libc-alpha: <20091004161706.GA27450@.*>
Patch020: gdb-core-open-vdso-warning.patch
Patch019: gdb-core-open-vdso-warning.patch
# Fix follow-exec for C++ programs (bugreported by Martin Stransky).
#=fedoratest
Patch021: gdb-archer-next-over-throw-cxx-exec.patch
Patch020: gdb-archer-next-over-throw-cxx-exec.patch
# Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
#=push+jan
Patch022: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Patch021: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
# [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604).
#=fedoratest
Patch023: gdb-test-bt-cfi-without-die.patch
Patch022: gdb-test-bt-cfi-without-die.patch
# Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108).
#=fedoratest
Patch024: gdb-bz634108-solib_address.patch
Patch023: gdb-bz634108-solib_address.patch
# [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp.
#=fedoratest
Patch025: gdb-test-dw2-aranges.patch
Patch024: gdb-test-dw2-aranges.patch
# Workaround PR libc/14166 for inferior calls of strstr.
#=fedoratest: Compatibility with RHELs (unchecked which ones).
Patch026: gdb-glibc-strstr-workaround.patch
Patch025: gdb-glibc-strstr-workaround.patch
# Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
#=fedoratest
Patch027: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Patch026: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
# Import regression test for `gdb/findvar.c:417: internal-error:
# read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5.
#=fedoratest
Patch028: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
Patch027: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
# Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
#=fedoratest
Patch029: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Patch028: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
# Fix 'gdb gives highly misleading error when debuginfo pkg is present,
# but not corresponding binary pkg' (RH BZ 981154).
#=push+jan
Patch030: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
Patch029: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
# Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to
# crash.' (RH BZ 1156192).
#=fedoratest
Patch031: gdb-rhbz1156192-recursive-dlopen-test.patch
Patch030: gdb-rhbz1156192-recursive-dlopen-test.patch
# Fix '`catch syscall' doesn't work for parent after `fork' is called'
# (Philippe Waroquiers, RH BZ 1149205).
#=fedoratest
Patch032: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Patch031: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
# Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
# Kratochvil, RH BZ 1084404).
#=fedoratest
Patch033: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Patch032: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
# Force libncursesw over libncurses to match the includes (RH BZ 1270534).
#=push+jan
Patch034: gdb-fedora-libncursesw.patch
Patch033: gdb-fedora-libncursesw.patch
# [aarch64] Fix hardware watchpoints (RH BZ 1261564).
#=fedoratest
Patch035: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Patch034: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
# Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114).
#=fedora
Patch036: gdb-container-rh-pkg.patch
Patch035: gdb-container-rh-pkg.patch
# [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513).
#=fedora
Patch037: gdb-linux_perf-bundle.patch
Patch036: gdb-linux_perf-bundle.patch
# Update gdb-add-index.sh such that, when the GDB environment
# variable is not set, the script is smarter than just looking for
@ -165,37 +161,44 @@ Patch037: gdb-linux_perf-bundle.patch
# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot
#
#=fedora
Patch038: gdb-add-index.patch
Patch037: gdb-add-index.patch
# Back-port upstream commit 1f0fab7ff86 as part of a fix for
# non-deterministic gdb-index generation (RH BZ 2232086).
Patch039: gdb-rhbz2232086-refactor-selftest-support.patch
Patch038: gdb-rhbz2232086-refactor-selftest-support.patch
# Back-port upstream commit aa19bc1d259 as part of a fix for
# non-deterministic gdb-index generation (RH BZ 2232086).
Patch040: gdb-rhbz-2232086-reduce-size-of-gdb-index.patch
Patch039: gdb-rhbz-2232086-reduce-size-of-gdb-index.patch
# Back-port upstream commit acc117b57f7 as part of a fix for
# non-deterministic gdb-index generation (RH BZ 2232086).
Patch041: gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
Patch040: gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
# Back-port upstream commit aff250145af as part of a fix for
# non-deterministic gdb-index generation (RH BZ 2232086).
Patch042: gdb-rhbz-2232086-generate-gdb-index-consistently.patch
Patch041: gdb-rhbz-2232086-generate-gdb-index-consistently.patch
# Back-port upstream commit 3644f41dc80 as part of a fix for
# non-deterministic gdb-index generation (RH BZ 2232086).
Patch043: gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch
Patch042: gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch
Patch044: gdb-rhbz2250652-gdbpy_gil.patch
Patch043: gdb-rhbz2250652-gdbpy_gil.patch
Patch045: gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch
Patch044: gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch
# Backport potential fix for RH BZ 2257562.
Patch046: gdb-rhbz2257562-cp-namespace-null-ptr-check.patch
Patch045: gdb-rhbz2257562-cp-namespace-null-ptr-check.patch
Patch047: gdb-ftbs-swapped-calloc-args.patch
Patch046: gdb-ftbs-swapped-calloc-args.patch
# Backport gdb: fix "list ." related crash
Patch047: gdb-rhbz2259850-list-period-crash-fix.patch
# Backport upstream workaround for GCC 14 problem which cause assertion
# failures in GDB.
Patch048: gdb-rhbz2261580-intrusive_list-assertion-fix.patch

View File

@ -45,3 +45,4 @@
%patch -p1 -P045
%patch -p1 -P046
%patch -p1 -P047
%patch -p1 -P048

View File

@ -1,7 +1,6 @@
gdb-6.3-rh-testversion-20041202.patch
gdb-6.3-gstack-20050411.patch
gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
gdb-6.5-BEA-testsuite.patch
gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
gdb-6.6-bz229517-gcore-without-terminal.patch
gdb-6.6-testsuite-timeouts.patch
@ -45,3 +44,5 @@ gdb-rhbz2250652-gdbpy_gil.patch
gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch
gdb-rhbz2257562-cp-namespace-null-ptr-check.patch
gdb-ftbs-swapped-calloc-args.patch
gdb-rhbz2259850-list-period-crash-fix.patch
gdb-rhbz2261580-intrusive_list-assertion-fix.patch

View File

@ -1,938 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-BEA-testsuite.patch
;; Improved testsuite results by the testsuite provided by the courtesy of BEA.
;;=fedoratest: For upstream it should be rewritten as a dejagnu test, the test of no "??" was useful.
diff --git a/gdb/testsuite/gdb.threads/threadcrash.c b/gdb/testsuite/gdb.threads/threadcrash.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threadcrash.c
@@ -0,0 +1,301 @@
+/*
+ * The point of this program is to crash in a multi-threaded app.
+ * There are seven threads, doing the following things:
+ * * Spinning
+ * * Spinning inside a signal handler
+ * * Spinning inside a signal handler executing on the altstack
+ * * In a syscall
+ * * In a syscall inside a signal handler
+ * * In a syscall inside a signal handler executing on the altstack
+ * * Finally, the main thread crashes in main, with no frills.
+ *
+ * These are the things threads in JRockit tend to be doing. If gdb
+ * can handle those things, both in core files and during live
+ * debugging, that will help (at least) JRockit development.
+ *
+ * Let the program create a core file, then load the core file into
+ * gdb. Inside gdb, you should be able to do something like this:
+ *
+ * (gdb) t a a bt
+ *
+ * Thread 7 (process 4352):
+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6
+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6
+ * #2 0x080488a2 in makeSyscall (ignored=0x0) at threadcrash.c:118
+ * #3 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
+ * #4 0x001ed19a in clone () from /lib/tls/libc.so.6
+ *
+ * Thread 6 (process 4353):
+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6
+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6
+ * #2 0x0804898f in syscallingSighandler (signo=10, info=0xb6be76f0, context=0xb6be7770)
+ * at threadcrash.c:168
+ * #3 <signal handler called>
+ * #4 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
+ * #5 0x08048a51 in makeSyscallFromSighandler (ignored=0x0) at threadcrash.c:204
+ * #6 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
+ * #7 0x001ed19a in clone () from /lib/tls/libc.so.6
+ *
+ * Thread 5 (process 4354):
+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6
+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6
+ * #2 0x08048936 in syscallingAltSighandler (signo=3, info=0x959cd70, context=0x959cdf0)
+ * at threadcrash.c:144
+ * #3 <signal handler called>
+ * #4 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
+ * #5 0x080489e2 in makeSyscallFromAltSighandler (ignored=0x0) at threadcrash.c:190
+ * #6 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
+ * #7 0x001ed19a in clone () from /lib/tls/libc.so.6
+ *
+ * Thread 4 (process 4355):
+ * #0 spin (ignored=0x0) at threadcrash.c:242
+ * #1 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
+ * #2 0x001ed19a in clone () from /lib/tls/libc.so.6
+ *
+ * Thread 3 (process 4356):
+ * #0 spinningSighandler (signo=12, info=0xb4de46f0, context=0xb4de4770) at threadcrash.c:180
+ * #1 <signal handler called>
+ * #2 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
+ * #3 0x08048b2f in spinFromSighandler (ignored=0x0) at threadcrash.c:232
+ * #4 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
+ * #5 0x001ed19a in clone () from /lib/tls/libc.so.6
+ *
+ * Thread 2 (process 4357):
+ * #0 spinningAltSighandler (signo=14, info=0x959ee50, context=0x959eed0) at threadcrash.c:156
+ * #1 <signal handler called>
+ * #2 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
+ * #3 0x08048ac0 in spinFromAltSighandler (ignored=0x0) at threadcrash.c:218
+ * #4 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
+ * #5 0x001ed19a in clone () from /lib/tls/libc.so.6
+ *
+ * Thread 1 (process 4351):
+ * #0 0x08048cf3 in main (argc=1, argv=0xbfff9d74) at threadcrash.c:273
+ * (gdb)
+ */
+
+#include <pthread.h>
+#include <signal.h>
+#include <assert.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define SIGSYSCALL_ALT SIGQUIT
+#define SIGSYSCALL SIGUSR1
+#define SIGSPIN_ALT SIGALRM
+#define SIGSPIN SIGUSR2
+
+typedef void (*sigaction_t)(int, siginfo_t *, void *);
+
+static void installHandler(int signo, sigaction_t handler, int onAltstack) {
+ struct sigaction action;
+ sigset_t sigset;
+ int result;
+ stack_t altstack;
+ stack_t oldaltstack;
+
+ memset(&action, 0, sizeof(action));
+ memset(&altstack, 0, sizeof(altstack));
+ memset(&oldaltstack, 0, sizeof(oldaltstack));
+
+ if (onAltstack) {
+ altstack.ss_sp = malloc(SIGSTKSZ);
+ assert(altstack.ss_sp != NULL);
+ altstack.ss_size = SIGSTKSZ;
+ altstack.ss_flags = 0;
+ result = sigaltstack(&altstack, &oldaltstack);
+ assert(result == 0);
+ assert(oldaltstack.ss_flags == SS_DISABLE);
+ }
+
+ sigemptyset(&sigset);
+
+ action.sa_handler = NULL;
+ action.sa_sigaction = handler;
+ action.sa_mask = sigset;
+ action.sa_flags = SA_SIGINFO;
+ if (onAltstack) {
+ action.sa_flags |= SA_ONSTACK;
+ }
+
+ result = sigaction(signo, &action, NULL);
+ assert(result == 0);
+}
+
+static void installNormalHandler(int signo, sigaction_t handler) {
+ installHandler(signo, handler, 0);
+}
+
+static void installAlthandler(int signo, sigaction_t handler) {
+ installHandler(signo, handler, 1);
+}
+
+static void *makeSyscall(void *ignored) {
+ (void)ignored;
+
+ sleep(42);
+
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
+ return NULL;
+}
+
+/* Return true if we're currently executing on the altstack */
+static int onAltstack(void) {
+ stack_t stack;
+ int result;
+
+ result = sigaltstack(NULL, &stack);
+ assert(result == 0);
+
+ return stack.ss_flags & SS_ONSTACK;
+}
+
+static void syscallingAltSighandler(int signo, siginfo_t *info, void *context) {
+ (void)signo;
+ (void)info;
+ (void)context;
+
+ if (!onAltstack()) {
+ printf("%s() not running on altstack!\n", __FUNCTION__);
+ }
+
+ sleep(42);
+}
+
+static void spinningAltSighandler(int signo, siginfo_t *info, void *context) {
+ (void)signo;
+ (void)info;
+ (void)context;
+
+ if (!onAltstack()) {
+ printf("%s() not running on altstack!\n", __FUNCTION__);
+ }
+
+ while (1);
+}
+
+static void syscallingSighandler(int signo, siginfo_t *info, void *context) {
+ (void)signo;
+ (void)info;
+ (void)context;
+
+ if (onAltstack()) {
+ printf("%s() running on altstack!\n", __FUNCTION__);
+ }
+
+ sleep(42);
+}
+
+static void spinningSighandler(int signo, siginfo_t *info, void *context) {
+ (void)signo;
+ (void)info;
+ (void)context;
+
+ if (onAltstack()) {
+ printf("%s() running on altstack!\n", __FUNCTION__);
+ }
+
+ while (1);
+}
+
+static void *makeSyscallFromAltSighandler(void *ignored) {
+ (void)ignored;
+
+ int result;
+
+ installAlthandler(SIGSYSCALL_ALT, syscallingAltSighandler);
+
+ result = pthread_kill(pthread_self(), SIGSYSCALL_ALT);
+ assert(result == 0);
+
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
+ return NULL;
+}
+
+static void *makeSyscallFromSighandler(void *ignored) {
+ (void)ignored;
+
+ int result;
+
+ installNormalHandler(SIGSYSCALL, syscallingSighandler);
+
+ result = pthread_kill(pthread_self(), SIGSYSCALL);
+ assert(result == 0);
+
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
+ return NULL;
+}
+
+static void *spinFromAltSighandler(void *ignored) {
+ (void)ignored;
+
+ int result;
+
+ installAlthandler(SIGSPIN_ALT, spinningAltSighandler);
+
+ result = pthread_kill(pthread_self(), SIGSPIN_ALT);
+ assert(result == 0);
+
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
+ return NULL;
+}
+
+static void *spinFromSighandler(void *ignored) {
+ (void)ignored;
+
+ int result;
+
+ installNormalHandler(SIGSPIN, spinningSighandler);
+
+ result = pthread_kill(pthread_self(), SIGSPIN);
+ assert(result == 0);
+
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
+ return NULL;
+}
+
+static void *spin(void *ignored) {
+ (void)ignored;
+
+ while (1);
+
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
+ return NULL;
+}
+
+int main(int argc, char *argv[]) {
+ int result;
+ pthread_t thread;
+ volatile int bad;
+
+ result = pthread_create(&thread, NULL, makeSyscall, NULL);
+ assert(result == 0);
+ result = pthread_create(&thread, NULL, makeSyscallFromSighandler, NULL);
+ assert(result == 0);
+ result = pthread_create(&thread, NULL, makeSyscallFromAltSighandler, NULL);
+ assert(result == 0);
+ result = pthread_create(&thread, NULL, spin, NULL);
+ assert(result == 0);
+ result = pthread_create(&thread, NULL, spinFromSighandler, NULL);
+ assert(result == 0);
+ result = pthread_create(&thread, NULL, spinFromAltSighandler, NULL);
+ assert(result == 0);
+
+ // Give threads some time to get going
+ sleep(3);
+
+ // Crash
+ bad = *(int*)7;
+
+ /* Workaround: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29628
+ Simulate use to ensure `DW_AT_location' for them:
+ readelf -a --debug threadcrash|grep -A5 -w argc
+ --> DW_AT_location : 2 byte block: 71 0 (DW_OP_breg1: 0)
+ This case verified on: gcc-4.1.1-30.i386
+ Keep it late to ensure persistency in the registers. */
+ bad = (int) argc;
+ bad = (unsigned long) argv;
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threadcrash.exp
@@ -0,0 +1,37 @@
+# threadcrash.exp - The point of this program is to crash in a multi-threaded app.
+
+
+set testfile threadcrash
+set srcfile ${testfile}.c
+set shellfile ${srcdir}/${subdir}/${testfile}.sh
+set binfile [standard_output_file ${testfile}]
+
+set GDB_abs ${GDB}
+if [regexp "^\[^/\]" ${GDB_abs}] {
+ set GDB_abs $env(PWD)/${GDB_abs}
+}
+
+if [istarget "*-*-linux"] then {
+ set target_cflags "-D_MIT_POSIX_THREADS"
+} else {
+ set target_cflags ""
+}
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ return -1
+}
+
+# ${shellfile} argument must not contain any directories.
+set fd [open "|bash ${shellfile} ${binfile} $GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]" r]
+while { [gets $fd line] >= 0 } {
+ if [regexp " PASS: (.*)$" $line trash message] {
+ pass $message
+ } elseif [regexp " FAIL: (.*)$" $line trash message] {
+ fail $message
+ }
+}
+catch {
+ close $fd
+}
+
+return 0
diff --git a/gdb/testsuite/gdb.threads/threadcrash.sh b/gdb/testsuite/gdb.threads/threadcrash.sh
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threadcrash.sh
@@ -0,0 +1,324 @@
+#! /bin/bash
+
+# NOTE: threadcrash.c *must* be built with debugging symbols
+#
+# The point of this shell script is to crash treadcrash.c, load the
+# resulting core file into gdb and verify that gdb can extract enough
+# information from the core file.
+#
+# The return code from this script is the number of failed tests.
+
+LOG=gdbresult.log
+
+if [ $# = 0 ] ; then
+ echo >&2 Syntax: $0 \<name of threadcrash binary\> [\<gdb binary\> \<args...\>]
+ exit 1
+fi
+RUNME="$1"
+shift
+GDB="${*:-gdb}"
+
+
+pf_prefix=""
+function pf_prefix() {
+ pf_prefix="$*"
+}
+
+set_test=""
+function set_test() {
+ if [ -n "$set_test" ] ; then
+ echo >&2 "DEJAGNU-BASH ERROR: set_test already set"
+ exit 1
+ fi
+ set_test="$*"
+ if [ -n "$pf_prefix" ] ; then
+ set_test="$pf_prefix: $set_test"
+ fi
+}
+
+# INTERNAL
+function record_test {
+ if [ -z "$set_test" ] ; then
+ echo >&2 "DEJAGNU-BASH ERROR: set_test not set"
+ exit 1
+ fi
+ # Provide the leading whitespace delimiter:
+ echo " $1: $set_test"
+ set_test=""
+}
+
+function pass() {
+ record_test PASS
+}
+function fail() {
+ record_test FAIL
+}
+
+
+# Verify that the gdb output doesn't contain $1.
+function mustNotHave() {
+ local BADWORD=$1
+ set_test gdb output contains "$BADWORD"
+ if grep -q "$BADWORD" $LOG ; then
+ fail
+ return 1
+ fi
+ pass
+ return 0
+}
+
+# Verify that the gdb output contains exactly $1 $2s.
+function mustHaveCorrectAmount() {
+ local WANTEDNUMBER=$1
+ local GOODWORD=$2
+ local ACTUALNUMBER=$(grep "$GOODWORD" $LOG | wc -l)
+ set_test gdb output contained $ACTUALNUMBER \""$GOODWORD"\", not $WANTEDNUMBER as expected
+ if [ $ACTUALNUMBER != $WANTEDNUMBER ] ; then
+ fail
+ return 1
+ fi
+ pass
+ return 0
+}
+
+# Verify that the gdb output contains seven threads
+function mustHaveSevenThreads() {
+ NTHREADS=$(egrep "^Thread [1-7] \(" $LOG | wc -l)
+ set_test gdb output contains $NTHREADS threads, not 7 as expected
+ if [ $NTHREADS != 7 ] ; then
+ fail
+ return 1
+ fi
+ pass
+ return 0
+}
+
+# Verify that the gdb output has all parameters on consecutive lines
+function mustHaveSequence() {
+ SEQUENCE="$*"
+ NPARTS=$#
+ grep "$1" -A$((NPARTS - 1)) $LOG > matches.log
+
+ while [ $# -gt 1 ] ; do
+ shift
+ ((NPARTS--))
+ grep "$1" -A$((NPARTS - 1)) matches.log > temp.log
+ mv temp.log matches.log
+ done
+ LASTPART=$1
+
+ set_test gdb output does not contain the sequence: $SEQUENCE
+ if ! grep -q "$LASTPART" matches.log ; then
+ fail
+ return 1
+ fi
+ pass
+ return 0
+}
+
+# Verify that $LOG contains all information we want
+function verifyLog() {
+ local FAILURES=0
+
+ mustNotHave '??' || ((FAILURES++))
+ mustHaveCorrectAmount 11 threadcrash.c: || ((FAILURES++))
+
+ mustHaveSevenThreads || ((FAILURES++))
+ mustHaveSequence sleep "makeSyscall (ignored=" || ((FAILURES++))
+
+ mustHaveSequence sleep "syscallingSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
+ mustHaveSequence pthread_kill "makeSyscallFromSighandler (ignored=" || ((FAILURES++))
+
+ mustHaveSequence sleep "syscallingAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
+ mustHaveSequence pthread_kill "makeSyscallFromAltSighandler (ignored=" || ((FAILURES++))
+
+ mustHaveSequence Thread "spin (ignored=" || ((FAILURES++))
+
+ mustHaveSequence "spinningSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
+ mustHaveSequence pthread_kill "spinFromSighandler (ignored=" || ((FAILURES++))
+
+ mustHaveSequence "spinningAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
+ mustHaveSequence pthread_kill "spinFromAltSighandler (ignored=" || ((FAILURES++))
+
+ mustHaveSequence Thread "main (argc=1, argv=" || ((FAILURES++))
+
+ return $FAILURES
+}
+
+# Put result of debugging a core file in $LOG
+function getLogFromCore() {
+ # Make sure we get a core file
+ set_test Make sure we get a core file
+ if ! ulimit -c unlimited ; then
+ fail
+ exit 1
+ fi
+ pass
+
+ # Run the crasher
+ ./$(basename "$RUNME")
+ EXITCODE=$?
+
+ # Verify that we actually crashed
+ set_test $RUNME should have been killed by a signal, got non-signal exit code $EXITCODE
+ if [ $EXITCODE -lt 128 ] ; then
+ fail
+ exit 1
+ fi
+ pass
+
+ # Verify that we got a core file
+ set_test $RUNME did not create a core file
+ if [ ! -r core* ] ; then
+ fail
+ exit 1
+ fi
+ pass
+
+ # Run gdb
+ cat > gdbscript.gdb <<EOF
+set width 0
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" core* > $LOG
+ EXITCODE=$?
+
+ set_test gdb exited with error code
+ if [ $EXITCODE != 0 ] ; then
+ ((FAILURES++))
+ echo >&2 gdb exited with error code $EXITCODE
+ fail
+ fi
+ pass
+}
+
+# Put result of debugging a gcore file in $LOG
+function getLogFromGcore() {
+ # Create the core file
+ rm -f core*
+ cat > gdbscript.gdb <<EOF
+handle SIGQUIT pass noprint nostop
+handle SIGUSR1 pass noprint nostop
+handle SIGUSR2 pass noprint nostop
+handle SIGALRM pass noprint nostop
+run
+gcore
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" > /dev/null
+ EXITCODE=$?
+
+ set_test gdb exited with error code when creating gcore file
+ if [ $EXITCODE != 0 ] ; then
+ ((FAILURES++))
+ echo >&2 gdb exited with error code $EXITCODE when creating gcore file
+ fail
+ fi
+ pass
+
+ # Verify that we got a core file from gcore
+ set_test gdb gcore did not create a core file
+ if [ ! -r core* ] ; then
+ fail
+ exit 1
+ fi
+ pass
+
+ # Run gdb on the gcore file
+ cat > gdbscript.gdb <<EOF
+set width 0
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" core* > $LOG
+ EXITCODE=$?
+
+ set_test gdb exited with error code when examining gcore file
+ if [ $EXITCODE != 0 ] ; then
+ ((FAILURES++))
+ echo >&2 gdb exited with error code $EXITCODE when examining gcore file
+ fail
+ fi
+ pass
+}
+
+# Put result of debugging a core file in $LOG
+function getLogFromLiveProcess() {
+ # Run gdb
+ cat > gdbscript.gdb <<EOF
+handle SIGQUIT pass noprint nostop
+handle SIGUSR1 pass noprint nostop
+handle SIGUSR2 pass noprint nostop
+handle SIGALRM pass noprint nostop
+set width 0
+run
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" > $LOG
+ EXITCODE=$?
+
+ set_test gdb exited with error code
+ if [ $EXITCODE != 0 ] ; then
+ ((FAILURES++))
+ echo >&2 gdb exited with error code $EXITCODE
+ fail
+ fi
+ pass
+}
+
+####### Main program follows #####################
+
+# Make sure we don't clobber anybody else's (core) file(s)
+WORKDIR=/tmp/$PPID
+mkdir -p $WORKDIR
+cp "$RUNME" $WORKDIR
+cd $WORKDIR
+
+# Count problems
+FAILURES=0
+
+echo === Testing gdb vs core file...
+pf_prefix core file
+getLogFromCore
+verifyLog
+((FAILURES+=$?))
+pf_prefix
+echo === Core file tests done.
+
+echo
+
+echo === Testing gdb vs gcore file...
+pf_prefix gcore file
+getLogFromGcore
+verifyLog
+((FAILURES+=$?))
+pf_prefix
+echo === Gcore file tests done.
+
+echo
+
+echo === Testing gdb vs live process...
+pf_prefix live process
+getLogFromLiveProcess
+verifyLog
+((FAILURES+=$?))
+pf_prefix
+echo === Live process tests done.
+
+# Executive summary
+echo
+if [ $FAILURES == 0 ] ; then
+ echo All tests passed!
+else
+ echo $FAILURES tests failed!
+ echo
+ echo Make sure the threadcrash binary contains debugging information \(build with \"gcc -g\"\).
+fi
+
+# Clean up
+cd /
+rm -rf $WORKDIR
+
+exit $FAILURES
diff --git a/gdb/testsuite/gdb.threads/threadcrash.sh-orig b/gdb/testsuite/gdb.threads/threadcrash.sh-orig
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threadcrash.sh-orig
@@ -0,0 +1,248 @@
+#! /bin/bash
+
+# NOTE: threadcrash.c *must* be built with debugging symbols
+#
+# The point of this shell script is to crash treadcrash.c, load the
+# resulting core file into gdb and verify that gdb can extract enough
+# information from the core file.
+#
+# The return code from this script is the number of failed tests.
+
+LOG=gdbresult.log
+
+if [ $# != 1 ] ; then
+ echo > /dev/stderr Syntax: $0 \<name of threadcrash binary\>
+ exit 1
+fi
+RUNME="$1"
+
+# Verify that the gdb output doesn't contain $1.
+function mustNotHave() {
+ local BADWORD=$1
+ if grep -q "$BADWORD" $LOG ; then
+ echo >> /dev/stderr WARNING: gdb output contains "$BADWORD"
+ return 1
+ fi
+ return 0
+}
+
+# Verify that the gdb output contains exactly $1 $2s.
+function mustHaveCorrectAmount() {
+ local WANTEDNUMBER=$1
+ local GOODWORD=$2
+ local ACTUALNUMBER=$(grep "$GOODWORD" $LOG | wc -l)
+ if [ $ACTUALNUMBER != $WANTEDNUMBER ] ; then
+ echo >> /dev/stderr WARNING: gdb output contained $ACTUALNUMBER \""$GOODWORD"\", not $WANTEDNUMBER as expected
+ return 1
+ fi
+ return 0
+}
+
+# Verify that the gdb output contains seven threads
+function mustHaveSevenThreads() {
+ NTHREADS=$(egrep "^Thread [1-7] \(" $LOG | wc -l)
+ if [ $NTHREADS != 7 ] ; then
+ echo >> /dev/stderr WARNING: gdb output contains $NTHREADS threads, not 7 as expected
+ return 1
+ fi
+ return 0
+}
+
+# Verify that the gdb output has all parameters on consecutive lines
+function mustHaveSequence() {
+ SEQUENCE="$*"
+ NPARTS=$#
+ grep "$1" -A$((NPARTS - 1)) $LOG > matches.log
+
+ while [ $# -gt 1 ] ; do
+ shift
+ ((NPARTS--))
+ grep "$1" -A$((NPARTS - 1)) matches.log > temp.log
+ mv temp.log matches.log
+ done
+ LASTPART=$1
+
+ if ! grep -q "$LASTPART" matches.log ; then
+ echo >> /dev/stderr WARNING: gdb output does not contain the sequence: $SEQUENCE
+ return 1
+ fi
+ return 0
+}
+
+# Verify that $LOG contains all information we want
+function verifyLog() {
+ local FAILURES=0
+
+ mustNotHave '??' || ((FAILURES++))
+ mustHaveCorrectAmount 12 threadcrash.c: || ((FAILURES++))
+
+ mustHaveSevenThreads || ((FAILURES++))
+ mustHaveSequence sleep "makeSyscall (ignored=" || ((FAILURES++))
+
+ mustHaveSequence sleep "syscallingSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
+ mustHaveSequence pthread_kill "makeSyscallFromSighandler (ignored=" || ((FAILURES++))
+
+ mustHaveSequence sleep "syscallingAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
+ mustHaveSequence pthread_kill "makeSyscallFromAltSighandler (ignored=" || ((FAILURES++))
+
+ mustHaveSequence Thread "spin (ignored=" || ((FAILURES++))
+
+ mustHaveSequence "spinningSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
+ mustHaveSequence pthread_kill "spinFromSighandler (ignored=" || ((FAILURES++))
+
+ mustHaveSequence "spinningAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
+ mustHaveSequence pthread_kill "spinFromAltSighandler (ignored=" || ((FAILURES++))
+
+ mustHaveSequence Thread "main (argc=1, argv=" || ((FAILURES++))
+
+ return $FAILURES
+}
+
+# Put result of debugging a core file in $LOG
+function getLogFromCore() {
+ # Make sure we get a core file
+ ulimit -c unlimited || exit 1
+
+ # Run the crasher
+ ./$(basename "$RUNME")
+ EXITCODE=$?
+
+ # Verify that we actually crashed
+ if [ $EXITCODE -lt 128 ] ; then
+ echo >> /dev/stderr ERROR: $RUNME should have been killed by a signal, got non-signal exit code $EXITCODE
+ exit 1
+ fi
+
+ # Verify that we got a core file
+ if [ ! -r core* ] ; then
+ echo >> /dev/stderr ERROR: $RUNME did not create a core file
+ exit 1
+ fi
+
+ # Run gdb
+ cat > gdbscript.gdb <<EOF
+set width 0
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" core* > $LOG
+ EXITCODE=$?
+
+ if [ $EXITCODE != 0 ] ; then
+ ((FAILURES++))
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE
+ fi
+}
+
+# Put result of debugging a gcore file in $LOG
+function getLogFromGcore() {
+ # Create the core file
+ rm -f core*
+ cat > gdbscript.gdb <<EOF
+handle SIGQUIT pass noprint nostop
+handle SIGUSR1 pass noprint nostop
+handle SIGUSR2 pass noprint nostop
+handle SIGALRM pass noprint nostop
+run
+gcore
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" > /dev/null
+ EXITCODE=$?
+
+ if [ $EXITCODE != 0 ] ; then
+ ((FAILURES++))
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE when creating gcore file
+ fi
+
+ # Verify that we got a core file from gcore
+ if [ ! -r core* ] ; then
+ echo >> /dev/stderr ERROR: gdb gcore did not create a core file
+ exit 1
+ fi
+
+ # Run gdb on the gcore file
+ cat > gdbscript.gdb <<EOF
+set width 0
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" core* > $LOG
+ EXITCODE=$?
+
+ if [ $EXITCODE != 0 ] ; then
+ ((FAILURES++))
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE when examining gcore file
+ fi
+}
+
+# Put result of debugging a core file in $LOG
+function getLogFromLiveProcess() {
+ # Run gdb
+ cat > gdbscript.gdb <<EOF
+handle SIGQUIT pass noprint nostop
+handle SIGUSR1 pass noprint nostop
+handle SIGUSR2 pass noprint nostop
+handle SIGALRM pass noprint nostop
+set width 0
+run
+t a a bt 100
+quit
+EOF
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" > $LOG
+ EXITCODE=$?
+
+ if [ $EXITCODE != 0 ] ; then
+ ((FAILURES++))
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE
+ fi
+}
+
+####### Main program follows #####################
+
+# Make sure we don't clobber anybody else's (core) file(s)
+WORKDIR=/tmp/$PPID
+mkdir -p $WORKDIR
+cp "$RUNME" $WORKDIR
+cd $WORKDIR
+
+# Count problems
+FAILURES=0
+
+echo === Testing gdb vs core file...
+getLogFromCore
+verifyLog
+((FAILURES+=$?))
+echo === Core file tests done.
+
+echo
+
+echo === Testing gdb vs gcore file...
+getLogFromGcore
+verifyLog
+((FAILURES+=$?))
+echo === Gcore file tests done.
+
+echo
+
+echo === Testing gdb vs live process...
+getLogFromLiveProcess
+verifyLog
+((FAILURES+=$?))
+echo === Live process tests done.
+
+# Executive summary
+echo
+if [ $FAILURES == 0 ] ; then
+ echo All tests passed!
+else
+ echo $FAILURES tests failed!
+ echo
+ echo Make sure the threadcrash binary contains debugging information \(build with \"gcc -g\"\).
+fi
+
+# Clean up
+cd /
+rm -rf $WORKDIR
+
+exit $FAILURES

View File

@ -0,0 +1,101 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Guinevere Larsen <blarsen@redhat.com>
Date: Mon, 22 Jan 2024 10:13:52 +0100
Subject: gdb-rhbz2259850-list-period-crash-fix.patch
;; Backport gdb: fix "list ." related crash
When a user attempts to use the "list ." command with an inferior that
doesn't have debug symbols, GDB would crash. This was reported as PR
gdb/31256.
The crash would happen when attempting to get the current symtab_and_line
for the stop location, because the symtab would return a null pointer
and we'd attempt to dereference it to print the line.
This commit fixes that by checking for an empty symtab and erroring out
of the function if it happens.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31256
Approved-By: Tom Tromey <tom@tromey.com>
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1291,6 +1291,8 @@ list_command (const char *arg, int from_tty)
set_default_source_symtab_and_line ();
cursal = get_current_source_symtab_and_line ();
}
+ if (cursal.symtab == nullptr)
+ error (_("No debug information available to print source lines."));
list_around_line (arg, cursal);
/* Set the repeat args so just pressing "enter" after using "list ."
will print the following lines instead of the same lines again. */
diff --git a/gdb/testsuite/gdb.base/list-nodebug.c b/gdb/testsuite/gdb.base/list-nodebug.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/list-nodebug.c
@@ -0,0 +1,21 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int main ()
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/list-nodebug.exp b/gdb/testsuite/gdb.base/list-nodebug.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/list-nodebug.exp
@@ -0,0 +1,37 @@
+# Copyright 2024 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test that using the command "list" in a file with no debug information
+# will not crash GDB and will give reasonable output.
+
+standard_testfile .c
+
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
+ {nodebug}]} {
+ return -1
+}
+
+if {![runto_main]} {
+ untested "couldn't run to main"
+ return
+}
+
+# Check that GDB doesn't crash when we use list . on an inferior with
+# no debug information
+gdb_test "list ." "No debug.*" "first 'list .'"
+# This should be called twice because the first list invocation since
+# printing a frame may take a different codepath, which wouldn't
+# trigger the crash.
+gdb_test "list ." "No debug.*" "second 'list .'"

View File

@ -0,0 +1,55 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Mon, 29 Jan 2024 14:51:22 -0700
Subject: gdb-rhbz2261580-intrusive_list-assertion-fix.patch
;; Backport upstream workaround for GCC 14 problem which cause assertion
;; failures in GDB.
[gdb/build] Workaround gcc PR113599
Since gcc commit d3f48f68227 ("c++: non-dependent .* operand folding
[PR112427]"), with gdb we run into PR gcc/113599 [1], a wrong-code bug, as
reported in PR build/31281.
Work around this by flipping inherit order:
...
-class thread_info : public refcounted_object,
- public intrusive_list_node<thread_info>
+class thread_info : public intrusive_list_node<thread_info>,
+ public refcounted_object
...
An argument could be made that this isn't necessary, because this occurred in
an unreleased gcc version.
However, I think it could be useful when bisecting gcc for other problems in
building gdb. Having this workaround means the bisect won't reintroduce the
problem. Furthermore, the workaround is harmless.
Tested on Fedora rawhide x86_64.
Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31281
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113599
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -242,10 +242,11 @@ using private_thread_info_up = std::unique_ptr<private_thread_info>;
strong reference, and is thus not accounted for in the thread's
refcount.
- The intrusive_list_node base links threads in a per-inferior list. */
+ The intrusive_list_node base links threads in a per-inferior list.
+ We place it first in the inherit order to work around PR gcc/113599. */
-class thread_info : public refcounted_object,
- public intrusive_list_node<thread_info>
+class thread_info : public intrusive_list_node<thread_info>,
+ public refcounted_object
{
public:
explicit thread_info (inferior *inf, ptid_t ptid);

View File

@ -57,7 +57,7 @@ Version: 14.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: 4.0.riscv64%{?dist}
Release: 8.0.riscv64%{?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
# Do not provide URL for snapshots as the file lasts there only for 2 days.
@ -1250,9 +1250,26 @@ fi
%endif
%changelog
* Tue Jan 23 2024 David Abdurachmanov <davidlt@rivosinc.com> - 14.1-4.0.riscv64
* Mon Feb 05 2024 David Abdurachmanov <davidlt@rivosinc.com> - 14.1-8.0.riscv64
- Add riscv64 support
* Mon Jan 29 2024 Kevin Buettner <kevinb@redhat.com> - 14.1-8
- Backport upstream workaround for GCC 14 problem which is causing
GDB internal errors (RHBZ 261580, Tom de Vries).
* Thu Jan 25 2024 Guinevere Larsen <blarsen@redhat.com>
- Remove gdb-6.5-BEA-testsuite.patch, as it was upstreamed and
will make its way back with the next rebase.
* Thu Jan 25 2024 Guinevere Larsen <blarsen@redhat.com> - 14.1-7
- Backport "gdb: fix list . related crash"
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Tue Jan 16 2024 Kevin Buettner <kevinb@redhat.com> - 14.1-4
- Backport upstream commit bc23ea51f8a83e9524dfb553baa8baacb29e68a9,
potentially fixing RHBZ 2257562.