diff --git a/.gitignore b/.gitignore
index e69de29..84d970d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/gdb-16.2.tar.xz
diff --git a/README.local-patches.md b/README.local-patches.md
new file mode 100644
index 0000000..fc2eb90
--- /dev/null
+++ b/README.local-patches.md
@@ -0,0 +1,104 @@
+# Fedora GDB local patches policy
+
+In order to make things easier for the Fedora GDB maintainer, we
+choose to auto-generate the local patches by making use of an upstream
+git repository. Below you can find a few instructions on how to work
+using this method.
+
+You need to run the following commands from the directory that
+contains the "gdb.spec" file.
+
+## Importing the GDB patches into a git repository
+
+1) The local patches (`*.patch`) need to be imported into an upstream
+git repository. For example, let's assume you cloned the repository
+by doing:
+
+`$ git clone git://sourceware.org/git/binutils-gdb.git`
+
+> TIP: if you already have the repository cloned somewhere in your
+> system, you can pass a "--reference
" to the "git clone"
+> command and it will use your local repository as much as possible
+> to make the clone, speeding up things.
+
+2) After cloning the upstream repository, you can import your patches
+by using the script "generate-git-repo-from-patches.sh":
+
+`$ sh generate-git-repo-from-patches.sh `
+
+The script will basically cd into the repository, checkout the
+revision specified in the file `_git_upstream_commit`, iterate through
+the file `_patch_order` and "git-am" every patch *in that order*.
+This operation should complete without errors; if you find a problem
+with `git-am`, it probably means that the revision specified in the
+file `_git_upstream_commit` is wrong.
+
+## Rebasing the patches against a newer version/release
+
+1) First, cd into the upstream repository. All you have to do is
+choose the revision against which you plan to rebase the patches, and
+`git rebase `. git will do the rest, and you will be able
+to perform conflict resolution by git's algorithm, which is smarter.
+
+## Creating new patches
+
+1) Create the new patch on top of the the others, as usual. Note that
+you can use `git rebase` whenever you want to reorder patch order, or
+even to delete a patch.
+
+2) When writing the commit log, you must obey a few rules. The
+subject line *must* be the filename of the patch. This line will be
+used when exporting the patches from the git repository, and
+(obviously) it gives the filename that should be used for this
+specific patch.
+
+3) You can also add comments that will go into the auto-generated
+`Patch:` file (see below). To do that, use the special marker `;;` at
+the beginning of the line. This way, a commit log that says:
+
+~~~~~~~~~~~
+ test-patch.patch
+
+ ;; This is a test patch
+ ;; Second line
+~~~~~~~~~~~
+
+Will generate the following entry in the auto-generated `Patch:` file:
+
+~~~~~~~~~~~
+ # This is a test patch
+ # Second line
+ PatchXYZ: test-patch.patch
+~~~~~~~~~~~
+
+## Exporting the GDB patches from the git repository
+
+1) When you're done working with the patches, go back to the directory
+that contains the `gdb.spec` file, and from there you run:
+
+`$ sh generate-patches-from-git-repo.sh `
+
+This will regenerate all of the `*.patch` files (excluding the ones that
+were also excluded from the git repository), and also regenerate a few
+control files. These control files are:
+
+ - `_gdb.spec.Patch.include`: This file contains the `Patch:` directives.
+
+ - `_gdb.spec.patch.include`: This file contains the `%patch` directives.
+
+ - `_patch_order`: This file contains the patches, in the exact order
+ that they must be applied. It is used when importing the patches
+ into the git repository.
+
+ - `_git_upstream_commit`: This file contains the last upstream commit
+ against which the patches were rebased. It is used when importing
+ the patches into the git repository.
+
+NOTE: If you did a rebase against a newer upstream version, you need
+to specify the commit/tag/branch against which you rebased:
+
+`$ sh generate-patches-from-git-repo.sh `
+
+For example, if you rebased against `gdb-8.1-release`:
+
+`$ sh generate-patches-from-git-repo.sh gdb-8.1-release`
diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include
new file mode 100644
index 0000000..aeae570
--- /dev/null
+++ b/_gdb.spec.Patch.include
@@ -0,0 +1,103 @@
+# Check distro name is included in the version output.
+Patch001: gdb-6.3-rh-testversion-20041202.patch
+
+# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
+#=fedoratest
+Patch002: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
+
+# Support for stepping over PPC atomic instruction sequences (BZ 237572).
+#=fedoratest
+Patch003: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
+
+# Test leftover zombie process (BZ 243845).
+#=fedoratest
+Patch004: gdb-6.5-bz243845-stale-testing-zombie-test.patch
+
+# Test gcore memory and time requirements for large inferiors.
+#=fedoratest
+Patch005: 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.
+Patch006: gdb-6.3-mapping-zero-inode-test.patch
+
+# Test a crash on libraries missing the .text section.
+#=fedoratest
+Patch007: gdb-6.5-section-num-fixup-test.patch
+
+# Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
+#=fedoratest
+Patch008: gdb-6.8-bz466901-backtrace-full-prelinked.patch
+
+# New test for step-resume breakpoint placed in multiple threads at once.
+#=fedoratest
+Patch009: gdb-simultaneous-step-resume-breakpoint-test.patch
+
+# Fix follow-exec for C++ programs (bugreported by Martin Stransky).
+#=fedoratest
+Patch010: gdb-archer-next-over-throw-cxx-exec.patch
+
+# [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604).
+#=fedoratest
+Patch011: gdb-test-bt-cfi-without-die.patch
+
+# Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
+#=fedoratest
+Patch012: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
+
+# Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
+#=fedoratest
+Patch013: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
+
+# Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to
+# crash.' (RH BZ 1156192).
+#=fedoratest
+Patch014: gdb-rhbz1156192-recursive-dlopen-test.patch
+
+# Fix '`catch syscall' doesn't work for parent after `fork' is called'
+# (Philippe Waroquiers, RH BZ 1149205).
+#=fedoratest
+Patch015: 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
+Patch016: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
+
+# [aarch64] Fix hardware watchpoints (RH BZ 1261564).
+#=fedoratest
+Patch017: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
+
+# Update gdb-add-index.sh such that, when the GDB environment
+# variable is not set, the script is smarter than just looking for
+# 'gdb' in the $PATH.
+#
+# The actual search order is now: /usr/bin/gdb.minimal, gdb (in the
+# $PATH), then /usr/libexec/gdb.
+#
+# For the rationale of looking for gdb.minimal see:
+#
+# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot
+#
+#=fedora
+Patch018: gdb-add-index.patch
+
+# Not a backport. Add a new script which hooks into GDB and suggests
+# RPMs to install when GDB finds an objfile with no debug info.
+Patch019: gdb-add-rpm-suggestion-script.patch
+
+# Backport "Fix gstack issues" from upstream
+# commit 43ac3df61492b94bf13c11bd98c9f9541e92d3b0.
+# (Keith Seitz, RH BZ 2354997)
+Patch020: gdb-rhbz2354997-gstack-drop-readnever.patch
+
+# Backport upstream commit 2fc56106422 which fixes a possible
+# segfault when opening a core file. This will drop out when we
+# rebase to 16.3 or 17.1
+Patch021: core-target-open-segfault.patch
+
+# Backport upstream commit 2b646bb8767, this fixes an issue where
+# TUI output was not flushed to the screen in some cases. This will
+# drop out when we rebase on 16.3 or 17.1.
+Patch022: tui-wrefresh-issue.patch
+
diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include
new file mode 100644
index 0000000..09361bf
--- /dev/null
+++ b/_gdb.spec.patch.include
@@ -0,0 +1,22 @@
+%patch -p1 -P001
+%patch -p1 -P002
+%patch -p1 -P003
+%patch -p1 -P004
+%patch -p1 -P005
+%patch -p1 -P006
+%patch -p1 -P007
+%patch -p1 -P008
+%patch -p1 -P009
+%patch -p1 -P010
+%patch -p1 -P011
+%patch -p1 -P012
+%patch -p1 -P013
+%patch -p1 -P014
+%patch -p1 -P015
+%patch -p1 -P016
+%patch -p1 -P017
+%patch -p1 -P018
+%patch -p1 -P019
+%patch -p1 -P020
+%patch -p1 -P021
+%patch -p1 -P022
diff --git a/_git_upstream_commit b/_git_upstream_commit
new file mode 100644
index 0000000..ad4c4ff
--- /dev/null
+++ b/_git_upstream_commit
@@ -0,0 +1 @@
+50b1dcab86c5fea753e0b15c4722bda4313b48e3
diff --git a/_patch_order b/_patch_order
new file mode 100644
index 0000000..14ec07b
--- /dev/null
+++ b/_patch_order
@@ -0,0 +1,22 @@
+gdb-6.3-rh-testversion-20041202.patch
+gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
+gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
+gdb-6.5-bz243845-stale-testing-zombie-test.patch
+gdb-6.5-gcore-buffer-limit-test.patch
+gdb-6.3-mapping-zero-inode-test.patch
+gdb-6.5-section-num-fixup-test.patch
+gdb-6.8-bz466901-backtrace-full-prelinked.patch
+gdb-simultaneous-step-resume-breakpoint-test.patch
+gdb-archer-next-over-throw-cxx-exec.patch
+gdb-test-bt-cfi-without-die.patch
+gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
+gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
+gdb-rhbz1156192-recursive-dlopen-test.patch
+gdb-rhbz1149205-catch-syscall-after-fork-test.patch
+gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
+gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
+gdb-add-index.patch
+gdb-add-rpm-suggestion-script.patch
+gdb-rhbz2354997-gstack-drop-readnever.patch
+core-target-open-segfault.patch
+tui-wrefresh-issue.patch
diff --git a/core-target-open-segfault.patch b/core-target-open-segfault.patch
new file mode 100644
index 0000000..9320327
--- /dev/null
+++ b/core-target-open-segfault.patch
@@ -0,0 +1,56 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Tom de Vries
+Date: Fri, 7 Feb 2025 17:06:30 +0100
+Subject: core-target-open-segfault.patch
+
+;; Backport upstream commit 2fc56106422 which fixes a possible
+;; segfault when opening a core file. This will drop out when we
+;; rebase to 16.3 or 17.1
+
+[gdb/corefiles] Fix segfault in core_target_open
+
+On x86_64-freebsd, with test-case gdb.arch/i386-biarch-core.exp I run into a
+segfault here in corelow.c:core_target_open:
+...
+ {
+ gdb::unique_xmalloc_ptr failing_command = make_unique_xstrdup
+ (bfd_core_file_failing_command (current_program_space->core_bfd ()));
+ if (failing_command != nullptr)
+ gdb_printf (_("Core was generated by `%s'.\n"),
+ failing_command.get ());
+ }
+...
+where bfd_core_file_failing_command returns nullptr, so the segfault happens
+somewhere during "strdup (nullptr)".
+
+There doesn't seem to be a need to make a copy of the string, so fix this by
+dropping the make_unique_xstrdup.
+
+Tested on x86_64-linux.
+Tested the test-case on x86_64-freebsd.
+
+Approved-By: Tom Tromey
+
+PR corefiles/32634
+Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32634
+
+(cherry picked from commit 9dd3d66b79a2907726f407039234ad8677e9df16)
+
+diff --git a/gdb/corelow.c b/gdb/corelow.c
+--- a/gdb/corelow.c
++++ b/gdb/corelow.c
+@@ -1188,11 +1188,11 @@ core_target_open (const char *arg, int from_tty)
+ }
+ else
+ {
+- gdb::unique_xmalloc_ptr failing_command = make_unique_xstrdup
+- (bfd_core_file_failing_command (current_program_space->core_bfd ()));
++ const char *failing_command
++ = bfd_core_file_failing_command (current_program_space->core_bfd ());
+ if (failing_command != nullptr)
+ gdb_printf (_("Core was generated by `%s'.\n"),
+- failing_command.get ());
++ failing_command);
+ }
+
+ /* Clearing any previous state of convenience variables. */
diff --git a/gating.yaml b/gating.yaml
new file mode 100644
index 0000000..eb7c84f
--- /dev/null
+++ b/gating.yaml
@@ -0,0 +1,6 @@
+--- !Policy
+product_versions:
+ - rhel-8
+decision_context: osci_compose_gate
+rules:
+ - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
diff --git a/gdb-6.3-mapping-zero-inode-test.patch b/gdb-6.3-mapping-zero-inode-test.patch
new file mode 100644
index 0000000..32b62d5
--- /dev/null
+++ b/gdb-6.3-mapping-zero-inode-test.patch
@@ -0,0 +1,247 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.3-mapping-zero-inode-test.patch
+
+;; Test GCORE for shmid 0 shared memory mappings.
+;;=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible.
+
+diff --git a/gdb/testsuite/gdb.base/gcore-shmid0.c b/gdb/testsuite/gdb.base/gcore-shmid0.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-shmid0.c
+@@ -0,0 +1,128 @@
++/* Copyright 2007, 2009 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ 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 2 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, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330,
++ Boston, MA 02111-1307, USA. */
++
++/*
++ * Test GDB's handling of gcore for mapping with a name but zero inode.
++ */
++
++#include
++#include
++#include
++#include
++#include
++#include
++#include
++#include
++
++/* The same test running in a parallel testsuite may steal us the zero SID,
++ even if we never get any EEXIST. Just try a while. */
++
++#define TIMEOUT_SEC 10
++
++static volatile int v;
++
++static void
++initialized (void)
++{
++ v++;
++}
++
++static void
++unresolved (void)
++{
++ v++;
++}
++
++int
++main (void)
++{
++ int sid;
++ unsigned int *addr = (void *) -1L;
++ int attempt, round = 0;
++ time_t ts_start, ts;
++
++ if (time (&ts_start) == (time_t) -1)
++ {
++ printf ("time (): %m\n");
++ exit (1);
++ }
++
++ /* The generated SID will cycle with an increment of 32768, attempt until it
++ * wraps to 0. */
++
++ for (attempt = 0; addr == (void *) -1L; attempt++)
++ {
++ /* kernel-2.6.25-8.fc9.x86_64 just never returns the value 0 by
++ shmget(2). shmget returns SID range 0..1<<31 in steps of 32768,
++ 0x1000 should be enough but wrap the range it to be sure. */
++
++ if (attempt > 0x21000)
++ {
++ if (time (&ts) == (time_t) -1)
++ {
++ printf ("time (): %m\n");
++ exit (1);
++ }
++
++ if (ts >= ts_start && ts < ts_start + TIMEOUT_SEC)
++ {
++ attempt = 0;
++ round++;
++ continue;
++ }
++
++ printf ("Problem is not reproducible on this kernel (attempt %d, "
++ "round %d)\n", attempt, round);
++ unresolved ();
++ exit (1);
++ }
++
++ sid = shmget ((key_t) rand (), 0x1000, IPC_CREAT | IPC_EXCL | 0777);
++ if (sid == -1)
++ {
++ if (errno == EEXIST)
++ continue;
++
++ printf ("shmget (%d, 0x1000, IPC_CREAT): errno %d\n", 0, errno);
++ exit (1);
++ }
++
++ /* Use SID only if it is 0, retry it otherwise. */
++
++ if (sid == 0)
++ {
++ addr = shmat (sid, NULL, SHM_RND);
++ if (addr == (void *) -1L)
++ {
++ printf ("shmat (%d, NULL, SHM_RND): errno %d\n", sid,
++ errno);
++ exit (1);
++ }
++ }
++ if (shmctl (sid, IPC_RMID, NULL) != 0)
++ {
++ printf ("shmctl (%d, IPC_RMID, NULL): errno %d\n", sid, errno);
++ exit (1);
++ }
++ }
++
++ initialized ();
++
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/gcore-shmid0.exp b/gdb/testsuite/gdb.base/gcore-shmid0.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-shmid0.exp
+@@ -0,0 +1,101 @@
++# Copyright 2007, 2009 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 2 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, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# Test GDB's handling of gcore for mapping with a name but zero inode.
++
++if { [prepare_for_testing gcore-shmid0.exp gcore-shmid0] } {
++ return -1
++}
++
++# Does this gdb support gcore?
++set test "help gcore"
++gdb_test_multiple $test $test {
++ -re "Undefined command: .gcore.*$gdb_prompt $" {
++ # gcore command not supported -- nothing to test here.
++ unsupported "gdb does not support gcore on this target"
++ return -1;
++ }
++ -re "Save a core file .*$gdb_prompt $" {
++ pass $test
++ }
++}
++
++if { ! [ runto_main ] } then {
++ untested gcore-shmid0.exp
++ return -1
++}
++
++gdb_breakpoint "initialized"
++gdb_breakpoint "unresolved"
++
++set oldtimeout $timeout
++set timeout [expr $oldtimeout + 120]
++
++set test "Continue to initialized."
++gdb_test_multiple "continue" $test {
++ -re "Breakpoint .*, initialized .* at .*\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "Breakpoint .*, unresolved .* at .*\r\n$gdb_prompt $" {
++ set timeout $oldtimeout
++ unsupported $test
++ return -1
++ }
++}
++set timeout $oldtimeout
++
++set escapedfilename [string_to_regexp [standard_output_file gcore-shmid0.test]]
++
++set test "save a corefile"
++gdb_test_multiple "gcore [standard_output_file gcore-shmid0.test]" $test {
++ -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
++ pass $test
++ }
++ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
++ unsupported $test
++ }
++}
++
++# Be sure to remove the handle first.
++# But it would get removed even on a kill by GDB as the handle is already
++# deleted, just it is still attached.
++gdb_continue_to_end "finish"
++
++set test "core-file command"
++gdb_test_multiple "core-file [standard_output_file gcore-shmid0.test]" $test {
++ -re ".* program is being debugged already.*y or n. $" {
++ # gdb_load may connect us to a gdbserver.
++ send_gdb "y\n"
++ exp_continue;
++ }
++ -re "Core was generated by .*\r\n\#0 .*\\\(\\\).*\r\n$gdb_prompt $" {
++ # The filename does not fit there anyway so do not check it.
++ pass $test
++ }
++ -re ".*registers from core file: File in wrong format.* $" {
++ fail "core-file command (could not read registers from core file)"
++ }
++}
++
++set test "backtrace"
++gdb_test_multiple "bt" $test {
++ -re "#0 *initialized \\\(\\\) at .*#1 .* main \\\(.*$gdb_prompt $" {
++ pass $test
++ }
++ -re "#0 *initialized \\\(\\\) at .*Cannot access memory at address .*$gdb_prompt $" {
++ fail $test
++ }
++}
diff --git a/gdb-6.3-rh-testversion-20041202.patch b/gdb-6.3-rh-testversion-20041202.patch
new file mode 100644
index 0000000..59132bf
--- /dev/null
+++ b/gdb-6.3-rh-testversion-20041202.patch
@@ -0,0 +1,34 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Andrew Burgess
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.3-rh-testversion-20041202.patch
+
+;; Check distro name is included in the version output.
+
+diff --git a/gdb/testsuite/gdb.base/fedora-version.exp b/gdb/testsuite/gdb.base/fedora-version.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/fedora-version.exp
+@@ -0,0 +1,22 @@
++# Copyright 2023 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 .
++
++# Start with a fresh gdb
++clean_restart
++
++# Check the version string contains either the Fedora or RHEL distro
++# name, and that the version number looks roughly correct in format.
++gdb_test "show version" \
++ "GNU gdb \\((Fedora Linux|Red Hat Enterprise Linux)\\) \[0-9\]+\\.\[0-9\]+-\[0-9\]+.*"
diff --git a/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
new file mode 100644
index 0000000..db4229d
--- /dev/null
+++ b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
@@ -0,0 +1,107 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
+
+;; Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
+;;=fedoratest
+
+https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
+
+diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/step-over-trampoline.c
+@@ -0,0 +1,28 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2006 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 2 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, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++ Please email any bugs, comments, and/or additions to this file to:
++ bug-gdb@prep.ai.mit.edu */
++
++#include
++
++int main (void)
++{
++ puts ("hello world");
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.exp b/gdb/testsuite/gdb.base/step-over-trampoline.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/step-over-trampoline.exp
+@@ -0,0 +1,59 @@
++# Copyright 2006 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 2 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, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++if {[use_gdb_stub]} {
++ untested "skipping test because of use_gdb_stub"
++ return -1
++}
++
++if $tracelevel then {
++ strace $tracelevel
++}
++
++set testfile step-over-trampoline
++set srcfile ${testfile}.c
++set binfile [standard_output_file ${testfile}]
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++
++# Get things started.
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++# For C programs, "start" should stop in main().
++
++gdb_test "start" \
++ "main \\(\\) at .*$srcfile.*" \
++ "start"
++
++# main () at hello2.c:5
++# 5 puts("hello world\n");
++# (gdb) next
++# 0x100007e0 in call___do_global_ctors_aux ()
++
++gdb_test_multiple "next" "invalid `next' output" {
++ -re "\nhello world.*return 0;.*" {
++ pass "stepped over"
++ }
++ -re " in call___do_global_ctors_aux \\(\\).*" {
++ fail "stepped into trampoline"
++ }
++}
diff --git a/gdb-6.5-bz243845-stale-testing-zombie-test.patch b/gdb-6.5-bz243845-stale-testing-zombie-test.patch
new file mode 100644
index 0000000..2d62949
--- /dev/null
+++ b/gdb-6.5-bz243845-stale-testing-zombie-test.patch
@@ -0,0 +1,89 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.5-bz243845-stale-testing-zombie-test.patch
+
+;; Test leftover zombie process (BZ 243845).
+;;=fedoratest
+
+diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.base/tracefork-zombie.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/tracefork-zombie.exp
+@@ -0,0 +1,76 @@
++# Copyright 2007 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 2 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, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++
++# are we on a target board
++if {[use_gdb_stub]} {
++ untested "skipping test because of use_gdb_stub"
++ return -1
++}
++
++# Start the program running and then wait for a bit, to be sure
++# that it can be attached to.
++
++gdb_exit
++gdb_start
++gdb_load sleep
++
++set gdb_pid [exp_pid -i [board_info host fileid]]
++set test "identified the child GDB"
++if {$gdb_pid != "" && $gdb_pid > 0} {
++ pass $test
++ verbose -log "Child GDB PID $gdb_pid"
++} else {
++ fail $test
++}
++
++set testpid [eval exec sleep 10 &]
++exec sleep 2
++
++set test "attach"
++gdb_test_multiple "attach $testpid" "$test" {
++ -re "Attaching to program.*`?.*'?, process $testpid..*$gdb_prompt $" {
++ pass "$test"
++ }
++ -re "Attaching to program.*`?.*\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" {
++ # Response expected on Cygwin
++ pass "$test"
++ }
++}
++
++# Some time to let GDB spawn its testing child.
++exec sleep 2
++
++set found none
++foreach procpid [glob -directory /proc -type d {[0-9]*}] {
++ if {[catch {open $procpid/status} statusfi]} {
++ continue
++ }
++ set status [read $statusfi]
++ close $statusfi
++ if {1
++ && [regexp -line {^Name:\tgdb$} $status]
++ && [regexp -line {^PPid:\t1$} $status]
++ && [regexp -line "^TracerPid:\t$gdb_pid$" $status]} {
++ set found $procpid
++ verbose -log "Found linux_test_for_tracefork zombie PID $procpid"
++ }
++}
++set test "linux_test_for_tracefork leaves no zombie"
++if {$found eq {none}} {
++ pass $test
++} else {
++ fail $test
++}
diff --git a/gdb-6.5-gcore-buffer-limit-test.patch b/gdb-6.5-gcore-buffer-limit-test.patch
new file mode 100644
index 0000000..07ba1e9
--- /dev/null
+++ b/gdb-6.5-gcore-buffer-limit-test.patch
@@ -0,0 +1,154 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.5-gcore-buffer-limit-test.patch
+
+;; Test gcore memory and time requirements for large inferiors.
+;;=fedoratest
+
+diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.c b/gdb/testsuite/gdb.base/gcore-excessive-memory.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.c
+@@ -0,0 +1,37 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2008 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 2 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, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++ Please email any bugs, comments, and/or additions to this file to:
++ bug-gdb@prep.ai.mit.edu */
++
++#include
++#include
++
++#define MEGS 64
++
++int main()
++{
++ void *mem;
++
++ mem = malloc (MEGS * 1024ULL * 1024ULL);
++
++ for (;;)
++ sleep (1);
++
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.exp b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
+@@ -0,0 +1,99 @@
++# Copyright 2008 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 2 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, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++if {[use_gdb_stub]} {
++ untested "skipping test because of use_gdb_stub"
++ return -1
++}
++
++set testfile gcore-excessive-memory
++set srcfile ${testfile}.c
++set shfile [standard_output_file ${testfile}-gdb.sh]
++set corefile [standard_output_file ${testfile}.core]
++set binfile [standard_output_file ${testfile}]
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++
++set f [open "|getconf PAGESIZE" "r"]
++gets $f pagesize
++close $f
++
++set pid_of_bin [eval exec $binfile &]
++sleep 2
++
++# Get things started.
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++set pid_of_gdb [exp_pid -i [board_info host fileid]]
++
++gdb_test "attach $pid_of_bin" "Attaching to .*" "attach"
++gdb_test "up 99" "in main .*" "verify we can get to main"
++
++proc memory_v_pages_get {} {
++ global pid_of_gdb pagesize
++ set fd [open "/proc/$pid_of_gdb/statm"]
++ gets $fd line
++ close $fd
++ # number of pages of virtual memory
++ scan $line "%d" drs
++ return $drs
++}
++
++set pages_found [memory_v_pages_get]
++
++# It must be definitely less than `MEGS' of `gcore-excessive-memory.c'.
++set mb_gcore_reserve 4
++verbose -log "pages_found = $pages_found, mb_gcore_reserve = $mb_gcore_reserve"
++set kb_found [expr $pages_found * $pagesize / 1024]
++set kb_permit [expr $kb_found + 1 * 1024 + $mb_gcore_reserve * 1024]
++verbose -log "kb_found = $kb_found, kb_permit = $kb_permit"
++
++# Create the ulimit wrapper.
++set f [open $shfile "w"]
++puts $f "#! /bin/sh"
++puts $f "ulimit -v $kb_permit"
++puts $f "exec $GDB \"\$@\""
++close $f
++remote_exec host "chmod +x $shfile"
++
++gdb_exit
++set GDBold $GDB
++set GDB "$shfile"
++gdb_start
++set GDB $GDBold
++
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++set pid_of_gdb [exp_pid -i [board_info host fileid]]
++
++gdb_test "attach $pid_of_bin" "Attaching to .*" "attach"
++gdb_test "up 99" "in main .*" "verify we can get to main"
++
++verbose -log "kb_found before gcore = [expr [memory_v_pages_get] * $pagesize / 1024]"
++
++gdb_test "gcore $corefile" "Saved corefile \[^\n\r\]*" "Save the core file"
++
++verbose -log "kb_found after gcore = [expr [memory_v_pages_get] * $pagesize / 1024]"
++
++# Cleanup.
++exec kill -9 $pid_of_bin
diff --git a/gdb-6.5-section-num-fixup-test.patch b/gdb-6.5-section-num-fixup-test.patch
new file mode 100644
index 0000000..2fa3995
--- /dev/null
+++ b/gdb-6.5-section-num-fixup-test.patch
@@ -0,0 +1,127 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.5-section-num-fixup-test.patch
+
+;; Test a crash on libraries missing the .text section.
+;;=fedoratest
+
+diff --git a/gdb/testsuite/gdb.base/datalib-lib.c b/gdb/testsuite/gdb.base/datalib-lib.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/datalib-lib.c
+@@ -0,0 +1,22 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2008 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 2 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, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++ Please email any bugs, comments, and/or additions to this file to:
++ bug-gdb@prep.ai.mit.edu */
++
++int var;
+diff --git a/gdb/testsuite/gdb.base/datalib-main.c b/gdb/testsuite/gdb.base/datalib-main.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/datalib-main.c
+@@ -0,0 +1,26 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2008 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 2 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, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++ Please email any bugs, comments, and/or additions to this file to:
++ bug-gdb@prep.ai.mit.edu */
++
++int
++main (void)
++{
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/datalib.exp b/gdb/testsuite/gdb.base/datalib.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/datalib.exp
+@@ -0,0 +1,56 @@
++# Copyright 2008 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 2 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, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++if {[use_gdb_stub]} {
++ untested "skipping test because of use_gdb_stub"
++ return -1
++}
++
++set testfile datalib
++set srcfilemain ${testfile}-main.c
++set srcfilelib ${testfile}-lib.c
++set libfile [standard_output_file ${testfile}-lib.so]
++set binfile [standard_output_file ${testfile}-main]
++if { [gdb_compile "${srcdir}/${subdir}/${srcfilelib}" "${libfile}" executable [list debug {additional_flags=-shared -nostdlib}]] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++if { [gdb_compile "${srcdir}/${subdir}/${srcfilemain}" "${binfile} ${libfile}" executable {debug}] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++
++# Get things started.
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++# We must use a separate library as the main executable is compiled to the
++# address 0 by default and it would get fixed up already at the end of
++# INIT_OBJFILE_SECT_INDICES. We also cannot PRELINK it as PRELINK is missing
++# on ia64. The library must be NOSTDLIB as otherwise some stub code would
++# create the `.text' section there. Also DEBUG option is useful as some of
++# the crashes occur in dwarf2read.c.
++
++# FAIL case:
++# ../../gdb/ia64-tdep.c:2838: internal-error: sect_index_text not initialized
++# A problem internal to GDB has been detected,
++
++gdb_test "start" \
++ "main \\(\\) at .*${srcfilemain}.*" \
++ "start"
diff --git a/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch b/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
new file mode 100644
index 0000000..4faef13
--- /dev/null
+++ b/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
@@ -0,0 +1,278 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Jan Kratochvil
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
+
+;; Support for stepping over PPC atomic instruction sequences (BZ 237572).
+;;=fedoratest
+
+2007-06-25 Jan Kratochvil
+
+ * gdb.threads/atomic-seq-threaded.c,
+ gdb.threads/atomic-seq-threaded.exp: New files.
+
+diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.c b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
+@@ -0,0 +1,171 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2007 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 2 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, write to the Free Software
++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++ MA 02110-1301, USA. */
++
++/* Test stepping over RISC atomic sequences.
++ This variant testcases the code for stepping another thread while skipping
++ over the atomic sequence in the former thread
++ (STEPPING_PAST_SINGLESTEP_BREAKPOINT).
++ Code comes from gcc/testsuite/gcc.dg/sync-2.c */
++
++/* { dg-options "-march=i486" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
++/* { dg-options "-mcpu=v9" { target sparc*-*-* } } */
++
++/* Test functionality of the intrinsics for 'short' and 'char'. */
++
++#include
++#include
++#include
++#include
++#include
++
++#define LOOPS 2
++
++static int unused;
++
++static char AI[18];
++static char init_qi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 };
++static char test_qi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 };
++
++static void
++do_qi (void)
++{
++ if (__sync_fetch_and_add(AI+4, 1) != 0)
++ abort ();
++ if (__sync_fetch_and_add(AI+5, 4) != 0)
++ abort ();
++ if (__sync_fetch_and_add(AI+6, 22) != 0)
++ abort ();
++ if (__sync_fetch_and_sub(AI+7, 12) != 0)
++ abort ();
++ if (__sync_fetch_and_and(AI+8, 7) != (char)-1)
++ abort ();
++ if (__sync_fetch_and_or(AI+9, 8) != 0)
++ abort ();
++ if (__sync_fetch_and_xor(AI+10, 9) != 0)
++ abort ();
++ if (__sync_fetch_and_nand(AI+11, 7) != 0)
++ abort ();
++
++ if (__sync_add_and_fetch(AI+12, 1) != 1)
++ abort ();
++ if (__sync_sub_and_fetch(AI+13, 12) != (char)-12)
++ abort ();
++ if (__sync_and_and_fetch(AI+14, 7) != 7)
++ abort ();
++ if (__sync_or_and_fetch(AI+15, 8) != 8)
++ abort ();
++ if (__sync_xor_and_fetch(AI+16, 9) != 9)
++ abort ();
++ if (__sync_nand_and_fetch(AI+17, 7) != 7)
++ abort ();
++}
++
++static short AL[18];
++static short init_hi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 };
++static short test_hi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 };
++
++static void
++do_hi (void)
++{
++ if (__sync_fetch_and_add(AL+4, 1) != 0)
++ abort ();
++ if (__sync_fetch_and_add(AL+5, 4) != 0)
++ abort ();
++ if (__sync_fetch_and_add(AL+6, 22) != 0)
++ abort ();
++ if (__sync_fetch_and_sub(AL+7, 12) != 0)
++ abort ();
++ if (__sync_fetch_and_and(AL+8, 7) != -1)
++ abort ();
++ if (__sync_fetch_and_or(AL+9, 8) != 0)
++ abort ();
++ if (__sync_fetch_and_xor(AL+10, 9) != 0)
++ abort ();
++ if (__sync_fetch_and_nand(AL+11, 7) != 0)
++ abort ();
++
++ if (__sync_add_and_fetch(AL+12, 1) != 1)
++ abort ();
++ if (__sync_sub_and_fetch(AL+13, 12) != -12)
++ abort ();
++ if (__sync_and_and_fetch(AL+14, 7) != 7)
++ abort ();
++ if (__sync_or_and_fetch(AL+15, 8) != 8)
++ abort ();
++ if (__sync_xor_and_fetch(AL+16, 9) != 9)
++ abort ();
++ if (__sync_nand_and_fetch(AL+17, 7) != 7)
++ abort ();
++}
++
++static void *
++start1 (void *arg)
++{
++ unsigned loop;
++ sleep(1);
++
++ for (loop = 0; loop < LOOPS; loop++)
++ {
++ memcpy(AI, init_qi, sizeof(init_qi));
++
++ do_qi ();
++
++ if (memcmp (AI, test_qi, sizeof(test_qi)))
++ abort ();
++ }
++
++ return arg; /* _delete1_ */
++}
++
++static void *
++start2 (void *arg)
++{
++ unsigned loop;
++
++ for (loop = 0; loop < LOOPS; loop++)
++ {
++ memcpy(AL, init_hi, sizeof(init_hi));
++
++ do_hi ();
++
++ if (memcmp (AL, test_hi, sizeof(test_hi)))
++ abort ();
++ }
++
++ return arg; /* _delete2_ */
++}
++
++int
++main (int argc, char **argv)
++{
++ pthread_t thread;
++ int i;
++
++ i = pthread_create (&thread, NULL, start1, NULL); /* _create_ */
++ assert (i == 0); /* _create_after_ */
++
++ sleep (1);
++
++ start2 (NULL);
++
++ i = pthread_join (thread, NULL); /* _delete_ */
++ assert (i == 0);
++
++ return 0; /* _exit_ */
++}
+diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
+@@ -0,0 +1,84 @@
++# atomic-seq-threaded.exp -- Test case for stepping over RISC atomic code seqs.
++# This variant testcases the code for stepping another thread while skipping
++# over the atomic sequence in the former thread
++# (STEPPING_PAST_SINGLESTEP_BREAKPOINT).
++# Copyright (C) 2007 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 2 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, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++
++# Please email any bugs, comments, and/or additions to this file to:
++# bug-gdb@prep.ai.mit.edu
++
++set testfile atomic-seq-threaded
++set srcfile ${testfile}.c
++set binfile [standard_output_file ${testfile}]
++
++foreach opts {{} {compiler=gcc4} {FAIL}} {
++ if {$opts eq "FAIL"} {
++ return -1
++ }
++ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $opts]] eq "" } {
++ break
++ }
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++
++gdb_load ${binfile}
++if ![runto_main] then {
++ fail "Can't run to main"
++ return 0
++}
++
++# pthread_create () will not pass even on x86_64 with software watchpoint.
++# Pass after pthread_create () without any watchpoint active.
++set line [gdb_get_line_number "_create_after_"]
++gdb_test "tbreak $line" \
++ "reakpoint (\[0-9\]+) at .*$srcfile, line $line\..*" \
++ "set breakpoint after pthread_create ()"
++gdb_test "c" \
++ ".*/\\* _create_after_ \\*/.*" \
++ "run till after pthread_create ()"
++
++# Without a watchpoint being software no single-stepping would be used.
++set test "Start (software) watchpoint"
++gdb_test_multiple "watch unused" $test {
++ -re "Watchpoint \[0-9\]+: unused.*$gdb_prompt $" {
++ pass $test
++ }
++ -re "Hardware watchpoint \[0-9\]+: unused.*$gdb_prompt $" {
++ # We do not test the goal but still the whole testcase should pass.
++ unsupported $test
++ }
++}
++
++# More thorough testing of the scheduling logic.
++gdb_test "set scheduler-locking step" ""
++
++# Critical code path is stepped through at this point.
++set line [gdb_get_line_number "_exit_"]
++gdb_test "tbreak $line" \
++ "reakpoint \[0-9\]+ at .*$srcfile, line $line\..*" \
++ "set breakpoint at _exit_"
++gdb_test "c" \
++ ".*/\\* _exit_ \\*/.*" \
++ "run till _exit_"
++
++# Just a nonproblematic program exit.
++gdb_test "c" \
++ ".*Program exited normally\\..*" \
++ "run till program exit"
diff --git a/gdb-6.8-bz466901-backtrace-full-prelinked.patch b/gdb-6.8-bz466901-backtrace-full-prelinked.patch
new file mode 100644
index 0000000..39d8947
--- /dev/null
+++ b/gdb-6.8-bz466901-backtrace-full-prelinked.patch
@@ -0,0 +1,481 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.8-bz466901-backtrace-full-prelinked.patch
+
+;; Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
+;;=fedoratest
+
+Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
+
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S
+@@ -0,0 +1,328 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2008 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 . */
++
++/*
++#include
++
++void
++func (void)
++{
++ int i;
++
++ abort ();
++}
++*/
++ .file "dw2-loclist-prelinked.c"
++ .section .debug_abbrev,"",@progbits
++.Ldebug_abbrev0:
++ .section .debug_info,"",@progbits
++.Ldebug_info0:
++ .section .debug_line,"",@progbits
++.Ldebug_line0:
++ .text
++.Ltext0:
++.globl func
++ .type func, @function
++func:
++.LFB2:
++ .file 1 "dw2-loclist-prelinked.c"
++ .loc 1 5 0
++ pushl %ebp
++.LCFI0:
++ movl %esp, %ebp
++.LCFI1:
++ subl $24, %esp
++.LCFI2:
++ .loc 1 8 0
++ call abort
++.LFE2:
++ .size func, .-func
++ .section .debug_frame,"",@progbits
++.Lframe0:
++ .long .LECIE0-.LSCIE0
++.LSCIE0:
++ .long 0xffffffff
++ .byte 0x1
++ .string ""
++ .uleb128 0x1
++ .sleb128 -4
++ .byte 0x8
++ .byte 0xc
++ .uleb128 0x4
++ .uleb128 0x4
++ .byte 0x88
++ .uleb128 0x1
++ .align 4
++.LECIE0:
++.LSFDE0:
++ .long .LEFDE0-.LASFDE0
++.LASFDE0:
++ .long .Lframe0
++ .long .LFB2
++ .long .LFE2-.LFB2
++ .byte 0x4
++ .long .LCFI0-.LFB2
++ .byte 0xe
++ .uleb128 0x8
++ .byte 0x85
++ .uleb128 0x2
++ .byte 0x4
++ .long .LCFI1-.LCFI0
++ .byte 0xd
++ .uleb128 0x5
++ .align 4
++.LEFDE0:
++ .text
++.Letext0:
++ .section .debug_loc,"",@progbits
++.Ldebug_loc0:
++.LLST0:
++ .long .LFB2-.Ltext0
++ .long .LCFI0-.Ltext0
++ .value 0x2
++ .byte 0x74
++ .sleb128 4
++ .long .LCFI0-.Ltext0
++ .long .LCFI1-.Ltext0
++ .value 0x2
++ .byte 0x74
++ .sleb128 8
++ .long .LCFI1-.Ltext0
++ .long .LFE2-.Ltext0
++ .value 0x2
++ .byte 0x75
++ .sleb128 8
++ .long 0x0
++ .long 0x0
++ .section .debug_info
++ .long 0x94
++ .value 0x2
++ .long .Ldebug_abbrev0
++ .byte 0x4
++ .uleb128 0x1
++ .long .LASF10
++ .byte 0x1
++ .long .LASF11
++ .long .LASF12
++ .long .Ltext0
++ .long .Letext0
++ .long .Ldebug_line0
++ .uleb128 0x2
++ .byte 0x4
++ .byte 0x7
++ .long .LASF0
++ .uleb128 0x3
++ .byte 0x4
++ .byte 0x5
++ .string "int"
++ .uleb128 0x2
++ .byte 0x4
++ .byte 0x5
++ .long .LASF1
++ .uleb128 0x2
++ .byte 0x1
++ .byte 0x8
++ .long .LASF2
++ .uleb128 0x2
++ .byte 0x2
++ .byte 0x7
++ .long .LASF3
++ .uleb128 0x2
++ .byte 0x4
++ .byte 0x7
++ .long .LASF4
++ .uleb128 0x2
++ .byte 0x1
++ .byte 0x6
++ .long .LASF5
++ .uleb128 0x2
++ .byte 0x2
++ .byte 0x5
++ .long .LASF6
++ .uleb128 0x2
++ .byte 0x8
++ .byte 0x5
++ .long .LASF7
++ .uleb128 0x2
++ .byte 0x8
++ .byte 0x7
++ .long .LASF8
++ .uleb128 0x4
++ .byte 0x4
++ .byte 0x7
++ .uleb128 0x2
++ .byte 0x1
++ .byte 0x6
++ .long .LASF9
++ .uleb128 0x5
++ .byte 0x1
++ .long .LASF13
++ .byte 0x1
++ .byte 0x5
++ .byte 0x1
++ .long .LFB2
++ .long .LFE2
++ .long .LLST0
++ .uleb128 0x6
++ .string "i"
++ .byte 0x1
++ .byte 0x6
++ .long 0x2c
++ .byte 0x2
++ .byte 0x91
++ .sleb128 -12
++ .byte 0x0
++ .byte 0x0
++ .section .debug_abbrev
++ .uleb128 0x1
++ .uleb128 0x11
++ .byte 0x1
++ .uleb128 0x25
++ .uleb128 0xe
++ .uleb128 0x13
++ .uleb128 0xb
++ .uleb128 0x3
++ .uleb128 0xe
++ .uleb128 0x1b
++ .uleb128 0xe
++ .uleb128 0x11
++ .uleb128 0x1
++ .uleb128 0x12
++ .uleb128 0x1
++ .uleb128 0x10
++ .uleb128 0x6
++ .byte 0x0
++ .byte 0x0
++ .uleb128 0x2
++ .uleb128 0x24
++ .byte 0x0
++ .uleb128 0xb
++ .uleb128 0xb
++ .uleb128 0x3e
++ .uleb128 0xb
++ .uleb128 0x3
++ .uleb128 0xe
++ .byte 0x0
++ .byte 0x0
++ .uleb128 0x3
++ .uleb128 0x24
++ .byte 0x0
++ .uleb128 0xb
++ .uleb128 0xb
++ .uleb128 0x3e
++ .uleb128 0xb
++ .uleb128 0x3
++ .uleb128 0x8
++ .byte 0x0
++ .byte 0x0
++ .uleb128 0x4
++ .uleb128 0x24
++ .byte 0x0
++ .uleb128 0xb
++ .uleb128 0xb
++ .uleb128 0x3e
++ .uleb128 0xb
++ .byte 0x0
++ .byte 0x0
++ .uleb128 0x5
++ .uleb128 0x2e
++ .byte 0x1
++ .uleb128 0x3f
++ .uleb128 0xc
++ .uleb128 0x3
++ .uleb128 0xe
++ .uleb128 0x3a
++ .uleb128 0xb
++ .uleb128 0x3b
++ .uleb128 0xb
++ .uleb128 0x27
++ .uleb128 0xc
++ .uleb128 0x11
++ .uleb128 0x1
++ .uleb128 0x12
++ .uleb128 0x1
++ .uleb128 0x40
++ .uleb128 0x6
++ .byte 0x0
++ .byte 0x0
++ .uleb128 0x6
++ .uleb128 0x34
++ .byte 0x0
++ .uleb128 0x3
++ .uleb128 0x8
++ .uleb128 0x3a
++ .uleb128 0xb
++ .uleb128 0x3b
++ .uleb128 0xb
++ .uleb128 0x49
++ .uleb128 0x13
++ .uleb128 0x2
++ .uleb128 0xa
++ .byte 0x0
++ .byte 0x0
++ .byte 0x0
++ .section .debug_pubnames,"",@progbits
++ .long 0x17
++ .value 0x2
++ .long .Ldebug_info0
++ .long 0x98
++ .long 0x75
++ .string "func"
++ .long 0x0
++ .section .debug_aranges,"",@progbits
++ .long 0x1c
++ .value 0x2
++ .long .Ldebug_info0
++ .byte 0x4
++ .byte 0x0
++ .value 0x0
++ .value 0x0
++ .long .Ltext0
++ .long .Letext0-.Ltext0
++ .long 0x0
++ .long 0x0
++ .section .debug_str,"MS",@progbits,1
++.LASF7:
++ .string "long long int"
++.LASF0:
++ .string "unsigned int"
++.LASF11:
++ .string "dw2-loclist-prelinked.c"
++.LASF12:
++ .string "gdb-6.8/gdb/testsuite/gdb.dwarf2"
++.LASF4:
++ .string "long unsigned int"
++.LASF8:
++ .string "long long unsigned int"
++.LASF2:
++ .string "unsigned char"
++.LASF9:
++ .string "char"
++.LASF1:
++ .string "long int"
++.LASF3:
++ .string "short unsigned int"
++.LASF5:
++ .string "signed char"
++.LASF10:
++ .string "GNU C 4.3.2 20081007 (Red Hat 4.3.2-6)"
++.LASF13:
++ .string "func"
++.LASF6:
++ .string "short int"
++ .ident "GCC: (GNU) 4.3.2 20081007 (Red Hat 4.3.2-6)"
++ .section .note.GNU-stack,"",@progbits
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c
+@@ -0,0 +1,26 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2008 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 . */
++
++/* dw2-loclist-prelinked-func.S */
++extern void func (void);
++
++int
++main (void)
++{
++ func ();
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
+@@ -0,0 +1,102 @@
++# Copyright 2008 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 2 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, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# Minimal DWARF-2 unit test
++
++# This test can only be run on i386/x86_64 targets which support DWARF-2.
++# For now pick a sampling of likely targets.
++if {(![istarget *-*-linux*]
++ && ![istarget *-*-gnu*]
++ && ![istarget *-*-elf*]
++ && ![istarget *-*-openbsd*])
++ || (![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"])} {
++ return 0
++}
++
++set testfile "dw2-loclist-prelinked"
++set srcfuncfile ${testfile}-func.S
++set binsharedfuncfile [standard_output_file ${testfile}.so]
++set srcmainfile ${testfile}-main.c
++set binfile [standard_output_file ${testfile}]
++
++remote_exec build "rm -f ${binfile}"
++
++# get the value of gcc_compiled
++if [get_compiler_info ${binfile}] {
++ return -1
++}
++
++# This test can only be run on gcc as we use additional_flags=FIXME
++if {$gcc_compiled == 0} {
++ return 0
++}
++
++if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfuncfile}" "${binsharedfuncfile}" {debug additional_flags=-m32}] != "" } {
++ untested "Couldn't compile test library"
++ return -1
++}
++
++# The new separate debug info file will be stored in the .debug subdirectory.
++
++if [gdb_gnu_strip_debug ${binsharedfuncfile}] {
++ # check that you have a recent version of strip and objcopy installed
++ unsupported "cannot produce separate debug info files"
++ return -1
++}
++
++if {[catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${binsharedfuncfile}\""] != 0} {
++ # Maybe we don't have prelink.
++ return -1
++}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" \
++ "${binfile}" executable [list debug additional_flags=-m32 shlib=${binsharedfuncfile}]] != "" } {
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++gdb_run_cmd
++
++gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
++
++# Incorrect:
++# #0 0x00110430 in __kernel_vsyscall ()
++# No symbol table info available.
++# #1 0x003d44c0 in raise () from /lib/libc.so.6
++# No symbol table info available.
++# #2 0x003d5e88 in abort () from /lib/libc.so.6
++# No symbol table info available.
++# #3 0x44f10437 in func () at dw2-loclist-prelinked.c:8
++# i = Could not find the frame base for "func".
++
++# Correct:
++# #0 0x00110430 in __kernel_vsyscall ()
++# No symbol table info available.
++# #1 0x003d44c0 in raise () from /lib/libc.so.6
++# No symbol table info available.
++# #2 0x003d5e88 in abort () from /lib/libc.so.6
++# No symbol table info available.
++# #3 0x4ae36437 in func () at dw2-loclist-prelinked.c:8
++# i = 3827288
++# #4 0x0804851a in main () at ../../../gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c:24
++# No locals.
++
++# `abort' can get expressed as `*__GI_abort'.
++gdb_test "bt full" "in \[^ \]*abort \\(.*in func \\(.*\r\n\[\t \]+i = -?\[0-9\].*in main \\(.*" "Backtrace after abort()"
diff --git a/gdb-add-index.patch b/gdb-add-index.patch
new file mode 100644
index 0000000..52a3145
--- /dev/null
+++ b/gdb-add-index.patch
@@ -0,0 +1,77 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-add-index.patch
+
+;; Update gdb-add-index.sh such that, when the GDB environment
+;; variable is not set, the script is smarter than just looking for
+;; 'gdb' in the $PATH.
+;;
+;; The actual search order is now: /usr/bin/gdb.minimal, gdb (in the
+;; $PATH), then /usr/libexec/gdb.
+;;
+;; For the rationale of looking for gdb.minimal see:
+;;
+;; https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot
+;;
+;;=fedora
+
+diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
+--- a/gdb/contrib/gdb-add-index.sh
++++ b/gdb/contrib/gdb-add-index.sh
+@@ -16,14 +16,52 @@
+ # You should have received a copy of the GNU General Public License
+ # along with this program. If not, see .
+
+-# This program assumes gdb and objcopy are in $PATH.
+-# If not, or you want others, pass the following in the environment
+-GDB=${GDB:=gdb}
++# This program assumes objcopy and readelf are in $PATH. If not, or
++# you want others, pass the following in the environment
+ OBJCOPY=${OBJCOPY:=objcopy}
+ READELF=${READELF:=readelf}
+
+ myname="${0##*/}"
+
++# For GDB itself we need to be a little smarter. If GDB is set in the
++# environment then we will use that. But if GDB is not set in the
++# environment then we have a couple of options that we need to check
++# through.
++#
++# Our default choice is for /usr/bin/gdb.minimal. For an explanation
++# of why this is chosen, check out:
++# https://bugzilla.redhat.com/show_bug.cgi?id=1695015
++# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot
++#
++# If gdb.minimal is not found then we look for a 'gdb' executable on
++# the path.
++#
++# And finally, we check for /usr/libexec/gdb.
++#
++# If none of those result in a useable GDB then we give an error and
++# exit.
++if test -z "$GDB"; then
++ for possible_gdb in /usr/bin/gdb.minimal gdb /usr/libexec/gdb; do
++ if ! command -v "$possible_gdb" >/dev/null 2>&1; then
++ continue
++ fi
++
++ possible_gdb=$(command -v "$possible_gdb")
++
++ if ! test -x "$possible_gdb"; then
++ continue
++ fi
++
++ GDB="$possible_gdb"
++ break
++ done
++
++ if test -z "$GDB"; then
++ echo "$myname: Failed to find a useable GDB binary" 1>&2
++ exit 1
++ fi
++fi
++
+ dwarf5=""
+ if [ "$1" = "-dwarf-5" ]; then
+ dwarf5="$1"
diff --git a/gdb-add-rpm-suggestion-script.patch b/gdb-add-rpm-suggestion-script.patch
new file mode 100644
index 0000000..1eccb30
--- /dev/null
+++ b/gdb-add-rpm-suggestion-script.patch
@@ -0,0 +1,1009 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Andrew Burgess
+Date: Thu, 7 Mar 2024 15:14:23 +0000
+Subject: gdb-add-rpm-suggestion-script.patch
+
+;; Not a backport. Add a new script which hooks into GDB and suggests
+;; RPMs to install when GDB finds an objfile with no debug info.
+
+gdb: add script which will suggest debuginfo RPMs to install
+
+This script hooks into GDB's missing debug info Python API and
+suggests debuginfo RPMs to install.
+
+diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
+--- a/gdb/data-directory/Makefile.in
++++ b/gdb/data-directory/Makefile.in
+@@ -92,6 +92,7 @@ PYTHON_FILE_LIST = \
+ gdb/command/missing_files.py \
+ gdb/command/pretty_printers.py \
+ gdb/command/prompt.py \
++ gdb/command/rpm-suggestions.py \
+ gdb/command/type_printers.py \
+ gdb/command/unwinders.py \
+ gdb/command/xmethods.py \
+diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
+--- a/gdb/doc/gdb.texinfo
++++ b/gdb/doc/gdb.texinfo
+@@ -186,6 +186,7 @@ software in general. We will miss him.
+ * Trace File Format:: @value{GDBN} trace file format
+ * Index Section Format:: .gdb_index section format
+ * Debuginfod:: Download debugging resources with @code{debuginfod}
++* RPM Suggestions:: RPM Suggestions from GDB
+ * Man Pages:: Manual pages
+ * Copying:: GNU General Public License says
+ how you can copy and share @value{GDBN}
+@@ -50588,6 +50589,111 @@ Show the current verbosity setting.
+
+ @end table
+
++@node RPM Suggestions
++@appendix Receiving RPM installation suggestions
++@cindex rpm suggestions
++
++When @value{GDBN} loads an executable, or shared library, and cannot
++find the corresponding debug information, @value{GDBN} will check to
++see if an RPM is available which could provide the missing debug
++information. If a suitable RPM is found then @value{GDBN} will print
++a hint before the next prompt is displayed:
++
++@smallexample
++(@value{GDBP}) file /bin/ls
++Reading symbols from /bin/ls...
++Reading symbols from .gnu_debugdata for /usr/bin/ls...
++(No debugging symbols found in .gnu_debugdata for /usr/bin/ls)
++Missing rpms, try: dnf --enablerepo='*debug*' install coreutils-debuginfo-9.3-7.fc39.x86_64
++(@value{GDBP})
++@end smallexample
++
++In this case, installing @file{coreutils-debuginfo-9.3-7.fc39.x86_64}
++will provide the missing debug information for @file{/bin/ls}. It is
++up to you to install the suggested package, if possible, and after
++that reload the executable in @value{GDBN} so that the newly installed
++debug information can be found.
++
++The RPM suggestion feature can be disabled:
++
++@table @code
++@kindex set rpm-suggestion enabled
++@kindex show rpm-suggestion enabled
++@cindex rpm suggestions, disabling
++@item set rpm-suggestion enabled @r{[}on@r{|}off@r{]}
++@itemx show rpm-suggestion enabled
++When @samp{on} @value{GDBN} will make RPM suggestions where possible.
++When @samp{off} all RPM suggestion will be disabled.
++@end table
++
++When opening a core file (@pxref{core-file command}), it may be the
++case that not only is the debug information missing, but the
++corresponding executable itself is missing. For example, if a core
++file is copied from one machine to another in order to debug.
++
++In this case @value{GDBN} is able to suggest a command which will
++install the missing executable based on the build-id of the
++executable. For example:
++
++@smallexample
++(@value{GDBP}) core-file /tmp/core.5489
++warning: Can't open file /usr/bin/sl during file-backed mapping note processing
++[New LWP 5489]
++Core was generated by `sl'.
++Program terminated with signal SIGQUIT, Quit.
++#0 0x00007f1b41ced1a7 in ?? ()
++Missing file(s), try: dnf --enablerepo='*debug*' install /usr/lib/.build-id/33/2f1a8e56693960e3beb2d70cd79ddfec451cc3 /usr/lib/debug/.build-id/33/2f1a8e56693960e3beb2d70cd79ddfec451cc3.debug
++(@value{GDBP})
++@end smallexample
++
++The core file was generated from the @file{/usr/bin/sl} binary, which
++is not present on the machine opening the core file. @value{GDBN} has
++suggested a command, based on the build-id of the binary, which was
++extracted from the core file, that would install both the missing
++binary, and the corresponding debug information.
++
++Unfortunately, @value{GDBN} doesn't know if the suggested command will
++actually find a matching RPM or not. Querying the RPM database to see
++which packages, if any, will provide a file with the given build-id,
++is rather slow. As @file{/usr/bin/sl} is available in an RPM, then
++the above command will succeed.
++
++It is possible to have @value{GDBN} check to see if there is a package
++available before making the suggestion, but this is significantly
++slower. To enable this mode use the following command:
++
++@table @code
++@kindex set rpm-suggestion build-id-mode
++@kindex show rpm-suggestion build-id-mode
++@cindex rpm suggestions, build-id-mode
++@item set rpm-suggestion build-id-mode @r{[}fast@r{|}slow@r{]}
++@itemx show rpm-suggestion build-id-mode
++When set to @samp{fast}, which is the default, @value{GDBN} will offer
++suggestions based on the build-id of any missing executables or shared
++libraries while opening a core file. This is fast, but @value{GDBN}
++has not checked if there is a package available that can supply the
++required file, so running the suggested command might not install any
++packages.
++
++When set to @samp{slow}, each time @value{GDBN} encounters an
++executable, or shared library, that is missing, @value{GDBN} will
++check to see if there is an RPM available that will supply the missing
++binary. If a suitable RPM is found then @value{GDBN} will offer a
++command which will install the missing RPM. If no suitable RPM is
++found then @value{GDBN} will make no suggestions.
++@end table
++
++It is possible to review all of the previous RPM suggestions that
++@value{GDBN} has made using the following command:
++
++@table @code
++@kindex info rpm-suggestions
++@cindex rpm suggestions, listing
++@item info rpm-suggestions
++List all of the RPM suggestions @value{GDBN} has made since the
++executable was last changed.
++@end table
++
+ @node Man Pages
+ @appendix Manual pages
+ @cindex Man pages
+diff --git a/gdb/python/lib/gdb/command/rpm-suggestions.py b/gdb/python/lib/gdb/command/rpm-suggestions.py
+new file mode 100644
+--- /dev/null
++++ b/gdb/python/lib/gdb/command/rpm-suggestions.py
+@@ -0,0 +1,525 @@
++# Copyright 2023 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 .
++
++import gdb
++import gdb.missing_debug
++import gdb.missing_objfile
++
++# These modules are all system modules, and should be available on any
++# correctly setup Python install.
++import sys
++import os
++import subprocess
++import re
++from threading import Thread
++import time
++
++try:
++ import rpm
++except ModuleNotFoundError:
++ # The "RPM suggestions" mechanism will not work without the (python)
++ # rpm module. Inform the user of this, but wait to do so until
++ # just prior to printing the GDB prompt. If we do it right away,
++ # the message typically appears before the version and copyright
++ # info, which is easily missed by many users. Additionally, it
++ # seems that several other packages which parse GDB version info
++ # are confused by an early error message regarding a missing
++ # python3-rpm package, so waiting to print the error allows those
++ # applications to work as they used to.
++ def before_prompt():
++ print(
++ ("\nUnable to load the Python 'rpm' module. Lack of this module disables\n"
++ "the RPM suggestions mechanism which recommends shell commands for\n"
++ "installing missing debuginfo packages. To enable this functionality,\n"
++ "please install the python3-rpm package."),
++ file=sys.stderr
++ )
++ gdb.events.before_prompt.disconnect(before_prompt)
++
++ gdb.events.before_prompt.connect(before_prompt)
++
++ # Implement 'info rpm-suggestions' when the 'rpm' module is not
++ # available. Just throws an error.
++ def info_rpm_suggestions():
++ raise gdb.GdbError("rpm-suggestions are disabled as the Python 'rpm' module is not installed")
++else:
++ # Track all the RPMs suggested during a single debug session so we
++ # don't suggest the same RPM twice. This is only cleared when the
++ # main executable is changed.
++ __missing_rpms = {}
++
++ # Track any missing RPMs that have been discovered since the last time
++ # the prompt was displayed. RPMs in here are also present in the
++ # __MISSING_RPMS dictionary, but this dictionary is cleared each time
++ # the prompt is shown.
++ __suggest_rpms = {}
++
++ # Track all the build-ids suggested during a single debug session so we
++ # don't suggest installing using the same build-id twice. This is only
++ # cleared when the main executable is changed.
++ __missing_build_ids = {}
++
++ # Track any build-ids that have been discovered missing since the last
++ # time the prompt was displayed. Build-ids in here are also present in
++ # the __MISSING_BUILD_IDS dictionary, but this dictionary is cleared
++ # each time the prompt is shown.
++ __suggest_build_ids = {}
++
++ # The build-id to RPM lookup is very slow. This cache maps
++ # build-ids to the set of RPM we can suggest installing. The key
++ # is the build-id string, and the value is a list of RPM names, or
++ # None if there was an error with the build-id to RPM lookup.
++ #
++ # This cache is never cleared, even when the executable is
++ # changed. The build-ids should be unique, so a build-id lookup
++ # should be good for the lifetime of the session.
++ __build_id_lookup_cache = {}
++
++ # When searching for an RPM given a build-id, if the search takes
++ # too long, then a message is printed to the user. We only print
++ # the message once between each GDB prompt. This flag is set True
++ # when the message is printed, and reset to False when a prompt is
++ # displayed.
++ __searching_message_printed = False
++
++ # Add a suggestion to install RPM_NAME (the full name of an RPM)
++ # to the list of suggestions to make the next time a prompt is
++ # displayed.
++ def add_rpm_suggestion(rpm_name):
++ global __missing_rpms
++ global __suggest_rpms
++
++ if not rpm_name in __missing_rpms:
++ __suggest_rpms[rpm_name] = True
++ __missing_rpms[rpm_name] = True
++
++ # Return True if RPM_NAME is installed, where RPM_NAME is the full
++ # name of an RPM.
++ def is_rpm_installed(ts, rpm_name):
++ res = ts.dbMatch(rpm.RPMDBI_LABEL, rpm_name)
++ return len(res) > 0
++
++ # Add a suggestion to install RPMs based on BUILD_ID, a string
++ # containing a build-id, to the list of suggestions to make the next
++ # time a prompt is displayed.
++ def add_build_id_suggestion(build_id):
++ global __missing_build_ids
++ global __suggest_build_ids
++
++ if not build_id in __missing_build_ids:
++ __suggest_build_ids[build_id] = True
++ __missing_build_ids[build_id] = True
++
++ # Return true if '/usr/lib' is in the debug-file-directory list.
++ # System packages install their debug information into /usr/lib,
++ # so if GDB isn't looking in that directory, then there's no
++ # reason to try and figure out a suitable RPM to install.
++ def using_suitable_debug_file_directory():
++ debug_file_directories = gdb.parameter("debug-file-directory")
++ for d in debug_file_directories.split(os.pathsep):
++ if d[:8] == "/usr/lib":
++ return True
++ return False
++
++ # Return True if rpm-suggestion is disabled for any reason.
++ def rpm_suggestion_is_disabled():
++ # If /usr/lib/ is not being used to find debug information
++ # then there's no point offering any RPMs as GDB would not
++ # find the newly installed content.
++ if not using_suitable_debug_file_directory():
++ return True
++
++ # Is 'rpm-suggestion enabled' set to 'off'?
++ if not param_rpm_suggestion_enabled.value:
++ return True
++
++ return False
++
++
++ # Lookup RPMs that might provide the debug information for FILENAME,
++ # which is a string containing the path to an object file GDB could
++ # not find any debug information for.
++ #
++ # If a possible RPM is found then this is added to the globals
++ # __MISSING_RPMS and __SUGGEST_RPMS, which are used elsewhere in this
++ # script.
++ def find_debug_suggestions(filename):
++ if rpm_suggestion_is_disabled():
++ return
++
++ ts = rpm.TransactionSet()
++ mi = ts.dbMatch(rpm.RPMDBI_BASENAMES, filename)
++ for h in mi:
++ # Build the debuginfo package name.
++ obj = h.format("%{name}-debuginfo-%{version}-%{release}.%{arch}")
++ rpm_name = str(obj)
++
++ # Check to see if the package is installed.
++ if is_rpm_installed(ts, rpm_name):
++ continue
++
++ add_rpm_suggestion(rpm_name)
++
++
++ # Return a string which is the filename of the filename
++ # corresponding to BUILD_ID in one of the two locations under
++ # /usr/lib.
++ #
++ # When DEBUG_P is True, return a filename within:
++ # /usr/lib/debug/.build-id/ and when DEBUG_P is False, return a
++ # filename within: /usr/lib/.build-id/.
++ #
++ # The SUFFIX string is appended to the generated filename.
++ def build_id_to_usr_lib_filename(build_id, debug_p, suffix = ""):
++ key = build_id[:2]
++ rst = build_id[2:]
++
++ filename = '/usr/lib'
++ if debug_p:
++ filename += '/debug'
++ filename += '/.build-id/' + key + '/' + rst + suffix
++
++ return filename
++
++ # A regexp object used to match against the output of `dnf`. This
++ # is initialised the first time it is needed.
++ find_objfile_suggestions_re = None
++
++ # Given BUILD_ID, a string containing a build-id, run a `dnf`
++ # command to figure out if any RPMs can provide a file with that
++ # build-id.
++ #
++ # If any suitable RPMs are found then `add_rpm_suggestion` is called
++ # to register the suggestion.
++ #
++ # This function is pretty slow, which is a shame, as the results
++ # returned are much nicer than just telling the user to try the
++ # lookup command for themselves.
++ def find_objfile_suggestions_in_thread(build_id):
++ global find_objfile_suggestions_re
++
++ if find_objfile_suggestions_re is None:
++ find_objfile_suggestions_re = re.compile("^(.*)-debuginfo-(.*) : Debug information for package (.*)$")
++
++ result = subprocess.run(['dnf', "--enablerepo=*debug*", '--nogpgcheck', '-C', 'provides',
++ build_id_to_usr_lib_filename(build_id, True)],
++ capture_output=True, timeout=30)
++
++ lines = result.stdout.decode('utf-8').splitlines()
++ ts = rpm.TransactionSet()
++
++ for l in lines:
++ m = find_objfile_suggestions_re.match(l)
++ if not m:
++ continue
++ if m.group(1) != m.group(3):
++ return
++
++ main_rpm = m.group(1) + '-' + m.group(2)
++ dbg_rpm = m.group(1) + '-debuginfo-' + m.group(2)
++
++ if not is_rpm_installed(ts, main_rpm):
++ add_rpm_suggestion(main_rpm)
++
++ if not is_rpm_installed(ts, dbg_rpm):
++ add_rpm_suggestion(dbg_rpm)
++
++ return
++
++ # Call `find_objfile_suggestions_in_thread` is a separate thread,
++ # then wait for the thread to complete. Don't touch any shared
++ # state while waiting for the thread to complete. There's no
++ # locking on any of our caches, and the worker thread will add RPM
++ # suggestions as it wants.
++ #
++ # If thre thread takes too long to complete then print a message
++ # to the user telling them what's going on.
++ def find_objfile_suggestions_slow_core(build_id):
++ global __searching_message_printed
++
++ thread = Thread(target = find_objfile_suggestions_in_thread, args = (build_id, ))
++ thread.start()
++ start = time.time_ns()
++
++ while thread.is_alive ():
++ time.sleep(0.05)
++ now = time.time_ns ()
++ if not __searching_message_printed and (now - start > 1000000000):
++ print("Searching for packages to install that could improve debugging...")
++ __searching_message_printed = True
++
++ thread.join()
++
++
++ # Given BUILD_ID, a string containing a build-id, lookup suitable
++ # RPMs that could be installed to provide a file with the required
++ # build-id.
++ #
++ # Any suitable RPMs are recorded by calling `add_rpm_suggestion`, and
++ # will be printed before the next prompt.
++ def find_objfile_suggestions_slow(build_id):
++ global __build_id_lookup_cache
++ global __suggest_rpms
++
++ # The code to lookup an RPM given only a build-id is pretty
++ # slow. Cache the results to try and reduce the UI delays.
++ if build_id in __build_id_lookup_cache:
++ rpms = __build_id_lookup_cache[build_id]
++ if rpms is not None:
++ for r in rpms:
++ add_rpm_suggestion(r)
++ return
++
++ # Make sure the cache entry exists before we do the lookup.
++ # If, for any reason, the lookup raises an exception, then
++ # having a cache entry will prevent us retrying this lookup in
++ # the future.
++ __build_id_lookup_cache[build_id] = None
++
++ # Now do the lookup. This is the slow part.
++ find_objfile_suggestions_slow_core(build_id)
++
++ # Fill in the cache, for a given build-id which RPMs were
++ # suggested.
++ rpms = []
++ for r in __suggest_rpms:
++ rpms.append(r)
++ __build_id_lookup_cache[build_id] = rpms
++
++
++ # Given BUILD_ID, a string containing a build-id, just record that we
++ # should advise the user to try installing RPMs based on this build-id.
++ def find_objfile_suggestions_fast(build_id):
++ add_build_id_suggestion(build_id)
++
++ # Given BUILD_ID, a string containing a build-id, which GDB has failed
++ # to find, possibly record some information so that we can, at the next
++ # prompt, give some RPM installation advice to the user.
++ #
++ # We have two different strategies for RPM lookup based on a build-id,
++ # one approach is that we actually lookup the RPMs and only suggest
++ # something if there is a suitable RPM. However, this is pretty slow,
++ # and users will probably find this annoying.
++ #
++ # So we also have a fast way. With this approach we just record the
++ # build-id that was missing and tell the user to try installing based on
++ # the build-id. The downside with this is that if there is no RPM for
++ # that build-id, then the user will try the command, but nothing will
++ # install.
++ def find_objfile_suggestions(build_id):
++ if rpm_suggestion_is_disabled():
++ return
++
++ if param_rpm_suggestion_build_id_mode.fast_mode():
++ find_objfile_suggestions_fast(build_id)
++ else:
++ find_objfile_suggestions_slow(build_id)
++
++ # A missing debug handler class. Just forwards the name of the
++ # objfile for which we are missing debug information to
++ # find_debug_suggestions.
++ class RPM_MissingDebugHandler(gdb.missing_debug.MissingDebugHandler):
++ def __init__(self):
++ super().__init__("rpm-suggestions")
++
++ def __call__(self, objfile):
++ find_debug_suggestions(objfile.filename)
++ return False
++
++ # A missing objfile handler class. Just forwards the build-id of
++ # the objfile that is missing to find_objfile_suggestions.
++ class RPM_MissingObjfileHandler(gdb.missing_objfile.MissingObjfileHandler):
++ def __init__(self):
++ super().__init__("rpm-suggestions")
++
++ def __call__(self, pspace, build_id, filename):
++ find_objfile_suggestions(build_id)
++ return False
++
++ # Take a non-empty list of RPM names and print a command line a
++ # user could run to install these RPMs.
++ def print_rpm_suggestions(rpm_name_list):
++ print("Missing rpms, try: dnf --enablerepo='*debug*' install " + ' '.join(rpm_name_list))
++
++ # Take a non-empty list of build-id strings and print a series of
++ # lines that a user could run to instll the RPMs that provide
++ # files with this build-id.
++ #
++ # The printed commands will also install the corresponding debug
++ # packages for the executable with the given build-id.
++ def print_build_id_suggestions(build_id_list):
++ for build_id in build_id_list:
++ print("Missing file(s), try: dnf --enablerepo='*debug*' install "
++ + build_id_to_usr_lib_filename(build_id, False)
++ + ' '
++ + build_id_to_usr_lib_filename(build_id, True, ".debug"))
++
++ # Called before GDB displays its prompt. If the global __SUGGEST_RPMS
++ # dictionary is not empty, then this hook prints the keys of this
++ # dictionary as strings which are the names of RPMs. This hook formats
++ # each RPM name into a suggested 'dnf install' command and suggests this
++ # to the user.
++ #
++ # Additionally, if the global __SUGGEST_BUILD_IDS dictionary is not
++ # empty, then this hook uses the keys of this dictionary as build-ids
++ # that were found to be missing, and formats these into some file based
++ # 'dnf install' suggestions to the user.
++ def before_prompt():
++ global __suggest_rpms
++ global __suggest_build_ids
++ global __searching_message_printed
++
++ # We allow the searching message to be printed just once
++ # between prompts.
++ __searching_message_printed = False
++
++ if len(__suggest_rpms) > 0:
++ print_rpm_suggestions(__suggest_rpms.keys())
++ __suggest_rpms = {}
++
++ if len(__suggest_build_ids) > 0:
++ print_build_id_suggestions(__suggest_build_ids.keys())
++ __suggest_build_ids = {}
++
++ # Called when the executable within a progrm space is changed. Clear
++ # the lists of RPM suggestions. We only clear the previous suggestion
++ # list when the executable really changes. If the user simply
++ # recompiles the executable, then we don't both clearing this list.
++ def executable_changed_handler(event):
++ global __missing_rpms
++ global __suggest_rpms
++ global __suggest_build_ids
++ global __missing_build_ids
++
++ if not event.reload:
++ __missing_rpms = {}
++ __suggest_rpms = {}
++ __missing_build_ids = {}
++ __suggest_build_ids = {}
++
++
++ # Attach to the required GDB events.
++ gdb.events.executable_changed.connect(executable_changed_handler)
++ gdb.events.before_prompt.connect(before_prompt)
++
++ # Register the missing debug and missing objfile handlers with GDB.
++ gdb.missing_debug.register_handler(None, RPM_MissingDebugHandler())
++ gdb.missing_objfile.register_handler(None, RPM_MissingObjfileHandler())
++
++ # Implement the core of 'info rpm-suggestions'. Reprint all rpm
++ # suggestions.
++ def info_rpm_suggestions():
++ global __missing_rpms
++ global __missing_build_ids
++
++ if len(__missing_rpms) == 0 and len(__missing_build_ids) == 0:
++ print("No RPM suggestions have been made so far.")
++ return
++
++ if len(__missing_rpms) > 0:
++ print_rpm_suggestions(__missing_rpms.keys())
++ if len(__missing_build_ids) > 0:
++ print_build_id_suggestions(__missing_build_ids.keys())
++
++####################################################################
++# The following code is outside the 'else' block of the attempt to #
++# load the 'rpm' module. Nothing after this point depends on the #
++# 'rpm' module. #
++####################################################################
++
++# The 'set rpm-suggestion' prefix command.
++class rpm_suggestion_set_prefix(gdb.Command):
++ """Prefix command for 'set' rpm-suggestion related commands."""
++
++ def __init__(self):
++ super().__init__("set rpm-suggestion", gdb.COMMAND_NONE,
++ gdb.COMPLETE_NONE, True)
++
++# The 'show rpm-suggestion' prefix command.
++class rpm_suggestion_show_prefix(gdb.Command):
++ """Prefix command for 'show' rpm-suggestion related commands."""
++
++ def __init__(self):
++ super().__init__("show rpm-suggestion", gdb.COMMAND_NONE,
++ gdb.COMPLETE_NONE, True)
++
++# The 'set/show rpm-suggestion enabled' command.
++class rpm_suggestion_enabled(gdb.Parameter):
++ """
++ When 'on' GDB will search for RPMS that might provide additional
++ debug information, or provide missing executables or shared
++ libraries (when opening a core file), and will make suggestions
++ about what should be installed.
++
++ When 'off' GDB will not make these suggestions.
++ """
++
++ set_doc = "Set whether to perform rpm-suggestion."
++ show_doc = "Show whether rpm-suggestion is enabled."
++
++ def __init__(self):
++ super().__init__("rpm-suggestion enabled", gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)
++ self.value = True
++
++# The 'set/show rpm-suggestion enabled' command.
++class rpm_suggestion_build_id_mode(gdb.Parameter):
++ """
++ When set to 'fast' (the default), GDB doesn't try to map a build-id to
++ an actual RPM, instead, GDB just suggests a command based on the
++ build-id which might install some RPMs, if there are any RPMs that
++ supply that build-id. However, it is equally possible that there are no
++ suitable RPMs, and nothing will install. This approach has almost zero
++ overhead.
++
++ When set to 'slow', GDB first does the build-id to RPM check itself, and
++ only if something is found are RPMs installation commands suggested.
++ The suggested command will include the name of the RPM to install. This
++ approach is considerably slower as querying the RPM database for the RPM
++ that supplies a specific file is slow.
++ """
++
++ set_doc = "Set how build-id based rpm suggestions should be performed."
++ show_doc = "Show how build-id based rpm suggestions shoud be performed."
++
++ def __init__(self):
++ super().__init__("rpm-suggestion build-id-mode",
++ gdb.COMMAND_NONE, gdb.PARAM_ENUM, ["fast", "slow"])
++ self.value = "fast"
++
++ def fast_mode(self):
++ return self.value == "fast"
++
++# The 'info rpm-suggestions' command.
++class rpm_suggestion_info(gdb.Command):
++ """Relist any RPM installation suggestions that have been made
++ since the executable was last changed."""
++ def __init__(self):
++ super().__init__("info rpm-suggestions", gdb.COMMAND_NONE, gdb.COMPLETE_NONE)
++
++ def invoke(self, args, from_tty):
++ if args != "":
++ raise gdb.GdbError("unexpected arguments: %s" % args)
++
++ info_rpm_suggestions ()
++
++
++# Create the 'set/show rpm-suggestion' commands.
++rpm_suggestion_set_prefix()
++rpm_suggestion_show_prefix()
++param_rpm_suggestion_enabled = rpm_suggestion_enabled()
++param_rpm_suggestion_build_id_mode = rpm_suggestion_build_id_mode()
++
++# Create the 'info rpm-suggestions' commands.
++rpm_suggestion_info()
+diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
+@@ -0,0 +1,21 @@
++/* Copyright 2010 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ 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 . */
++
++void
++lib (void)
++{
++}
+diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
+@@ -0,0 +1,25 @@
++/* Copyright 2010 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ 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 . */
++
++extern void lib (void);
++
++int
++main (void)
++{
++ lib ();
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
+@@ -0,0 +1,104 @@
++# Copyright 2016 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 .
++
++require allow_shlib_tests
++
++set testfile "gcore-buildid-exec-but-not-solib"
++set srcmainfile ${testfile}-main.c
++set srclibfile ${testfile}-lib.c
++set libfile [standard_output_file ${testfile}-lib.so]
++set objfile [standard_output_file ${testfile}-main.o]
++set executable ${testfile}-main
++set binfile [standard_output_file ${executable}]
++set gcorefile [standard_output_file ${executable}.gcore]
++set outdir [file dirname $binfile]
++
++if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} "debug additional_flags=-Wl,--build-id"] != ""
++ || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objfile} object {debug}] != "" } {
++ unsupported "-Wl,--build-id compilation failed"
++ return -1
++}
++set opts [list debug shlib=${libfile} "additional_flags=-Wl,--build-id"]
++if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
++ unsupported "-Wl,--build-id compilation failed"
++ return -1
++}
++
++clean_restart $executable
++gdb_load_shlib $libfile
++
++# Does this gdb support gcore?
++set test "help gcore"
++gdb_test_multiple $test $test {
++ -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
++ # gcore command not supported -- nothing to test here.
++ unsupported "gdb does not support gcore on this target"
++ return -1;
++ }
++ -re "Save a core file .*\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++
++if { ![runto lib] } then {
++ return -1
++}
++
++set escapedfilename [string_to_regexp ${gcorefile}]
++
++set test "save a corefile"
++gdb_test_multiple "gcore ${gcorefile}" $test {
++ -re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "Can't create a corefile\r\n$gdb_prompt $" {
++ unsupported $test
++ return -1
++ }
++}
++
++# Now restart gdb and load the corefile.
++
++clean_restart $executable
++gdb_load_shlib $libfile
++
++set buildid [build_id_debug_filename_get $libfile]
++
++regsub {\.debug$} $buildid {} buildid
++
++set debugdir [standard_output_file ${testfile}-debugdir]
++file delete -force -- $debugdir
++
++file mkdir $debugdir/[file dirname $libfile]
++file copy $libfile $debugdir/${libfile}
++
++file mkdir $debugdir/[file dirname $buildid]
++file copy $libfile $debugdir/${buildid}
++
++remote_exec build "ln -s /lib ${debugdir}/"
++remote_exec build "ln -s /lib64 ${debugdir}/"
++# /usr is not needed, all the libs are in /lib64: libm.so.6 libc.so.6 ld-linux-x86-64.so.2
++
++gdb_test_no_output "set solib-absolute-prefix $debugdir" \
++ "set solib-absolute-prefix"
++
++gdb_test_no_output "set debug-file-directory $debugdir" "set debug-file-directory"
++
++gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile"
++
++gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded"
++
++gdb_test "bt"
++gdb_test "info shared"
+diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
+--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
++++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
+@@ -179,7 +179,8 @@ proc test_empty_history_filename { } {
+ global env
+ global gdb_prompt
+
+- set common_history [list "set height 0" "set width 0"]
++ set common_history [list "set height 0" "set width 0" \
++ "set rpm-suggestion enabled off"]
+
+ set test_dir [standard_output_file history_test]
+ remote_exec host "mkdir -p $test_dir"
+diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
+@@ -0,0 +1,60 @@
++# Copyright (C) 2014 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 .
++
++# Create a core file, then hide the executable. Restart GDB and load
++# the core file. Check GDB gives a message suggesting a 'dnf' command
++# to try and install the executable based on its build-id.
++
++standard_testfile "normal.c"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
++ return -1
++}
++
++# Get the build-id of the file.
++set build_id_debug_file [build_id_debug_filename_get $binfile]
++regsub -all ".debug$" $build_id_debug_file "" build_id_without_debug
++
++# Run to main.
++if { ![runto_main] } {
++ return -1
++}
++
++# We first need to generate a corefile.
++set corefilename "[standard_output_file gcore.test]"
++if { ![gdb_gcore_cmd "$corefilename" "save corefile"] } {
++ untested "could not generate a corefile"
++ return -1
++}
++
++# Move the binfile to a temporary name.
++remote_exec build "mv $binfile ${binfile}.old"
++
++# Reinitialize GDB and see if we get a dnf suggestion.
++clean_restart
++
++gdb_test "set rpm-suggestion enabled on" "" \
++ "turn on rpm-suggestion feature"
++
++# GDB only makes build-id based RPM suggestions if /usr/lib is in
++# the debug-file-directory list, the reason being that system RPMs
++# will always install under this location. If GDB is not looking
++# here then there's no point making suggestions.
++gdb_test "set debug-file-directory /usr/lib/" "" \
++ "set debug-file-directory"
++
++gdb_test "core-file [standard_output_file gcore.test]" \
++ "Missing file\\(s\\), try: dnf --enablerepo='\\*debug\\*' install [string_to_regexp /usr/lib/$build_id_without_debug] [string_to_regexp /usr/lib/debug/$build_id_debug_file]" \
++ "test first yum/dnf warning"
+diff --git a/gdb/testsuite/gdb.python/py-missing-debug.py b/gdb/testsuite/gdb.python/py-missing-debug.py
+--- a/gdb/testsuite/gdb.python/py-missing-debug.py
++++ b/gdb/testsuite/gdb.python/py-missing-debug.py
+@@ -19,6 +19,13 @@ from enum import Enum
+ import gdb
+ from gdb.missing_debug import MissingDebugHandler
+
++# This is a RHEL/Fedora work around: There's already a
++# missing-debug-info handler registered for these versions of GDB.
++# Discard the handler now so that the tests will pass (the tests
++# assume no handler is currently registered).
++gdb.missing_debug_handlers = []
++
++
+ # A global log that is filled in by instances of the LOG_HANDLER class
+ # when they are called.
+ handler_call_log = []
+@@ -118,4 +125,7 @@ def register(name, locus=None):
+ rhandler = exception_handler()
+ handler_obj = handler()
+
++# Discard the rpm-suggestion handler.
++gdb.missing_file_handlers = []
++
+ print("Success")
+diff --git a/gdb/testsuite/gdb.python/py-missing-objfile.py b/gdb/testsuite/gdb.python/py-missing-objfile.py
+--- a/gdb/testsuite/gdb.python/py-missing-objfile.py
++++ b/gdb/testsuite/gdb.python/py-missing-objfile.py
+@@ -164,4 +164,7 @@ def register(name, locus=None):
+ rhandler = exception_handler()
+ handler_obj = handler()
+
++# Discard the rpm-suggestion handler.
++gdb.missing_file_handlers = []
++
+ print("Success")
+diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
+--- a/gdb/testsuite/lib/gdb.exp
++++ b/gdb/testsuite/lib/gdb.exp
+@@ -255,7 +255,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
+ "-nx" \
+ "-q" \
+ {-iex "set height 0"} \
+- {-iex "set width 0"}]]
++ {-iex "set width 0"} \
++ {-iex "set rpm-suggestion enabled off"}]]
+
+ # If DEBUGINFOD_URLS is set, gdb will try to download sources and
+ # debug info for f.i. system libraries. Prevent this.
+@@ -2610,6 +2611,18 @@ proc default_gdb_start { } {
+ }
+ }
+
++ # Turn off the missing debug info messages as the testsuite does
++ # not expect them.
++ send_gdb "set rpm-suggestion enabled off\n"
++ gdb_expect 10 {
++ -re "$gdb_prompt $" {
++ verbose "Disabled the missing debug info messages." 2
++ }
++ timeout {
++ warning "Could not disable the missing debug info messages."
++ }
++ }
++
+ gdb_debug_init
+ return 0
+ }
+diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
+--- a/gdb/testsuite/lib/mi-support.exp
++++ b/gdb/testsuite/lib/mi-support.exp
+@@ -321,6 +321,17 @@ proc default_mi_gdb_start { { flags {} } } {
+ warning "Couldn't set the width to 0."
+ }
+ }
++ # Turn off the missing debug info messages as the testsuite does
++ # not expect them.
++ send_gdb "190-gdb-set rpm-suggestion enabled off\n"
++ gdb_expect 10 {
++ -re ".*190-gdb-set rpm-suggestion enabled off\r\n190\\\^done\r\n$mi_gdb_prompt$" {
++ verbose "Disabled the missing debug info messages." 2
++ }
++ timeout {
++ warning "Could not disable the missing debug info messages."
++ }
++ }
+
+ if { $separate_inferior_pty } {
+ mi_create_inferior_pty
diff --git a/gdb-archer-next-over-throw-cxx-exec.patch b/gdb-archer-next-over-throw-cxx-exec.patch
new file mode 100644
index 0000000..c5d58b3
--- /dev/null
+++ b/gdb-archer-next-over-throw-cxx-exec.patch
@@ -0,0 +1,88 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-archer-next-over-throw-cxx-exec.patch
+
+;; Fix follow-exec for C++ programs (bugreported by Martin Stransky).
+;;=fedoratest
+
+Archer-upstreamed:
+http://sourceware.org/ml/archer/2010-q2/msg00031.html
+
+diff --git a/gdb/testsuite/gdb.cp/cxxexec.cc b/gdb/testsuite/gdb.cp/cxxexec.cc
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/cxxexec.cc
+@@ -0,0 +1,25 @@
++/* This test script is part of GDB, the GNU debugger.
++
++ Copyright 2010 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 . */
++
++#include
++
++int
++main()
++{
++ execlp ("true", "true", NULL);
++ return 1;
++}
+diff --git a/gdb/testsuite/gdb.cp/cxxexec.exp b/gdb/testsuite/gdb.cp/cxxexec.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/cxxexec.exp
+@@ -0,0 +1,42 @@
++# Copyright 2010 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 .
++
++require allow_cplus_tests
++
++set testfile cxxexec
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } {
++ return -1
++}
++
++runto_main
++
++# We could stop after `continue' again at `main'.
++delete_breakpoints
++
++set test "p _Unwind_DebugHook"
++gdb_test_multiple $test $test {
++ -re " = .* 0x\[0-9a-f\].*\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "\r\nNo symbol .*\r\n$gdb_prompt $" {
++ xfail $test
++ untested ${testfile}.exp
++ return -1
++ }
++}
++
++# Run to end. The buggy GDB failed instead with:
++# Cannot access memory at address ADDR.
++gdb_continue_to_end "" "continue" 1
diff --git a/gdb-gstack.man b/gdb-gstack.man
new file mode 100644
index 0000000..1f4e406
--- /dev/null
+++ b/gdb-gstack.man
@@ -0,0 +1,48 @@
+.\"
+.\" gstack manual page.
+.\" Copyright (c) 1999 Ross Thompson
+.\" Copyright (c) 2001, 2002, 2004, 2008 Red Hat, Inc.
+.\"
+.\" Original author: Ross Thompson
+.\"
+.\" 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 2, 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; see the file COPYING. If not, write to
+.\" the Free Software Foundation, 59 Temple Place - Suite 330,
+.\" Boston, MA 02111-1307, USA.
+.\"
+.TH GSTACK 1 "Feb 15 2008" "Red Hat Linux" "Linux Programmer's Manual"
+
+.SH NAME
+gstack \- print a stack trace of a running process
+
+.SH SYNOPSIS
+.B gstack
+pid
+
+.SH DESCRIPTION
+
+\f3gstack\f1 attaches to the active process named by the \f3pid\f1 on
+the command line, and prints out an execution stack trace. If ELF
+symbols exist in the binary (usually the case unless you have run
+strip(1)), then symbolic addresses are printed as well.
+
+If the process is part of a thread group, then \f3gstack\f1 will print
+out a stack trace for each of the threads in the group.
+
+.SH SEE ALSO
+nm(1), ptrace(2), gdb(1)
+
+.SH AUTHORS
+Ross Thompson
+
+Red Hat, Inc.
diff --git a/gdb-orphanripper.c b/gdb-orphanripper.c
new file mode 100644
index 0000000..2653dd2
--- /dev/null
+++ b/gdb-orphanripper.c
@@ -0,0 +1,752 @@
+/*
+ * Copyright 2006-2007 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 2 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Reap any leftover children possibly holding file descriptors.
+ * Children are identified by the stale file descriptor or PGID / SID.
+ * Both can be missed but only the stale file descriptors are important for us.
+ * PGID / SID may be set by the children on their own.
+ * If we fine a candidate we kill it will all its process tree (grandchildren).
+ * The child process is run with `2>&1' redirection (due to forkpty(3)).
+ * 2007-07-10 Jan Kratochvil
+ */
+
+/* For getpgid(2). */
+#define _GNU_SOURCE 1
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define LENGTH(x) (sizeof (x) / sizeof (*(x)))
+
+static const char *progname;
+
+static volatile pid_t child;
+
+static void signal_chld (int signo)
+{
+}
+
+static volatile int signal_alrm_hit = 0;
+
+static void signal_alrm (int signo)
+{
+ signal_alrm_hit = 1;
+}
+
+static char childptyname[LINE_MAX];
+
+static void print_child_error (const char *reason, char **argv)
+{
+ char **sp;
+
+ fprintf (stderr, "%s: %d %s:", progname, (int) child, reason);
+ for (sp = argv; *sp != NULL; sp++)
+ {
+ fputc (' ', stderr);
+ fputs (*sp, stderr);
+ }
+ fputc ('\n', stderr);
+}
+
+static int read_out (int amaster)
+{
+ char buf[LINE_MAX];
+ ssize_t buf_got;
+
+ buf_got = read (amaster, buf, sizeof buf);
+ if (buf_got == 0)
+ return 0;
+ /* Weird but at least after POLLHUP we get EIO instead of just EOF. */
+ if (buf_got == -1 && errno == EIO)
+ return 0;
+ if (buf_got == -1 && errno == EAGAIN)
+ return 0;
+ if (buf_got < 0)
+ {
+ perror ("read (amaster)");
+ exit (EXIT_FAILURE);
+ }
+ if (write (STDOUT_FILENO, buf, buf_got) != buf_got)
+ {
+ perror ("write(2)");
+ exit (EXIT_FAILURE);
+ }
+ return 1;
+}
+
+/* kill (child, 0) == 0 sometimes even when CHILD's state is already "Z". */
+
+static int child_exited (void)
+{
+ char buf[200];
+ int fd, i, retval;
+ ssize_t got;
+ char state[3];
+
+ snprintf (buf, sizeof (buf), "/proc/%ld/stat", (long) child);
+ fd = open (buf, O_RDONLY);
+ if (fd == -1)
+ {
+ perror ("open (/proc/CHILD/stat)");
+ exit (EXIT_FAILURE);
+ }
+ got = read (fd, buf, sizeof(buf));
+ if (got <= 0)
+ {
+ perror ("read (/proc/CHILD/stat)");
+ exit (EXIT_FAILURE);
+ }
+ if (close (fd) != 0)
+ {
+ perror ("close (/proc/CHILD/stat)");
+ exit (EXIT_FAILURE);
+ }
+ /* RHEL-5 does not support %ms. */
+ i = sscanf (buf, "%*d%*s%2s", state);
+ if (i != 1)
+ {
+ perror ("sscanf (/proc/CHILD/stat)");
+ exit (EXIT_FAILURE);
+ }
+ retval = strcmp (state, "Z") == 0;
+ return retval;
+}
+
+static int spawn (char **argv, int timeout)
+{
+ pid_t child_got;
+ int status, amaster, i, rc;
+ struct sigaction act;
+ sigset_t set;
+ struct termios termios;
+ unsigned alarm_orig;
+
+ /* We do not use signal(2) to be sure we do not have SA_RESTART. */
+ memset (&act, 0, sizeof (act));
+ act.sa_handler = signal_chld;
+ i = sigemptyset (&act.sa_mask);
+ assert (i == 0);
+ act.sa_flags = 0; /* !SA_RESTART */
+ i = sigaction (SIGCHLD, &act, NULL);
+ assert (i == 0);
+
+ i = sigemptyset (&set);
+ assert (i == 0);
+ i = sigaddset (&set, SIGCHLD);
+ assert (i == 0);
+ i = sigprocmask (SIG_SETMASK, &set, NULL);
+ assert (i == 0);
+
+ /* With TERMP passed as NULL we get "\n" -> "\r\n". */
+ termios.c_iflag = IGNBRK | IGNPAR;
+ termios.c_oflag = 0;
+ termios.c_cflag = CS8 | CREAD | CLOCAL | HUPCL | B9600;
+ termios.c_lflag = IEXTEN | NOFLSH;
+ memset (termios.c_cc, _POSIX_VDISABLE, sizeof (termios.c_cc));
+ termios.c_cc[VTIME] = 0;
+ termios.c_cc[VMIN ] = 1;
+ cfmakeraw (&termios);
+#ifdef FLUSHO
+ /* Workaround a readline deadlock bug in _get_tty_settings(). */
+ termios.c_lflag &= ~FLUSHO;
+#endif
+ child = forkpty (&amaster, childptyname, &termios, NULL);
+ switch (child)
+ {
+ case -1:
+ perror ("forkpty(3)");
+ exit (EXIT_FAILURE);
+ case 0:
+ /* Do not replace STDIN as inferiors query its termios. */
+#if 0
+ i = close (STDIN_FILENO);
+ assert (i == 0);
+ i = open ("/dev/null", O_RDONLY);
+ assert (i == STDIN_FILENO);
+#endif
+
+ i = sigemptyset (&set);
+ assert (i == 0);
+ i = sigprocmask (SIG_SETMASK, &set, NULL);
+ assert (i == 0);
+
+ /* Do not setpgrp(2) in the parent process as the process-group
+ is shared for the whole sh(1) pipeline we could be a part
+ of. The process-group is set according to PID of the first
+ command in the pipeline.
+ We would rip even vi(1) in the case of:
+ ./orphanripper sh -c 'sleep 1&' | vi -
+ */
+ /* Do not setpgrp(2) as our pty would not be ours and we would
+ get `SIGSTOP' later, particularly after spawning gdb(1).
+ setsid(3) was already executed by forkpty(3) and it would fail if
+ executed again. */
+ if (getpid() != getpgrp ())
+ {
+ perror ("getpgrp(2)");
+ exit (EXIT_FAILURE);
+ }
+ execvp (argv[0], argv);
+ perror ("execvp(2)");
+ exit (EXIT_FAILURE);
+ default:
+ break;
+ }
+ i = fcntl (amaster, F_SETFL, O_RDWR | O_NONBLOCK);
+ if (i != 0)
+ {
+ perror ("fcntl (amaster, F_SETFL, O_NONBLOCK)");
+ exit (EXIT_FAILURE);
+ }
+
+ /* We do not use signal(2) to be sure we do not have SA_RESTART. */
+ act.sa_handler = signal_alrm;
+ i = sigaction (SIGALRM, &act, NULL);
+ assert (i == 0);
+
+ alarm_orig = alarm (timeout);
+ assert (alarm_orig == 0);
+
+ i = sigemptyset (&set);
+ assert (i == 0);
+
+ while (!signal_alrm_hit)
+ {
+ struct pollfd pollfd;
+
+ pollfd.fd = amaster;
+ pollfd.events = POLLIN;
+ i = ppoll (&pollfd, 1, NULL, &set);
+ if (i == -1 && errno == EINTR)
+ {
+ if (child_exited ())
+ break;
+ /* Non-CHILD child may have exited. */
+ continue;
+ }
+ assert (i == 1);
+ /* Data available? Process it first. */
+ if (pollfd.revents & POLLIN)
+ {
+ if (!read_out (amaster))
+ {
+ fprintf (stderr, "%s: Unexpected EOF\n", progname);
+ exit (EXIT_FAILURE);
+ }
+ }
+ if (pollfd.revents & POLLHUP)
+ break;
+ if ((pollfd.revents &= ~POLLIN) != 0)
+ {
+ fprintf (stderr, "%s: ppoll(2): revents 0x%x\n", progname,
+ (unsigned) pollfd.revents);
+ exit (EXIT_FAILURE);
+ }
+ /* Child exited? */
+ if (child_exited ())
+ break;
+ }
+
+ if (signal_alrm_hit)
+ {
+ i = kill (child, SIGKILL);
+ assert (i == 0);
+ }
+ else
+ alarm (0);
+
+ /* WNOHANG still could fail. */
+ child_got = waitpid (child, &status, 0);
+ if (child != child_got)
+ {
+ fprintf (stderr, "waitpid (%d) = %d: %m\n", (int) child, (int) child_got);
+ exit (EXIT_FAILURE);
+ }
+ if (signal_alrm_hit)
+ {
+ char *buf;
+
+ if (asprintf (&buf, "Timed out after %d seconds", timeout) != -1)
+ {
+ print_child_error (buf, argv);
+ free (buf);
+ }
+ rc = 128 + SIGALRM;
+ }
+ else if (WIFEXITED (status))
+ rc = WEXITSTATUS (status);
+ else if (WIFSIGNALED (status))
+ {
+ print_child_error (strsignal (WTERMSIG (status)), argv);
+ rc = 128 + WTERMSIG (status);
+ }
+ else if (WIFSTOPPED (status))
+ {
+ fprintf (stderr, "waitpid (%d): WIFSTOPPED - WSTOPSIG is %d\n",
+ (int) child, WSTOPSIG (status));
+ exit (EXIT_FAILURE);
+ }
+ else
+ {
+ fprintf (stderr, "waitpid (%d): !WIFEXITED (%d)\n", (int) child, status);
+ exit (EXIT_FAILURE);
+ }
+
+ /* Not used in fact. */
+ i = sigprocmask (SIG_SETMASK, &set, NULL);
+ assert (i == 0);
+
+ /* Do not unset O_NONBLOCK as a stale child (the whole purpose of this
+ program) having open its output pty would block us in read_out. */
+#if 0
+ i = fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */);
+ if (i != 0)
+ {
+ perror ("fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */)");
+ exit (EXIT_FAILURE);
+ }
+#endif
+
+ while (read_out (amaster));
+
+ /* Do not close the master FD as the child would have `/dev/pts/23 (deleted)'
+ entries which are not expected (and expecting ` (deleted)' would be
+ a race. */
+#if 0
+ i = close (amaster);
+ if (i != 0)
+ {
+ perror ("close (forkpty ()'s amaster)");
+ exit (EXIT_FAILURE);
+ }
+#endif
+
+ return rc;
+}
+
+/* Detected commandline may look weird due to a race:
+ Original command:
+ ./orphanripper sh -c 'sleep 1&' &
+ Correct output:
+ [1] 29610
+ ./orphanripper: Killed -9 orphan PID 29612 (PGID 29611): sleep 1
+ Raced output (sh(1) child still did not update its argv[]):
+ [1] 29613
+ ./orphanripper: Killed -9 orphan PID 29615 (PGID 29614): sh -c sleep 1&
+ We could delay a bit before ripping the children. */
+static const char *read_cmdline (pid_t pid)
+{
+ char cmdline_fname[32];
+ static char cmdline[LINE_MAX];
+ int fd;
+ ssize_t got;
+ char *s;
+
+ if (snprintf (cmdline_fname, sizeof cmdline_fname, "/proc/%d/cmdline",
+ (int) pid) < 0)
+ return NULL;
+ fd = open (cmdline_fname, O_RDONLY);
+ if (fd == -1)
+ {
+ /* It may have already exited - ENOENT. */
+#if 0
+ fprintf (stderr, "%s: open (\"%s\"): %m\n", progname, cmdline_fname);
+#endif
+ return NULL;
+ }
+ got = read (fd, cmdline, sizeof (cmdline) - 1);
+ if (got == -1)
+ fprintf (stderr, "%s: read (\"%s\"): %m\n", progname,
+ cmdline_fname);
+ if (close (fd) != 0)
+ fprintf (stderr, "%s: close (\"%s\"): %m\n", progname,
+ cmdline_fname);
+ if (got < 0)
+ return NULL;
+ /* Convert '\0' argument delimiters to spaces. */
+ for (s = cmdline; s < cmdline + got; s++)
+ if (!*s)
+ *s = ' ';
+ /* Trim the trailing spaces (typically single '\0'->' '). */
+ while (s > cmdline && isspace (s[-1]))
+ s--;
+ *s = 0;
+ return cmdline;
+}
+
+static int dir_scan (const char *dirname,
+ int (*callback) (struct dirent *dirent, const char *pathname))
+{
+ DIR *dir;
+ struct dirent *dirent;
+ int rc = 0;
+
+ dir = opendir (dirname);
+ if (dir == NULL)
+ {
+ if (errno == EACCES || errno == ENOENT)
+ return rc;
+ fprintf (stderr, "%s: opendir (\"%s\"): %m\n", progname, dirname);
+ exit (EXIT_FAILURE);
+ }
+ while ((errno = 0, dirent = readdir (dir)))
+ {
+ char pathname[LINE_MAX];
+ int pathname_len;
+
+ pathname_len = snprintf (pathname, sizeof pathname, "%s/%s",
+ dirname, dirent->d_name);
+ if (pathname_len <= 0 || pathname_len >= (int) sizeof pathname)
+ {
+ fprintf (stderr, "entry file name too long: `%s' / `%s'\n",
+ dirname, dirent->d_name);
+ continue;
+ }
+ /* RHEL-4.5 on s390x never fills in D_TYPE. */
+ if (dirent->d_type == DT_UNKNOWN)
+ {
+ struct stat statbuf;
+ int i;
+
+ /* We are not interested in the /proc/PID/fd/ links targets. */
+ i = lstat (pathname, &statbuf);
+ if (i == -1)
+ {
+ if (errno == EACCES || errno == ENOENT)
+ continue;
+ fprintf (stderr, "%s: stat (\"%s\"): %m\n", progname, pathname);
+ exit (EXIT_FAILURE);
+ }
+ if (S_ISDIR (statbuf.st_mode))
+ dirent->d_type = DT_DIR;
+ if (S_ISLNK (statbuf.st_mode))
+ dirent->d_type = DT_LNK;
+ /* No other D_TYPE types used in this code. */
+ }
+ rc = (*callback) (dirent, pathname);
+ if (rc != 0)
+ {
+ errno = 0;
+ break;
+ }
+ }
+ if (errno != 0)
+ {
+ fprintf (stderr, "%s: readdir (\"%s\"): %m\n", progname, dirname);
+ exit (EXIT_FAILURE);
+ }
+ if (closedir (dir) != 0)
+ {
+ fprintf (stderr, "%s: closedir (\"%s\"): %m\n", progname, dirname);
+ exit (EXIT_FAILURE);
+ }
+ return rc;
+}
+
+static int fd_fs_scan (pid_t pid, int (*func) (pid_t pid, const char *link))
+{
+ char dirname[64];
+
+ if (snprintf (dirname, sizeof dirname, "/proc/%d/fd", (int) pid) < 0)
+ {
+ perror ("snprintf(3)");
+ exit (EXIT_FAILURE);
+ }
+
+ int callback (struct dirent *dirent, const char *pathname)
+ {
+ char buf[LINE_MAX];
+ ssize_t buf_len;
+
+ if ((dirent->d_type != DT_DIR && dirent->d_type != DT_LNK)
+ || (dirent->d_type == DT_DIR && strcmp (dirent->d_name, ".") != 0
+ && strcmp (dirent->d_name, "..") != 0)
+ || (dirent->d_type == DT_LNK && strspn (dirent->d_name, "0123456789")
+ != strlen (dirent->d_name)))
+ {
+ fprintf (stderr, "Unexpected entry \"%s\" (d_type %u)"
+ " on readdir (\"%s\"): %m\n",
+ dirent->d_name, (unsigned) dirent->d_type, dirname);
+ return 0;
+ }
+ if (dirent->d_type == DT_DIR)
+ return 0;
+ buf_len = readlink (pathname, buf, sizeof buf - 1);
+ if (buf_len <= 0 || buf_len >= (ssize_t) sizeof buf - 1)
+ {
+ if (errno != ENOENT && errno != EACCES)
+ fprintf (stderr, "Error reading link \"%s\": %m\n", pathname);
+ return 0;
+ }
+ buf[buf_len] = 0;
+ return (*func) (pid, buf);
+ }
+
+ return dir_scan (dirname, callback);
+}
+
+static void pid_fs_scan (void (*func) (pid_t pid, void *data), void *data)
+{
+ int callback (struct dirent *dirent, const char *pathname)
+ {
+ if (dirent->d_type != DT_DIR
+ || strspn (dirent->d_name, "0123456789") != strlen (dirent->d_name))
+ return 0;
+ (*func) (atoi (dirent->d_name), data);
+ return 0;
+ }
+
+ dir_scan ("/proc", callback);
+}
+
+static int rip_check_ptyname (pid_t pid, const char *link)
+{
+ assert (pid != getpid ());
+
+ return strcmp (link, childptyname) == 0;
+}
+
+struct pid
+ {
+ struct pid *next;
+ pid_t pid;
+ };
+static struct pid *pid_list;
+
+static int pid_found (pid_t pid)
+{
+ struct pid *entry;
+
+ for (entry = pid_list; entry != NULL; entry = entry->next)
+ if (entry->pid == pid)
+ return 1;
+ return 0;
+}
+
+/* Single pass is not enough, a (multithreaded) process was seen to survive.
+ Repeated killing of the same process is not enough, zombies can be killed.
+ */
+static int cleanup_acted;
+
+static void pid_record (pid_t pid)
+{
+ struct pid *entry;
+
+ if (pid_found (pid))
+ return;
+ cleanup_acted = 1;
+
+ entry = malloc (sizeof (*entry));
+ if (entry == NULL)
+ {
+ fprintf (stderr, "%s: malloc: %m\n", progname);
+ exit (EXIT_FAILURE);
+ }
+ entry->pid = pid;
+ entry->next = pid_list;
+ pid_list = entry;
+}
+
+static void pid_forall (void (*func) (pid_t pid))
+{
+ struct pid *entry;
+
+ for (entry = pid_list; entry != NULL; entry = entry->next)
+ (*func) (entry->pid);
+}
+
+/* Returns 0 on failure. */
+static pid_t pid_get_parent (pid_t pid)
+{
+ char fname[64];
+ FILE *f;
+ char line[LINE_MAX];
+ pid_t retval = 0;
+
+ if (snprintf (fname, sizeof fname, "/proc/%d/status", (int) pid) < 0)
+ {
+ perror ("snprintf(3)");
+ exit (EXIT_FAILURE);
+ }
+ f = fopen (fname, "r");
+ if (f == NULL)
+ {
+ return 0;
+ }
+ while (errno = 0, fgets (line, sizeof line, f) == line)
+ {
+ if (strncmp (line, "PPid:\t", sizeof "PPid:\t" - 1) != 0)
+ continue;
+ retval = atoi (line + sizeof "PPid:\t" - 1);
+ errno = 0;
+ break;
+ }
+ if (errno != 0)
+ {
+ fprintf (stderr, "%s: fgets (\"%s\"): %m\n", progname, fname);
+ exit (EXIT_FAILURE);
+ }
+ if (fclose (f) != 0)
+ {
+ fprintf (stderr, "%s: fclose (\"%s\"): %m\n", progname, fname);
+ exit (EXIT_FAILURE);
+ }
+ return retval;
+}
+
+static void killtree (pid_t pid);
+
+static void killtree_pid_fs_scan (pid_t pid, void *data)
+{
+ pid_t parent_pid = *(pid_t *) data;
+
+ /* Do not optimize it as we could miss some newly spawned processes.
+ Always traverse all the leaves. */
+#if 0
+ /* Optimization. */
+ if (pid_found (pid))
+ return;
+#endif
+
+ if (pid_get_parent (pid) != parent_pid)
+ return;
+
+ killtree (pid);
+}
+
+static void killtree (pid_t pid)
+{
+ pid_record (pid);
+ pid_fs_scan (killtree_pid_fs_scan, &pid);
+}
+
+static void rip_pid_fs_scan (pid_t pid, void *data)
+{
+ pid_t pgid;
+
+ /* Shouldn't happen. */
+ if (pid == getpid ())
+ return;
+
+ /* Check both PGID and the stale file descriptors. */
+ pgid = getpgid (pid);
+ if (pgid == child
+ || fd_fs_scan (pid, rip_check_ptyname) != 0)
+ killtree (pid);
+}
+
+static void killproc (pid_t pid)
+{
+ const char *cmdline;
+
+ cmdline = read_cmdline (pid);
+ /* Avoid printing the message for already gone processes. */
+ if (kill (pid, 0) != 0 && errno == ESRCH)
+ return;
+ if (cmdline == NULL)
+ cmdline = "";
+ fprintf (stderr, "%s: Killed -9 orphan PID %d: %s\n", progname, (int) pid, cmdline);
+ if (kill (pid, SIGKILL) == 0)
+ cleanup_acted = 1;
+ else if (errno != ESRCH)
+ fprintf (stderr, "%s: kill (%d, SIGKILL): %m\n", progname, (int) pid);
+ /* RHEL-3 kernels cannot SIGKILL a `T (stopped)' process. */
+ kill (pid, SIGCONT);
+ /* Do not waitpid(2) as it cannot be our direct descendant and it gets
+ cleaned up by init(8). */
+#if 0
+ pid_t pid_got;
+ pid_got = waitpid (pid, NULL, 0);
+ if (pid != pid_got)
+ {
+ fprintf (stderr, "%s: waitpid (%d) != %d: %m\n", progname,
+ (int) pid, (int) pid_got);
+ return;
+ }
+#endif
+}
+
+static void rip (void)
+{
+ cleanup_acted = 0;
+ do
+ {
+ if (cleanup_acted)
+ usleep (1000000 / 10);
+ cleanup_acted = 0;
+ pid_fs_scan (rip_pid_fs_scan, NULL);
+ pid_forall (killproc);
+ }
+ while (cleanup_acted);
+}
+
+int main (int argc, char **argv)
+{
+ int timeout = 0;
+ int rc;
+
+ progname = *argv++;
+ argc--;
+
+ if (argc < 1 || strcmp (*argv, "-h") == 0
+ || strcmp (*argv, "--help") == 0)
+ {
+ puts ("Syntax: orphanripper [-t ] ");
+ exit (EXIT_FAILURE);
+ }
+ if ((*argv)[0] == '-' && (*argv)[1] == 't')
+ {
+ char *timeout_s = NULL;
+
+ if ((*argv)[2] == 0)
+ timeout_s = *++argv;
+ else if (isdigit ((*argv)[2]))
+ timeout_s = (*argv) + 2;
+ if (timeout_s != NULL)
+ {
+ long l;
+ char *endptr;
+
+ argv++;
+ l = strtol (timeout_s, &endptr, 0);
+ timeout = l;
+ if ((endptr != NULL && *endptr != 0) || timeout < 0 || timeout != l)
+ {
+ fprintf (stderr, "%s: Invalid timeout value: %s\n", progname,
+ timeout_s);
+ exit (EXIT_FAILURE);
+ }
+ }
+ }
+
+ rc = spawn (argv, timeout);
+ rip ();
+ return rc;
+}
diff --git a/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
new file mode 100644
index 0000000..20e5f75
--- /dev/null
+++ b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
@@ -0,0 +1,83 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
+
+;; Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
+;;=fedoratest
+
+diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
+@@ -0,0 +1,26 @@
++/* Copyright (C) 2012 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ 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 . */
++
++#include
++#include
++
++int
++main (int argc, char *argv[])
++{
++ printf ("Hello, World.\n");
++ abort ();
++}
+diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
+@@ -0,0 +1,39 @@
++# Copyright 2012 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 .
++
++set testfile "set-solib-absolute-prefix"
++set srcfile ${testfile}.c
++
++# It is necessary to verify if the binary is 32-bit, so that the system
++# call `__kernel_vsyscall' originates from vDSO.
++
++if { ![is_ilp32_target] } {
++ return -1
++}
++
++if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
++ return -1
++}
++
++if { ![runto_main] } {
++ return -1
++}
++
++gdb_test "continue" "Program received signal SIGABRT, Aborted.*" \
++ "continue until abort"
++gdb_test "set solib-absolute-prefix /BOGUS_DIRECT" \
++ ".*warning: Unable to find dynamic linker breakpoint function.*" \
++ "set solib-absolute-prefix"
++gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall"
diff --git a/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch b/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
new file mode 100644
index 0000000..555eefb
--- /dev/null
+++ b/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
@@ -0,0 +1,174 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
+
+;; Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
+;;=fedoratest
+
+Original message by Tom Tromey:
+
+
+ Message-ID: <871uoc1va3.fsf@fleche.redhat.com>
+
+Comment from Sergio Durigan Junior:
+
+ In order to correctly test this patch, I wrote a testcase based on Jan
+ Kratochvil's . The
+ testcase, which can be seen below, tests GDB in order to see if the
+ amount of memory being leaked is minimal, as requested in the bugzilla.
+ It is hard to define what "minimum" is, so I ran the testcase on all
+ supported RHEL architectures and came up with an average.
+
+commit cc0265cdda9dc7e8665e8bfcf5b4477489daf27c
+Author: Tom Tromey
+Date: Wed Mar 28 17:38:08 2012 +0000
+
+ * python/py-inferior.c (infpy_read_memory): Remove cleanups and
+ explicitly free 'buffer' on exit paths. Decref 'membuf_object'
+ before returning.
+
+diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c
+@@ -0,0 +1,27 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2014 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 . */
++
++static struct x
++ {
++ char unsigned u[4096];
++ } x, *px = &x;
++
++int
++main (int argc, char *argv[])
++{
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp
+@@ -0,0 +1,72 @@
++# Copyright 2014 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 .
++
++load_lib gdb-python.exp
++
++require allow_python_tests
++
++set testfile py-gdb-rhbz1007614-memleak-infpy_read_memory
++set srcfile ${testfile}.c
++set binfile [standard_output_file ${testfile}]
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
++ return -1
++}
++
++set pid_of_gdb [exp_pid -i [board_info host fileid]]
++
++proc memory_v_pages_get {} {
++ global pid_of_gdb
++ set fd [open "/proc/$pid_of_gdb/statm"]
++ gets $fd line
++ close $fd
++ # number of pages of virtual memory
++ scan $line "%d" drs
++ return $drs
++}
++
++if { ![runto_main] } {
++ untested $testfile.exp
++ return -1
++}
++
++set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
++
++gdb_test "source ${remote_python_file}" ""
++
++gdb_test "hello-world" "" \
++ "first hello-world test"
++
++set kbytes_before [memory_v_pages_get]
++verbose -log "kbytes_before = $kbytes_before"
++
++gdb_test "hello-world" "" \
++ "second hello-world test"
++
++set kbytes_after [memory_v_pages_get]
++verbose -log "kbytes_after = $kbytes_after"
++
++set kbytes_diff [expr $kbytes_after - $kbytes_before]
++verbose -log "kbytes_diff = $kbytes_diff"
++
++# The value "1000" was calculated by running a few GDB sessions with this
++# testcase, and seeing how much (in average) the memory consumption
++# increased after the "hello-world" command issued above. The average
++# was around 500 bytes, so I chose 1000 as a high estimate.
++if { $kbytes_diff > 1000 } {
++ fail "there is a memory leak on GDB (RHBZ 1007614)"
++} else {
++ pass "there is not a memory leak on GDB (RHBZ 1007614)"
++}
+diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py
+@@ -0,0 +1,30 @@
++# Copyright (C) 2014 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 .
++
++class HelloWorld (gdb.Command):
++ """Greet the whole world."""
++
++ def __init__ (self):
++ super (HelloWorld, self).__init__ ("hello-world",
++ gdb.COMMAND_OBSCURE)
++
++ def invoke (self, arg, from_tty):
++ px = gdb.parse_and_eval("px")
++ core = gdb.inferiors()[0]
++ for i in range(256 * 1024):
++ chunk = core.read_memory(px, 4096)
++ print "Hello, World!"
++
++HelloWorld ()
diff --git a/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch b/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
new file mode 100644
index 0000000..d92bfc3
--- /dev/null
+++ b/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
@@ -0,0 +1,235 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
+
+;; Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
+;; Kratochvil, RH BZ 1084404).
+;;=fedoratest
+
+These testcases have been created by compiling glibc-2.17-78 on
+RHEL-7.1 s390x/ppc64 boxes, and then taking the "select.o" file
+present at $builddir/misc/select.o.
+
+diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
+@@ -0,0 +1,34 @@
++# Copyright 2015 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 .
++
++if { ![istarget powerpc64-*linux-*] || ![is_lp64_target] } {
++ verbose "Skipping ppc64-prologue-skip.exp"
++ return
++}
++
++set testfile "ppc64-prologue-skip"
++set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
++set ofile "${srcdir}/${subdir}/${testfile}.o"
++
++if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
++ untested "failed uudecode"
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_load $ofile
++
++gdb_test "break ___newselect_nocancel" "Breakpoint $decimal at 0xc: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on ___newselect_nocancel"
+diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu
+@@ -0,0 +1,70 @@
++begin 644 ppc64-skip-prologue.o.uu
++M?T5,1@("`0`````````````!`!4````!````````````````````````````
++M``-(``````!```````!``!0`$8%-B-`L"@``0,(`-#@``(Y$```"3.,`('P(
++M`J;X`0`0^"'_D4@```%@````Z`$`@#@A`'!\"`.F3H``(/@A_X%]*`*F^2$`
++MD/CA`-#XP0#(^*$`P/B!`+CX80"P2````6````#X80!PZ.$`T.C!`,CHH0#`
++MZ($`N.AA`+`X``".1````GP``";X80!X^`$`B.AA`'!(```!8````.DA`)#H
++M`0"(Z&$`>'TH`Z9\#_$@."$`@$SC`"!+__]@```````,($``````````O``(
++M7U]S96QE8W0```````````````````````````!6``(````Y!`'[#@T``0$!
++M`0````$```$N+B]S>7-D97!S+W5N:7@``'-Y"]S>7-C86QL+71E;7!L871E
++M+E,`+W)O;W0O9VQI8F,O9VQI8F,M,BXQ-RTW."YE;#$$!&PP!````
++M`#`````8`````````+P`20YP$4%^1`X`009!0@Z``4(107Y2$49_20X`!D$&
++M1@``````+G-Y;71A8@`N`````````!(````$@````$`````````"``````````8````
++M)@````$``````````P```````````````````1@`````````````````````
++M``````````$``````````````"P````(``````````,`````````````````
++M``$8```````````````````````````````!```````````````V`````0``
++M```````#```````````````````!&``````````0````````````````````
++M"```````````````,0````0`````````````````````````````"L``````
++M````,````!(````%``````````@`````````&````#L````!````````````
++M``````````````````$H```````````````````````````````!````````
++M``````!0`````0`````````````````````````````!*`````````!:````
++M`````````````````0``````````````2P````0`````````````````````
++M````````"O``````````&````!(````(``````````@`````````&````&$`
++M```!``````````````````````````````&"`````````),`````````````
++M```````!``````````````!<````!``````````````````````````````+
++M"`````````!@````$@````H`````````"``````````8````;0````$`````
++M`````````````````````````A4`````````%`````````````````````$`
++M`````````````(`````!``````````````````````````````(P````````
++M`#`````````````````````0``````````````![````!```````````````
++M```````````````+:``````````P````$@````T`````````"``````````8
++M````E`````$``````````@```````````````````F``````````2```````
++M``````````````@``````````````(\````$````````````````````````
++M``````N8`````````!@````2````#P`````````(`````````!@````1````
++M`P`````````````````````````````"J`````````">````````````````
++M`````0```````````````0````(`````````````````````````````"$@`
++M```````!L````!,````+``````````@`````````&`````D````#````````
++M``````````````````````GX`````````'H````````````````````!````
++M`````````````````````````````````````````````P```0``````````
++M`````````````````P```P```````````````````````````P``!```````
++M`````````````````````P``!0```````````````````````````P``"@``
++M`````````````````````````P``#````````````````````````````P``
++M"````````````````````````````P``#0``````````````````````````
++M`P``#P```````````````````````````P``!P``````````````````````
++M```!$@``!0```````````````````-@````*$@```0`````````,````````
++M`#`````@$``````````````````````````````P$```````````````````
++M``````````!*$`````````````````````````````!E(@``!0``````````
++M`````````-@```!S(@``!0```````````````````-@`7U]S96QE8W0`7U]?
++M;F5W6YC8V%N8V5L`%]?;&EB8U]D:7-A8FQE7V%S>6YC8V%N8V5L`%]?
++M;&EB8U]S96QE8W0`.
++
++if { ![istarget s390x-*linux-*] || ![is_lp64_target] } {
++ verbose "Skipping s390x-prologue-skip.exp"
++ return
++}
++
++set testfile "s390x-prologue-skip"
++set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
++set ofile "${srcdir}/${subdir}/${testfile}.o"
++
++if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
++ untested "failed uudecode"
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_load $ofile
++
++gdb_test "break select" "Breakpoint $decimal at 0x48: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on select"
+diff --git a/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu
+@@ -0,0 +1,64 @@
++begin 644 s390x-prologue-skip.o.uu
++M?T5,1@("`0`````````````!`!8````!````````````````````````````
++M``+```````!```````!``!(`#^LE\!``).O?\&@`)+D$`.^G^_]@X^#P```D
++MP.4`````N00``NLE\+``!`J.N00`TKD$`"#`Y0````"Y!``MZ]_Q"``$I_0`
++M"L`0`````+\/$`"G=/_7"HZG2?`!N2$`),"T``````?^````5@`"````.0$!
++M^PX-``$!`0$````!```!+BXO7-C86QL+71E;7!L
++M871E+E,``0`````)`@```````````]```0)F$P("``$!````CP`"``````@!
++M```````````````````````````N+B]S>7-D97!S+W5N:7@OE(``7@.
++M`1L,#Z`!````````&````!P`````````1`!,CP6.!HT'2`[``@```!`````X
++M`````````"```````"YS>6UT86(`+G-T``````````&````!`````&``````````@`````````
++M&````%<````!``````````````````````````````$"`````````),`````
++M```````````````!``````````````!2````!```````````````````````
++M```````)^`````````!@````$`````@`````````"``````````8````8P``
++M``$``````````````````````````````94`````````%```````````````
++M``````$``````````````'8````!``````````````````````````````&P
++M`````````#`````````````````````0``````````````!Q````!```````
++M```````````````````````*6``````````P````$`````L`````````"```
++M```````8````B@````$``````````@```````````````````>``````````
++M2`````````````````````@``````````````(4````$````````````````
++M``````````````J(`````````#`````0````#0`````````(`````````!@`
++M```1`````P`````````````````````````````"*`````````"4````````
++M`````````````0```````````````0````(`````````````````````````
++M````!T`````````!L````!$````*``````````@`````````&`````D````#
++M``````````````````````````````CP`````````(X`````````````````
++M```!`````````````````````````````````````````````````P```0``
++M`````````````````````````P```P```````````````````````````P``
++M!````````````````````````````P``"```````````````````````````
++M`P``"@```````````````````````````P``!@``````````````````````
++M`````P``"P```````````````````````````P``#0``````````````````
++M`````````P``!0`````````````````````````!$```````````````````
++M```````````;$``````````````````````````````V$@```0````````!(
++M`````````"`````_$`````````````````````````````!7$@```0``````
++M``!6`````````!````!I$`````````````````````````````!Y(@```0``
++M``````!(`````````"````"'(@```0````````!(`````````"``7U]L:6)C
++M7V5N86)L95]A
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
+
+;; Fix '`catch syscall' doesn't work for parent after `fork' is called'
+;; (Philippe Waroquiers, RH BZ 1149205).
+;;=fedoratest
+
+URL:
+Message-ID: <1368136582.30058.7.camel@soleil>
+
+ From: Philippe Waroquiers
+ To: gdb-patches at sourceware dot org
+ Subject: RFA: fix gdb_assert caused by 'catch signal ...' and fork
+ Date: Thu, 09 May 2013 23:56:22 +0200
+
+ The attached patch fixes a gdb_assert caused by the combination of catch
+ signal and fork:
+ break-catch-sig.c:152: internal-error: signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter] > 0' failed.
+
+ The problem is that the signal_catch_counts is decremented by detach_breakpoints.
+ The fix consists in not detaching breakpoint locations of type bp_loc_other.
+ The patch introduces a new test.
+
+Comments by Sergio Durigan Junior:
+
+ I addded a specific testcase for this patch, which tests exactly the
+ issue that the customer is facing. This patch does not solve the
+ whole problem of catching a syscall and forking (for more details,
+ see ,
+ specifically comment #3), but it solves the issue reported by the
+ customer.
+
+ I also removed the original testcase of this patch, because it
+ relied on "catch signal", which is a command that is not implemented
+ in this version of GDB.
+
+commit bd9673a4ded96ea5c108601501c8e59003ea1be6
+Author: Philippe Waroquiers
+Date: Tue May 21 18:47:05 2013 +0000
+
+ Fix internal error caused by interaction between catch signal and fork
+
+diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
+@@ -0,0 +1,11 @@
++#include
++#include
++
++int
++main (int argc, char **argv)
++{
++ if (fork () == 0)
++ sleep (1);
++ chdir (".");
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
+@@ -0,0 +1,58 @@
++# Copyright 2015 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 .
++
++if { [is_remote target] || ![isnative] } then {
++ continue
++}
++
++set testfile "gdb-rhbz1149205-catch-syscall-fork"
++set srcfile ${testfile}.c
++set binfile [standard_output_file ${testfile}]
++
++# Until "catch syscall" is implemented on other targets...
++if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
++ continue
++}
++
++# This shall be updated whenever 'catch syscall' is implemented
++# on some architecture.
++#if { ![istarget "i\[34567\]86-*-linux*"]
++if { ![istarget "x86_64-*-linux*"] && ![istarget "i\[34567\]86-*-linux*"]
++ && ![istarget "powerpc-*-linux*"] && ![istarget "powerpc64-*-linux*"]
++ && ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] } {
++ continue
++}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++ untested ${testfile}.exp
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load $binfile
++
++if { ![runto_main] } {
++ return -1
++}
++
++gdb_test "catch syscall chdir" \
++ "Catchpoint $decimal \\\(syscall (.)?chdir(.)? \\\[$decimal\\\]\\\)" \
++ "catch syscall chdir"
++
++gdb_test "continue" \
++ "Continuing\.\r\n.*\r\nCatchpoint $decimal \\\(call to syscall .?chdir.?.*" \
++ "continue from catch syscall after fork"
diff --git a/gdb-rhbz1156192-recursive-dlopen-test.patch b/gdb-rhbz1156192-recursive-dlopen-test.patch
new file mode 100644
index 0000000..2ff58ed
--- /dev/null
+++ b/gdb-rhbz1156192-recursive-dlopen-test.patch
@@ -0,0 +1,365 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-rhbz1156192-recursive-dlopen-test.patch
+
+;; Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to
+;; crash.' (RH BZ 1156192).
+;;=fedoratest
+
+diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c
+@@ -0,0 +1,30 @@
++/* Testcase for recursive dlopen calls.
++
++ Copyright (C) 2014 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ 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 . */
++
++/* This test was copied from glibc's testcase called
++ and related files. */
++
++#include
++#include
++
++void
++bar (void)
++{
++ printf ("Called bar.\n");
++}
+diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c
+@@ -0,0 +1,30 @@
++/* Testcase for recursive dlopen calls.
++
++ Copyright (C) 2014 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ 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 . */
++
++/* This test was copied from glibc's testcase called
++ and related files. */
++
++#include
++#include
++
++void
++foo (void)
++{
++ printf ("Called foo.\n");
++}
+diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
+@@ -0,0 +1,125 @@
++/* Testcase for recursive dlopen calls.
++
++ Copyright (C) 2014 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ 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 . */
++
++/* This test was copied from glibc's testcase called
++ and related files. */
++
++#include
++#include
++#include
++#include
++
++#define DSO "gdb-rhbz1156192-recursive-dlopen-libfoo.so"
++#define FUNC "foo"
++
++#define DSO1 "gdb-rhbz1156192-recursive-dlopen-libbar.so"
++#define FUNC1 "bar"
++
++/* Prototype for my hook. */
++void *custom_malloc_hook (size_t, const void *);
++
++/* Pointer to old malloc hooks. */
++void *(*old_malloc_hook) (size_t, const void *);
++
++/* Call function func_name in DSO dso_name via dlopen. */
++void
++call_func (const char *dso_name, const char *func_name)
++{
++ int ret;
++ void *dso;
++ void (*func) (void);
++ char *err;
++
++ /* Open the DSO. */
++ dso = dlopen (dso_name, RTLD_NOW|RTLD_GLOBAL);
++ if (dso == NULL)
++ {
++ err = dlerror ();
++ fprintf (stderr, "%s\n", err);
++ exit (1);
++ }
++ /* Clear any errors. */
++ dlerror ();
++
++ /* Lookup func. */
++ *(void **) (&func) = dlsym (dso, func_name);
++ if (func == NULL)
++ {
++ err = dlerror ();
++ if (err != NULL)
++ {
++ fprintf (stderr, "%s\n", err);
++ exit (1);
++ }
++ }
++ /* Call func twice. */
++ (*func) ();
++
++ /* Close the library and look for errors too. */
++ ret = dlclose (dso);
++ if (ret != 0)
++ {
++ err = dlerror ();
++ fprintf (stderr, "%s\n", err);
++ exit (1);
++ }
++
++}
++
++/* Empty hook that does nothing. */
++void *
++custom_malloc_hook (size_t size, const void *caller)
++{
++ void *result;
++ /* Restore old hooks. */
++ __malloc_hook = old_malloc_hook;
++ /* First call a function in another library via dlopen. */
++ call_func (DSO1, FUNC1);
++ /* Called recursively. */
++ result = malloc (size);
++ /* Restore new hooks. */
++ old_malloc_hook = __malloc_hook;
++ __malloc_hook = custom_malloc_hook;
++ return result;
++}
++
++int
++main (void)
++{
++
++ /* Save old hook. */
++ old_malloc_hook = __malloc_hook;
++ /* Install new hook. */
++ __malloc_hook = custom_malloc_hook;
++
++ /* Attempt to dlopen a shared library. This dlopen will
++ trigger an access to the ld.so.cache, and that in turn
++ will require a malloc to duplicate data in the cache.
++ The malloc will call our malloc hook which calls dlopen
++ recursively, and upon return of this dlopen the non-ref
++ counted ld.so.cache mapping will be unmapped. We will
++ return to the original dlopen and crash trying to access
++ dlopened data. */
++ call_func (DSO, FUNC);
++
++ /* Restore old hook. */
++ __malloc_hook = old_malloc_hook;
++
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
+@@ -0,0 +1,151 @@
++# Copyright 2014 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 .
++
++require allow_shlib_tests
++require !use_gdb_stub
++
++# Library foo
++set libname1 "gdb-rhbz1156192-recursive-dlopen-libfoo"
++set srcfile_lib1 ${srcdir}/${subdir}/${libname1}.c
++set binfile_lib1 [standard_output_file ${libname1}.so]
++# Library bar
++set libname2 "gdb-rhbz1156192-recursive-dlopen-libbar"
++set srcfile_lib2 ${srcdir}/${subdir}/${libname2}.c
++set binfile_lib2 [standard_output_file ${libname2}.so]
++
++set testfile "gdb-rhbz1156192-recursive-dlopen"
++set srcfile ${testfile}.c
++set executable ${testfile}
++set binfile [standard_output_file ${executable}]
++
++if { [gdb_compile_shlib ${srcfile_lib1} ${binfile_lib1} \
++ { debug "additional_flags=-fPIC" }] != "" } {
++ untested "Could not compile ${binfile_lib1}"
++ return -1
++}
++
++if { [gdb_compile_shlib ${srcfile_lib2} ${binfile_lib2} \
++ { debug "additional_flags=-fPIC" }] != "" } {
++ untested "Could not compile ${binfile_lib2}"
++ return -1
++}
++
++if { [prepare_for_testing ${testfile}.exp ${executable} ${srcfile} \
++ [ list debug shlib_load "additional_flags=-Wno-deprecated-declarations" ]] } {
++ untested "Could not compile ${executable}"
++ return -1
++}
++
++set supported 0
++gdb_test_multiple "run" "initial trial run" {
++ -re "warning: Corrupted shared library list: \[^\r\n\]+\r\n" {
++ exp_continue
++ }
++ -re -wrap "exited normally.*" {
++ set supported 1
++ pass $gdb_test_name
++ }
++ -re -wrap "exited with code.*" {
++ untested "failed at $gdb_test_name"
++ }
++}
++
++if { $supported == 0 } {
++ return -1
++}
++
++proc do_test { has_libfoo has_libbar } {
++ global hex binfile_lib2 binfile_lib1 gdb_prompt
++ set libbar_match "[string_to_regexp $binfile_lib2]"
++ set libfoo_match "[string_to_regexp $binfile_lib1]"
++
++ gdb_test_multiple "info shared" "info shared" {
++ -re ".*$libfoo_match\r\n.*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
++ if { $has_libfoo && $has_libbar } {
++ pass "matched libfoo and libbar"
++ } else {
++ fail "matched libfoo and libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
++ }
++ }
++ -re ".*$libfoo_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
++ if { $has_libfoo && !$has_libbar } {
++ pass "matched libfoo"
++ } else {
++ fail "matched libfoo (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
++ }
++ }
++ -re ".*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
++ if { $has_libbar && !$has_libfoo } {
++ pass "matched libbar"
++ } else {
++ fail "matched libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
++ }
++ }
++ "\r\n${gdb_prompt} $" {
++ if { !$has_libfoo && !$has_libbar } {
++ pass "did not match libfoo nor libbar"
++ } else {
++ fail "did not match libfoo nor libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
++ }
++ }
++ }
++}
++
++proc test_stop_on_solib_events { } {
++ set pass 0
++ # This variable holds the information about whether libfoo and
++ # libbar (respectively) are expected in the "info shared" output.
++ set solib_event_order { { 0 0 } { 0 0 } { 0 0 } { 0 1 } \
++ { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
++ { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
++ { 0 1 } { 0 0 } { 0 0 1 } { 1 1 } \
++ { 1 1 } { 1 0 } { 1 0 } { 1 1 } \
++ { 1 1 } { 1 0 1 } { 1 0 } { 1 0 } }
++
++ with_test_prefix "stop-on-solib-events" {
++ gdb_test_no_output "set stop-on-solib-events 1" "setting stop-on-solib-events"
++
++ gdb_run_cmd
++ gdb_test "" "Wait for first prompt"
++ foreach l $solib_event_order {
++ incr pass
++ with_test_prefix "pass #$pass" {
++ set should_be_corrupted [expr 0+0[lindex $l 2]]
++ do_test [lindex $l 0] [lindex $l 1]
++
++ set corrupted 0
++ gdb_test_multiple "continue" "" {
++ -re "\r\nwarning: Corrupted shared library list:\[^\r\n\]+(?=\r\n)" {
++ set corrupted 1
++ }
++ -re -wrap "\r\nStopped due to shared library event.*" {
++ pass $gdb_test_name
++ }
++ }
++
++ gdb_assert {$corrupted == $should_be_corrupted} \
++ "corrupted=$corrupted but should_be_corrupted=$should_be_corrupted"
++ }
++ }
++
++ # In the last pass we do not expect to see libfoo or libbar.
++ incr pass
++ with_test_prefix "pass #$pass" {
++ do_test 0 0
++ }
++ }
++}
++
++test_stop_on_solib_events
diff --git a/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch b/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
new file mode 100644
index 0000000..a0eb440
--- /dev/null
+++ b/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
@@ -0,0 +1,104 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
+
+;; [aarch64] Fix hardware watchpoints (RH BZ 1261564).
+;;=fedoratest
+
+diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c
+@@ -0,0 +1,33 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2016 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 . */
++
++__attribute__((aligned(16))) struct
++{
++ int var0, var4, var8;
++} aligned;
++
++int
++main (void)
++{
++ aligned.var0 = 1;
++ aligned.var4 = 2;
++ aligned.var8 = 3;
++
++ aligned.var4 = aligned.var0;
++
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
+@@ -0,0 +1,53 @@
++# Copyright (C) 2016 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 .
++
++if { [prepare_for_testing rhbz1261564-aarch64-watchpoint.exp "rhbz1261564-aarch64-watchpoint"] } {
++ return -1
++}
++
++if { ! [ runto main ] } then { return 0 }
++
++set test "rwatch aligned.var4"
++if [istarget "s390*-*-*"] {
++ gdb_test $test {Target does not support this type of hardware watchpoint\.}
++ untested "s390* does not support hw read watchpoint"
++ return
++}
++gdb_test $test "Hardware read watchpoint \[0-9\]+: aligned.var4"
++
++proc checkvar { address } {
++ global gdb_prompt
++
++ set test "p &aligned.var$address"
++ gdb_test_multiple $test $test {
++ -re " = \\(int \\*\\) 0x\[0-9a-f\]+$address \r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "\r\n$gdb_prompt $" {
++ untested "$test (unexpected ELF layout)"
++ return 0
++ }
++ }
++ return 1
++}
++if ![checkvar "0"] { return }
++if ![checkvar "4"] { return }
++if ![checkvar "8"] { return }
++
++# Assumes: PPC_PTRACE_GETHWDBGINFO::data_bp_alignment == 8
++# 'lwz' does read only 4 bytes but the hw watchpoint is 8 bytes wide.
++setup_xfail "powerpc*-*-*"
++
++gdb_continue_to_end
diff --git a/gdb-rhbz2354997-gstack-drop-readnever.patch b/gdb-rhbz2354997-gstack-drop-readnever.patch
new file mode 100644
index 0000000..70b5b9e
--- /dev/null
+++ b/gdb-rhbz2354997-gstack-drop-readnever.patch
@@ -0,0 +1,74 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Keith Seitz
+Date: Thu, 27 Mar 2025 11:36:19 -0700
+Subject: gdb-rhbz2354997-gstack-drop-readnever.patch
+
+;; Backport "Fix gstack issues" from upstream
+;; commit 43ac3df61492b94bf13c11bd98c9f9541e92d3b0.
+;; (Keith Seitz, RH BZ 2354997)
+
+With commit fb2ded33c1e519659743047ed7817166545b6d91, I added
+Fedora's gstack script to gdb. Some issues have arisen since
+then, and this patch addresses those issues:
+
+. As Sam James recently noted[1], PKGVERSION and VERSION
+ need to be quoted.
+. A Fedora user reported the misuse of --readnever, which
+ causes gstack to omit filename and line number information in the
+ backtrace[Red Hat BZ 2354997].
+
+[1] https://inbox.sourceware.org/gdb-patches/d19d6bc17e0a160ce27fc572079f11a587c0e168.1742424869.git.sam@gentoo.org/
+Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2354997
+
+diff --git a/gdb/gstack-1.in b/gdb/gstack-1.in
+--- a/gdb/gstack-1.in
++++ b/gdb/gstack-1.in
+@@ -1,6 +1,6 @@
+ #!/usr/bin/env bash
+
+-# Copyright (C) 2024 Free Software Foundation, Inc.
++# Copyright (C) 2024-2025 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
+@@ -22,8 +22,8 @@
+ GDB=${GDB:-$(command -v gdb)}
+ GDBARGS=${GDBARGS:-}
+ AWK=${AWK:-}
+-PKGVERSION=@PKGVERSION@
+-VERSION=@VERSION@
++PKGVERSION="@PKGVERSION@"
++VERSION="@VERSION@"
+
+ # Find an appropriate awk interpreter if one was not specified
+ # via the environment.
+@@ -132,7 +132,7 @@ EOF
+ )
+
+ # Run GDB and remove some unwanted noise.
+-"$GDB" --quiet -nx --readnever $GDBARGS <
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-simultaneous-step-resume-breakpoint-test.patch
+
+;; New test for step-resume breakpoint placed in multiple threads at once.
+;;=fedoratest
+
+diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c
+@@ -0,0 +1,79 @@
++/* Copyright 2009 Free Software Foundation, Inc.
++
++ Written by Fred Fish of Cygnus Support
++ Contributed by Cygnus Support
++
++ This file is part of GDB.
++
++ 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 . */
++
++/* Test multiple threads stepping into a .debug_line-less function with
++ a breakpoint placed on its return-to-caller point. */
++
++#include
++#include
++#include
++#include
++#include
++
++#define THREADS 3
++
++static void *
++func (void *unused)
++{
++ int i;
++
++ errno = 0;
++ i = 0xdeadf00d;
++ i = sleep (THREADS); /* sleep-call */
++ if (errno != 0) /* sleep-after */
++ perror ("sleep");
++
++ /* The GDB bug with forgotten step-resume breakpoint could leave stale
++ breakpoint on the I assignment making it a nop. */
++ if (i == 0xdeadf00d)
++ assert (0);
++
++ assert (i == 0);
++
++ pthread_exit (NULL);
++}
++
++int
++main (void)
++{
++ pthread_t threads[THREADS];
++ int threadi;
++
++ for (threadi = 0; threadi < THREADS; threadi++)
++ {
++ int i;
++
++ i = pthread_create (&threads[threadi], NULL, func, NULL);
++ assert (i == 0);
++
++ i = sleep (1);
++ assert (i == 0);
++ }
++
++ for (threadi = 0; threadi < THREADS; threadi++)
++ {
++ int i;
++
++ i = pthread_join (threads[threadi], NULL);
++ assert (i == 0);
++ }
++
++ return 0; /* final-exit */
++}
+diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp
+@@ -0,0 +1,65 @@
++# Copyright (C) 2009 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 . */
++
++# Test multiple threads stepping into a .debug_line-less function with
++# a breakpoint placed on its return-to-caller point.
++
++set testfile simultaneous-step-resume-breakpoint
++set srcfile ${testfile}.c
++set binfile [standard_output_file ${testfile}]
++
++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++
++# Ensure we have no debuginfo for the `sleep' call itself (=for libc).
++gdb_test "set debug-file-directory /DoesNotExist"
++
++gdb_load ${binfile}
++if ![runto_main] {
++ return -1
++}
++
++# Red Hat vendor patch does set it to "step" by default.
++gdb_test "set scheduler-locking off"
++
++gdb_breakpoint [gdb_get_line_number "final-exit"]
++
++gdb_breakpoint [gdb_get_line_number "sleep-call"]
++gdb_continue_to_breakpoint "sleep-call"
++
++gdb_test "step" "sleep-call.*" "step thread 1"
++gdb_test "step" "sleep-call.*" "step thread 2"
++gdb_test "step" "sleep-after.*" "step thread 3"
++
++set test "first continue"
++gdb_test_multiple "continue" $test {
++ -re "final-exit.*$gdb_prompt $" {
++ # gdb-7.0.
++ pass $test
++ return
++ }
++ -re "sleep-after.*$gdb_prompt $" {
++ # Fedora/RHEL branch.
++ pass $test
++ }
++}
++
++gdb_test "continue" "sleep-after.*" "second continue"
++gdb_test "continue" "final-exit.*" "third continue"
diff --git a/gdb-test-bt-cfi-without-die.patch b/gdb-test-bt-cfi-without-die.patch
new file mode 100644
index 0000000..6167c14
--- /dev/null
+++ b/gdb-test-bt-cfi-without-die.patch
@@ -0,0 +1,214 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-test-bt-cfi-without-die.patch
+
+;; [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604).
+;;=fedoratest
+
+http://sourceware.org/ml/archer/2010-q3/msg00028.html
+
+On Wed, 25 Feb 2009 00:14:29 +0100, Jan Kratochvil wrote:
+> commit 6a37c2b9962258ecf9299cc34a650e64a06acaa5
+>
+> There was a regression on gdb.base/savedregs.exp.
+>
+> quick_addrmap/require_partial_symbols should be used even for the unwind debug
+> info checking as its load has been also delayed by this branch.
+[...]
+> --- a/gdb/dwarf2-frame.c
+> +++ b/gdb/dwarf2-frame.c
+[...]
+> @@ -1499,6 +1500,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc)
+> struct dwarf2_fde *fde;
+> CORE_ADDR offset;
+>
+> + if (objfile->quick_addrmap)
+> + {
+> + if (!addrmap_find (objfile->quick_addrmap, *pc))
+> + continue;
+> + }
+> + /* FIXME: Read-in only .debug_frame/.eh_frame without .debug_info? */
+> + require_partial_symbols (objfile);
+> +
+
+but this has caused a different regression (as discussed in the confcall).
+
+QUICK_ADDRMAP is built only from .debug_aranges. But we can have existing
+built .debug_aranges for CUs in OBJFILE but still some CUs do not need to have
+DWARF at all while they can feature CFIs (.eh_frame or .debug_frame).
+It has been described by Daniel Jacobowitz at:
+ Re: [2/4] RFC: check psymtabs_addrmap before reading FDEs
+ http://sourceware.org/ml/gdb-patches/2010-07/msg00012.html
+
+Sorry for this regression by me (in that fix of a different regression).
+
+Fixed it the "slow way" as this branch is now obsoleted by .gdb-index.
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
+
+Checked-in.
+
+Thanks,
+Jan
+
+eb8df8566acc1ed963e3e9b77c13b9c2c3db03fb
+
+Test CFI is parsed even for range (function) not described by any DIE.
+
+https://bugzilla.redhat.com/show_bug.cgi?id=614028
+
+gdb/
+ * dwarf2-frame.c (dwarf2_frame_find_fde): Remove the
+ OBJFILE->QUICK_ADDRMAP check. New comment why.
+
+gdb/testsuite/
+ * gdb.base/cfi-without-die.exp, gdb.base/cfi-without-die-main.c,
+ gdb.base/cfi-without-die-caller.c: New files.
+
+diff --git a/gdb/testsuite/gdb.base/cfi-without-die-caller.c b/gdb/testsuite/gdb.base/cfi-without-die-caller.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/cfi-without-die-caller.c
+@@ -0,0 +1,28 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2005, 2007, 2008, 2009, 2010 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 . */
++
++typedef int (*callback_t) (void);
++
++int
++caller (callback_t callback)
++{
++ /* Ensure some frame content to push away the return address. */
++ volatile const long one = 1;
++
++ /* Modify the return value to prevent any tail-call optimization. */
++ return (*callback) () - one;
++}
+diff --git a/gdb/testsuite/gdb.base/cfi-without-die-main.c b/gdb/testsuite/gdb.base/cfi-without-die-main.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/cfi-without-die-main.c
+@@ -0,0 +1,32 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2005, 2007, 2008, 2009, 2010 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 . */
++
++typedef int (*callback_t) (void);
++
++extern int caller (callback_t callback);
++
++int
++callback (void)
++{
++ return 1;
++}
++
++int
++main (void)
++{
++ return caller (callback);
++}
+diff --git a/gdb/testsuite/gdb.base/cfi-without-die.exp b/gdb/testsuite/gdb.base/cfi-without-die.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/cfi-without-die.exp
+@@ -0,0 +1,71 @@
++# Copyright 2010 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 .
++
++# Test CFI is parsed even for range (function) not described by any DIE.
++
++set testfile cfi-without-die
++set srcmainfile ${testfile}-main.c
++set srccallerfile ${testfile}-caller.c
++set executable ${testfile}
++set objmainfile [standard_output_file ${testfile}-main.o]
++set objcallerfile [standard_output_file ${testfile}-caller.o]
++set binfile [standard_output_file ${executable}]
++
++if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \
++ object [list {additional_flags=-fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables}]] != ""
++ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != ""
++ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } {
++ untested ${testfile}.exp
++ return -1
++}
++
++clean_restart $executable
++
++if ![runto callback] then {
++ fail "verify unwinding: Can't run to callback"
++ return 0
++}
++set test "verify unwinding breaks without CFI"
++gdb_test_multiple "bt" $test {
++ -re " in \[?\]\[?\] .*\r\n$gdb_prompt $" {
++ # It may backtrace through some random frames even to main().
++ pass $test
++ }
++ -re " in main .*\r\n$gdb_prompt $" {
++ fail $test
++ }
++ -re "\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \
++ object [list {additional_flags=-fomit-frame-pointer -funwind-tables -fasynchronous-unwind-tables}]] != ""
++ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != ""
++ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } {
++ untested ${testfile}.exp
++ return -1
++}
++
++clean_restart $executable
++
++if ![runto callback] then {
++ fail "test CFI without DIEs: Can't run to callback"
++ return 0
++}
++# #0 callback () at ...
++# #1 0x00000000004004e9 in caller ()
++# #2 0x00000000004004cd in main () at ...
++gdb_test "bt" "#0 +callback \[^\r\n\]+\r\n#1 \[^\r\n\]+ in caller \[^\r\n\]+\r\n#2 \[^\r\n\]+ in main \[^\r\n\]+" "verify unwindin works for CFI without DIEs"
diff --git a/gdb.spec b/gdb.spec
new file mode 100644
index 0000000..1d2d32c
--- /dev/null
+++ b/gdb.spec
@@ -0,0 +1,6337 @@
+# rpmbuild parameters:
+# --with testsuite: Run the testsuite (biarch if possible). Default is without.
+# --with buildisa: Use %%{?_isa} for BuildRequires
+# --with asan: gcc -fsanitize=address
+# --without python: No python support.
+# --with profile: gcc -fprofile-generate / -fprofile-use: Before better
+# workload gets run it decreases the general performance now.
+# --define 'scl somepkgname': Independent packages by scl-utils-build.
+# --define 'tests "TEST1 ... TESTN": Limit testing to specified tests.
+
+# Turn off the brp-python-bytecompile automagic
+%global _python_bytecompile_extra 0
+
+# Disable LTO until upstream fixes GDB's ODR woes.
+%define _lto_cflags %{nil}
+
+# GTS magic sauce. On GTS N (N >= 13), we always build using
+# the system compiler and elfutils.
+#
+# For testing, we use the GTS (N-1) compiler and the system valgrind/elfutils.
+
+%{?scl_package:%global scl gcc-toolset-15}
+%global scl_prefix gcc-toolset-15-
+%global scl_testing_prefix gcc-toolset-14-
+BuildRequires: scl-utils-build
+
+%{?scl:%scl_package gdb}
+%{!?scl:
+ %global pkg_name %{name}
+ %global _root_prefix %{_prefix}
+ %global _root_datadir %{_datadir}
+ %global _root_libdir %{_libdir}
+}
+
+# If we're on Fedora or RHEL 9+, we will build the gdb-minimal package.
+# Never build the -minimal package on SCLs, since it's unneeded there.
+%if 0%{?fedora} || (0%{?rhel} > 8 && 0%{!?scl:1})
+ %global _build_minimal 1
+%endif
+
+# Include support for Guile? This is enabled on RHEL 8 and
+# Fedora < 38.
+%if (0%{?fedora:1} && 0%{?fedora} < 38) || (0%{?rhel:1} && 0%{?rhel} == 8)
+ %define use_guile 1
+%endif
+
+Name: %{?scl_prefix}gdb
+
+# Freeze it when GDB gets branched
+%global snapsrc 20220501
+# See timestamp of source gnulib installed into gnulib/ .
+%global snapgnulib 20220501
+%global tarname gdb-%{version}
+Version: 16.2
+
+# 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: 1%{?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.
+# ftp://sourceware.org/pub/gdb/releases/FIXME{tarname}.tar.xz
+Source: ftp://sourceware.org/pub/gdb/releases/%{tarname}.tar.xz
+URL: https://gnu.org/software/gdb/
+
+# For our convenience
+%global gdb_src %{tarname}
+%global gdb_build build-%{_target_platform}
+%if 0%{?_build_minimal}
+ %global gdb_build_minimal %{gdb_build}-minimal
+%endif
+
+# error: Installed (but unpackaged) file(s) found: /usr/lib/debug/usr/bin/gdb-gdb.py
+# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/PBOJDOFMWTRV3ZOKNV5HN7IBX5EPHDHF/
+%undefine _debuginfo_subpackages
+
+# For DTS RHEL<=7 GDB it is better to use none than a Requires dependency.
+%if 0%{!?rhel:1}
+Recommends: dnf-command(debuginfo-install)
+%endif
+
+%if 0%{!?scl:1}
+Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages
+Requires: gdb-headless%{?_isa} = %{version}-%{release}
+
+%description
+GDB, the GNU debugger, allows you to debug programs written in C, C++,
+Fortran, Go, and other languages, by executing them in a controlled
+fashion and printing their data.
+
+If you want to use GDB for development purposes, you should install
+the 'gdb' package which will install 'gdb-headless' and possibly other
+useful packages too.
+
+%package headless
+
+# gdb-add-index also uses 'readelf' and 'objcopy', both of which are
+# in the binutils package. (BZ 2275274)
+Requires: binutils
+%endif
+# endif !scl
+
+Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages
+
+%ifarch %{arm} riscv64
+ %global have_inproctrace 0
+%else
+ %global have_inproctrace 1
+%endif
+
+# https://fedorahosted.org/fpc/ticket/43 https://fedorahosted.org/fpc/ticket/109
+Provides: bundled(libiberty) = %{snapsrc}
+Provides: bundled(gnulib) = %{snapgnulib}
+# The libraries in the top-level directory (libbfd, libopcodes,
+# libctf) are covered by the "bundled(binutils)" below. See ticket
+# #109, as mentioned above.
+Provides: bundled(binutils) = %{snapsrc}
+# https://fedorahosted.org/fpc/ticket/130
+Provides: bundled(md5-gcc) = %{snapsrc}
+
+# https://fedoraproject.org/wiki/Packaging:Guidelines#BuildRequires_and_.25.7B_isa.7D
+%if 0%{?_with_buildisa:1} || 0%{?_with_testsuite:1}
+ %global buildisa %{?_isa}
+%else
+ %global buildisa %{nil}
+%endif
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=1209492
+Recommends: default-yama-scope
+
+# rpm-suggestions.py needs to import rpm which is found in python3-rpm.
+Recommends: python3-rpm
+
+BuildRequires: gcc-c++
+
+# GDB patches have the format `gdb--bz-.patch'.
+# They should be created using patch level 1: diff -up ./gdb (or gdb-6.3/gdb).
+
+#=
+#push=Should be pushed upstream.
+#fedora=Should stay as a Fedora patch.
+#fedoratest=Keep it in Fedora only as a regression test safety.
+
+# Cleanup any leftover testsuite processes as it may stuck mock(1) builds.
+#=push+jan
+Source2: gdb-orphanripper.c
+
+# Man page for gstack(1).
+#=push+jan
+Source3: gdb-gstack.man
+
+# /etc/gdbinit (from Debian but with Fedora compliant location).
+#=fedora
+Source4: gdbinit
+
+# Include the auto-generated file containing the "Patch:" directives.
+# See README.local-patches for more details.
+Source9998: _gdb.spec.Patch.include
+Source9999: _gdb.spec.patch.include
+%include %{SOURCE9998}
+
+BuildRequires: readline-devel%{buildisa} >= 7.0
+BuildRequires: ncurses-devel%{buildisa} texinfo gettext flex bison
+BuildRequires: expat-devel%{buildisa}
+# gdb/minidebug.c uses the xz library to handle compressed debuginfo.
+BuildRequires: xz-devel%{buildisa}
+# dlopen() no longer makes rpm-libsFIXME{?_isa} (it's .so) a mandatory dependency.
+BuildRequires: rpm-devel%{buildisa}
+BuildRequires: zlib-devel%{buildisa} libselinux-devel%{buildisa}
+%if 0%{!?_without_python:1}
+ %global __python %{__python3}
+BuildRequires: python3-devel%{buildisa}
+%endif
+# gdb-doc in PDF, see: https://bugzilla.redhat.com/show_bug.cgi?id=919891#c10
+BuildRequires: texinfo-tex
+BuildRequires: texlive-collection-latexrecommended
+# Permit rebuilding *.[0-9] files even if they are distributed in gdb-*.tar:
+BuildRequires: /usr/bin/pod2man
+BuildRequires: libbabeltrace-devel%{buildisa}
+%if %{defined use_guile}
+ %if 0%{!?rhel:1}
+BuildRequires: guile22-devel%{buildisa}
+ %endif
+ # Guile is only supported prior to RHEL9, where it was called "guile".
+ %if 0%{?rhel:1} && 0%{?rhel} < 9
+BuildRequires: guile-devel%{buildisa}
+ %endif
+%endif
+
+# Add support for Intel Processor Trace on eligible architectures.
+%global have_libipt 0
+%ifarch %{ix86} x86_64
+%global have_libipt 1
+BuildRequires: libipt-devel%{buildisa}
+%endif
+
+# See https://bugzilla.redhat.com/show_bug.cgi?id=1593280
+# DTS RHEL-6 has mpfr-2 while GDB requires mpfr-3 on RHEL-7, RHEL-8, and
+# Fedora < 32, and mpfr-4 on Fedora 32+ and RHEL-9+.
+BuildRequires: mpfr-devel%{buildisa}
+BuildRequires: source-highlight-devel
+%if 0%{!?rhel:1}
+BuildRequires: xxhash-devel
+%endif
+
+# Include debuginfod support.
+BuildRequires: elfutils-debuginfod-client-devel
+
+# Workaround for missing boost-devel dependency (rhbz 1718480)
+BuildRequires: boost-devel
+
+%if 0%{?_with_testsuite:1}
+
+# Ensure the devel libraries are installed for both multilib arches.
+%global bits_local %{?_isa}
+%global bits_other %{?_isa}
+%ifarch ppc
+ %global bits_other (%{__isa_name}-64)
+%endif
+
+%ifarch ppc64 x86_64
+ %global bits_other (%{__isa_name}-32)
+%endif
+
+BuildRequires: sharutils dejagnu
+
+# Test supported SCL toolchain components.
+BuildRequires: %{?scl_testing_prefix}gcc %{?scl_testing_prefix}gcc-c++ %{?scl_testing_prefix}gcc-gfortran
+
+# Fedora supports Objective C.
+%if 0%{!?rhel:1}
+BuildRequires: gcc-objc
+%endif
+
+# We don't support gcc-gdb-plugin on RHEL anymore.
+%if 0%{!?rhel:1}
+BuildRequires: gcc-gdb-plugin%{?_isa}
+%endif
+
+BuildRequires: systemtap-sdt-devel
+BuildRequires: opencl-headers ocl-icd-devel%{bits_local} ocl-icd-devel%{bits_other}
+
+%if 0%{!?rhel:1}
+BuildRequires: gcc-go
+BuildRequires: libgo-devel%{bits_local} libgo-devel%{bits_other}
+%endif
+
+%if 0%{!?rhel:1}
+ %ifnarch s390x
+# Fedora s390x does not support fpc.
+BuildRequires: fpc
+ %endif
+%endif
+
+%if 0%{!?rhel:1}
+BuildRequires: gcc-gnat
+BuildRequires: libgnat%{bits_local} libgnat%{bits_other}
+%endif
+BuildRequires: glibc-devel%{bits_local} glibc-devel%{bits_other}
+BuildRequires: libgcc%{bits_local} libgcc%{bits_other}
+BuildRequires: libgfortran%{bits_local} libgfortran%{bits_other}
+# libstdc++-devel of matching bits is required only for g++ -static.
+BuildRequires: libstdc++%{bits_local} libstdc++%{bits_other}
+%ifarch %{ix86} x86_64
+BuildRequires: libquadmath%{bits_local} libquadmath%{bits_other}
+%endif
+# multilib glibc-static is open Bug 488472:
+%if 0%{?rhel:1}
+BuildRequires: glibc-static%{bits_other}
+%endif
+BuildRequires: valgrind%{bits_local} valgrind%{bits_other}
+BuildRequires: xz
+BuildRequires: rust
+BuildRequires: elfutils-debuginfod
+%endif
+# endif _with_testsuite
+BuildRequires: make gmp-devel
+
+%{?scl:Requires:%scl_runtime}
+
+# FIXME: The text needs to be duplicated to prevent 2 empty heading lines.
+%if 0%{!?scl:1}
+%description headless
+GDB, the GNU debugger, allows you to debug programs written in C, C++,
+Java, and other languages, by executing them in a controlled fashion
+and printing their data.
+%else
+%description
+GDB, the GNU debugger, allows you to debug programs written in C, C++,
+Java, and other languages, by executing them in a controlled fashion
+and printing their data.
+%endif
+
+%if 0%{?_build_minimal}
+%package minimal
+Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages (minimal version)
+# gdb-add-index is shared with gdb-headless and it must be from same version
+Conflicts: %{name}-headless < %{version}-%{release}
+Conflicts: %{name}-headless > %{version}-%{release}
+
+%description minimal
+GDB, the GNU debugger, allows you to debug programs written in C, C++,
+Fortran, Go, and other languages, by executing them in a controlled
+fashion and printing their data.
+
+This package provides a minimal version of GDB, tailored to be used by
+the Fedora buildroot. It should probably not be used by end users.
+%endif
+# endif _build_minimal
+
+%package gdbserver
+Summary: A standalone server for GDB (the GNU source-level debugger)
+
+%description gdbserver
+GDB, the GNU debugger, allows you to debug programs written in C, C++,
+Fortran, Go, and other languages, by executing them in a controlled
+fashion and printing their data.
+
+This package provides a program that allows you to run GDB on a different
+machine than the one which is running the program being debugged.
+
+%package doc
+Summary: Documentation for GDB (the GNU source-level debugger)
+License: GFDL
+BuildArch: noarch
+%if 0%{?scl:1}
+# As of F-28, packages won't need to call /sbin/install-info by hand
+# anymore. We make an exception for DTS here.
+# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/MP2QVJZBOJZEOQO2G7UB2HLXKXYPF2G5/
+Requires(post): /sbin/install-info
+Requires(preun): /sbin/install-info
+%endif
+
+%description doc
+GDB, the GNU debugger, allows you to debug programs written in C, C++,
+Java, and other languages, by executing them in a controlled fashion
+and printing their data.
+
+This package provides INFO, HTML and PDF user manual for GDB.
+
+%prep
+%setup -q -n %{gdb_src}
+
+# Files have `# ' statements breaking VPATH / find-debuginfo.sh .
+(cd gdb;rm -fv $(perl -pe 's/\\\n/ /' gdb/version.in << _FOO
+%{?version_prefix:%version_prefix }%{version}-%{release}
+_FOO
+
+# Remove the info and other generated files added by the FSF release
+# process.
+rm -f libdecnumber/gstdint.h
+rm -f bfd/doc/*.info
+rm -f bfd/doc/*.info-*
+rm -f gdb/doc/*.info
+rm -f gdb/doc/*.info-*
+
+mv -f readline/readline/doc readline-doc
+rm -rf readline/readline/*
+mv -f readline-doc readline/readline/doc
+
+rm -rf zlib texinfo
+
+%build
+
+# A set of common GDB configure flags, which are used for both minimal
+# and non-minimal compilations.
+COMMON_GDB_CONFIGURE_FLAGS="\
+ --prefix=%{_prefix} \
+ --libdir=%{_libdir} \
+ --sysconfdir=%{_sysconfdir} \
+ --mandir=%{_mandir} \
+ --infodir=%{_infodir} \
+ --with-gdb-datadir=%{_datadir}/gdb \
+ --enable-gdb-build-warnings=,-Wno-unused,-Wno-deprecated-declarations,-Wno-unused-function,-Wno-stringop-overflow\
+%ifarch %{ix86}
+,-Wno-format-overflow\
+%endif
+ --enable-build-with-cxx \
+%ifnarch %{ix86} alpha ppc s390 s390x x86_64 ppc64 ppc64le %{arm} aarch64 riscv64
+ --disable-werror \
+%else
+ --enable-werror \
+%endif
+ --with-separate-debug-dir=/usr/lib/debug \
+ --disable-sim \
+ --disable-rpath \
+ --without-stage1-ldflags \
+ --disable-libmcheck \
+ --with-system-readline \
+ --without-libunwind \
+ --enable-64-bit-bfd \
+ --with-system-zlib \
+ --with-lzma \
+ --with-debuginfod \
+%if 0%{?rhel:1}
+ --disable-libctf
+%endif
+"
+
+# Identify the build directory with the version of gdb as well as the
+# architecture, to allow for mutliple versions to be installed and
+# built.
+# Initially we're in the GDB_SRC directory.
+
+for fprofile in %{?_with_profile:-fprofile} ""
+do
+
+# We will first build the minimal version of GDB.
+%if 0%{?_build_minimal}
+mkdir %{gdb_build_minimal}$fprofile
+cd %{gdb_build_minimal}$fprofile
+
+# The configure flags we will use when building gdb-minimal.
+GDB_MINIMAL_CONFIGURE_FLAGS="\
+ --without-babeltrace \
+ --without-expat \
+ --disable-tui \
+ --without-python \
+ --without-guile \
+ --disable-inprocess-agent \
+ --without-intel-pt \
+ --disable-unit-tests \
+ --disable-source-highlight"
+
+# Populate CFLAGS, LDFLAGS, CC, CXX, etc.
+%set_build_flags
+CFLAGS="$CFLAGS %{?_with_asan:-fsanitize=address}"
+LDFLAGS="$LDFLAGS %{?_with_asan:-fsanitize=address}"
+CXXFLAGS="$CXXFLAGS %{?_with_asan:-fsanitize=address}"
+
+# --htmldir and --pdfdir are not used as they are used from GDB_BUILD.
+../configure \
+ ${COMMON_GDB_CONFIGURE_FLAGS} \
+ ${GDB_MINIMAL_CONFIGURE_FLAGS} \
+%if 0%{?pkgversion_configure_flag:1}
+ "%{pkgversion_configure_flag}" \
+%endif
+ --with-auto-load-dir='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}' \
+ --with-auto-load-safe-path='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}' \
+ --enable-targets=s390-linux-gnu,powerpc-linux-gnu,arm-linux-gnu,aarch64-linux-gnu,riscv64-linux-gnu,x86_64-redhat-linux-gnu \
+ %{_target_platform}
+
+# Prepare gdb/config.h first.
+%make_build CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" V=1 maybe-configure-gdb
+perl -i.relocatable -pe 's/^(D\[".*_RELOCATABLE"\]=" )1(")$/${1}0$2/' gdb/config.status
+
+%make_build CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" V=1
+
+cd ..
+%endif
+# endif _build_minimal
+
+# Now we build the full GDB.
+mkdir %{gdb_build}$fprofile
+cd %{gdb_build}$fprofile
+
+export CFLAGS="$RPM_OPT_FLAGS %{?_with_asan:-fsanitize=address} -DDNF_DEBUGINFO_INSTALL"
+export LDFLAGS="%{?__global_ldflags} %{?_with_asan:-fsanitize=address}"
+export CXXFLAGS="$CFLAGS"
+
+# The configure flags we will use when building the full GDB.
+GDB_FULL_CONFIGURE_FLAGS="\
+ --with-system-gdbinit=%{_sysconfdir}/gdbinit \
+ --with-babeltrace \
+ --with-expat \
+$(: ppc64 host build crashes on ppc variant of libexpat.so ) \
+ --without-libexpat-prefix \
+ --enable-tui \
+%if 0%{!?_without_python:1}
+ --with-python=%{__python} \
+%else
+ --without-python \
+%endif
+%if %{defined use_guile}
+ --with-guile \
+%else
+ --without-guile \
+%endif
+%if %{have_inproctrace}
+ --enable-inprocess-agent \
+%else
+ --disable-inprocess-agent \
+%endif
+%if %{have_libipt}
+ --with-intel-pt \
+%else
+ --without-intel-pt \
+%endif
+%if 0%{!?rhel:1}
+ --with-xxhash \
+%endif
+ --enable-unit-tests"
+
+# --htmldir and --pdfdir are not used as they are used from GDB_BUILD.
+../configure \
+ ${COMMON_GDB_CONFIGURE_FLAGS} \
+ ${GDB_FULL_CONFIGURE_FLAGS} \
+%if 0%{?pkgversion_configure_flag:1}
+ "%{pkgversion_configure_flag}" \
+%endif
+ --with-auto-load-dir='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}' \
+ --with-auto-load-safe-path='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}' \
+ --enable-targets=s390-linux-gnu,powerpc-linux-gnu,arm-linux-gnu,aarch64-linux-gnu,riscv64-linux-gnu,x86_64-redhat-linux-gnu \
+ %{_target_platform}
+
+if [ -z "%{!?_with_profile:no}" ]
+then
+ # Run all the configure tests being incompatible with $FPROFILE_CFLAGS.
+ %make_build configure-host configure-target
+ %make_build clean
+
+ # Workaround -fprofile-use:
+ # linux-x86-low.c:2225: Error: symbol `start_i386_goto' is already defined
+ %make_build -C gdb/gdbserver linux-x86-low.o
+fi
+
+# Global CFLAGS would fail on:
+# conftest.c:1:1: error: coverage mismatch for function 'main' while reading counter 'arcs'
+if [ "$fprofile" = "-fprofile" ]
+then
+ FPROFILE_CFLAGS='-fprofile-generate'
+elif [ -z "%{!?_with_profile:no}" ]
+then
+ FPROFILE_CFLAGS='-fprofile-use'
+ # We cannot use -fprofile-dir as the bare filenames clash.
+ (cd ../${builddir}-fprofile;
+ # It was 333 on x86_64.
+ test $(find -name "*.gcda"|wc -l) -gt 300
+ find -name "*.gcda" | while read -r i
+ do
+ ln $i ../${builddir}/$i
+ done
+ )
+else
+ FPROFILE_CFLAGS=""
+fi
+
+# Prepare gdb/config.h first.
+%make_build CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" V=1 maybe-configure-gdb
+perl -i.relocatable -pe 's/^(D\[".*_RELOCATABLE"\]=" )1(")$/${1}0$2/' gdb/config.status
+
+%make_build CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" V=1
+
+! grep '_RELOCATABLE.*1' gdb/config.h
+
+if [ "$fprofile" = "-fprofile" ]
+then
+ cd gdb
+ cp -p gdb gdb-withindex
+ PATH="$PWD:$PATH" sh ../../gdb/gdb-add-index $PWD/gdb-withindex
+ ./gdb -nx -ex q ./gdb-withindex
+ ./gdb -nx -readnow -ex q ./gdb-withindex
+ cd ..
+fi
+
+cd ..
+
+done # fprofile
+
+cd %{gdb_build}
+
+%make_build \
+ -C gdb/doc {gdb,annotate}{.info,/index.html,.pdf} MAKEHTMLFLAGS=--no-split MAKEINFOFLAGS=--no-split V=1
+
+# Copy the /gdb/NEWS file to the directory above it.
+cp $RPM_BUILD_DIR/%{gdb_src}/gdb/NEWS $RPM_BUILD_DIR/%{gdb_src}
+
+%check
+# Initially we're in the GDB_SRC directory.
+cd %{gdb_build}
+
+# We always run the unittests.
+(cd gdb; make run GDBFLAGS='-batch -ex "maintenance selftest"')
+
+%if 0%{!?_with_testsuite:1}
+echo ====================TESTSUITE DISABLED=========================
+%else
+echo ====================TESTING=========================
+cd gdb
+gcc -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2
+# Need to use a single --ignore option, second use overrides first.
+# No `%{?_smp_mflags}' here as it may race.
+# WARNING: can't generate a core file - core tests suppressed - check ulimit
+# "readline-overflow.exp" - Testcase is broken, functionality is OK.
+(
+ # ULIMIT required for `gdb.base/auxv.exp'.
+ ulimit -H -c
+ ulimit -c unlimited || :
+
+ # Setup $CHECK as `check//unix/' or `check//unix/-m64' for explicit bitsize.
+ # Never use two different bitsizes as it fails on ppc64.
+ echo 'int main (void) { return 0; }' >biarch.c
+ CHECK=""
+ for BI in -m64 -m32 -m31 ""
+ do
+ # Do not use size-less options if any of the sizes works.
+ # On ia64 there is no -m64 flag while we must not leave a bare `check' here
+ # as it would switch over some testing scripts to the backward compatibility
+ # mode: when `make check' was executed from inside the testsuite/ directory.
+ if [ -z "$BI" -a -n "$CHECK" ];then
+ continue
+ fi
+ # Do not use $RPM_OPT_FLAGS as the other non-size options will not be used
+ # in the real run of the testsuite.
+ if ! gcc $BI -o biarch biarch.c
+ then
+ continue
+ fi
+ CHECK="$CHECK check//unix/$BI check//native-gdbserver/$BI check//native-extended-gdbserver/$BI"
+ done
+ # Do not try -m64 inferiors for -m32 GDB as it cannot handle inferiors larger
+ # than itself.
+ # s390 -m31 still uses the standard ELF32 binary format.
+ gcc $RPM_OPT_FLAGS -o biarch biarch.c
+ RPM_SIZE="$(file ./biarch|sed -n 's/^.*: ELF \(32\|64\)-bit .*$/\1/p')"
+ if [ "$RPM_SIZE" != "64" ]
+ then
+ CHECK="$(echo " $CHECK "|sed 's#check//unix/-m64 check//native-gdbserver/-m64 check//native-extended-gdbserver/-m64# #')"
+ fi
+
+ # Disable some problematic testcases.
+ # RUNTESTFLAGS='--ignore ...' is not used below as it gets separated by the
+ # `check//...' target spawn and too much escaping there would be dense.
+ for test in \
+ gdb.base/readline-overflow.exp \
+ gdb.base/bigcore.exp \
+%if 0%{?rhel} < 7
+ gdb.base/gnu-debugdata.exp \
+ gdb.base/access-mem-running.exp \
+ gdb.threads/access-mem-running-thread-exit.exp \
+%endif
+ ; do
+ mv -f ../../gdb/testsuite/$test ../gdb/testsuite/$test-DISABLED || :
+ done
+
+ # Run all the scheduled testsuite runs also in the PIE mode.
+ # See also: gdb-runtest-pie-override.exp
+ ###CHECK="$(echo $CHECK|sed 's#check//unix/[^ ]*#& &/-fPIC/-pie#g')"
+
+TESTS=""
+%if 0%{?tests:1}
+ for test in %{tests}; do
+ TESTS="${TESTS:+$TESTS }$test"
+ done
+%endif
+ ./orphanripper make %{?_smp_mflags} -k $CHECK TESTS="$TESTS" || :
+)
+for t in sum log
+do
+ for file in testsuite*/gdb.$t
+ do
+ suffix="${file#testsuite}"
+ suffix="${suffix%/gdb.$t}"
+ ln $file gdb-%{_target_platform}$suffix.$t || :
+ done
+done
+# `tar | bzip2 | uuencode' may have some piping problems in Brew.
+tar cjf gdb-%{_target_platform}.tar.bz2 gdb-%{_target_platform}*.{sum,log}
+uuencode gdb-%{_target_platform}.tar.bz2 gdb-%{_target_platform}.tar.bz2
+cd ../..
+echo ====================TESTING END=====================
+%endif
+# endif _testsuite
+
+%install
+# Initially we're in the GDB_SRC directory.
+%if 0%{?_build_minimal}
+cd %{gdb_build_minimal}
+rm -rf $RPM_BUILD_ROOT
+
+%make_install %{?_smp_mflags}
+
+# Delete everything except the 'gdb' binary, and then rename it to
+# 'gdb.minimal'.
+rm -rfv $RPM_BUILD_ROOT%{_prefix}/{include,lib*,share}
+rm -fv $RPM_BUILD_ROOT%{_bindir}/{gcore,gdbserver,gstack,gdb-add-index}
+mv $RPM_BUILD_ROOT%{_bindir}/gdb $RPM_BUILD_ROOT%{_bindir}/gdb.minimal
+
+cd ..
+%endif
+# endif _build_minimal
+
+# Install the full build.
+
+cd %{gdb_build}
+
+# We must remove the $RPM_BUILD_ROOT directory ourselves if we're not
+# building gdb-minimal.
+%if 0%{!?_build_minimal}
+rm -rf $RPM_BUILD_ROOT
+%endif
+
+%make_install %{?_smp_mflags}
+
+%if 0%{!?scl:1}
+mkdir -p $RPM_BUILD_ROOT%{_prefix}/libexec
+mv -f $RPM_BUILD_ROOT%{_bindir}/gdb $RPM_BUILD_ROOT%{_prefix}/libexec/gdb
+ln -s -r $RPM_BUILD_ROOT%{_prefix}/libexec/gdb $RPM_BUILD_ROOT%{_bindir}/gdb
+%endif
+
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d
+touch -r %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d
+sed 's#%%{_sysconfdir}#%{_sysconfdir}#g' <%{SOURCE4} >$RPM_BUILD_ROOT%{_sysconfdir}/gdbinit
+touch -r %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit
+
+for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb -name "*.py"`
+do
+ # Files could be also patched getting the current time.
+ touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i
+done
+
+%if 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1}
+mkdir -p $RPM_BUILD_ROOT/usr/lib/debug%{_bindir}
+cp -p ./gdb/gdb-gdb.py $RPM_BUILD_ROOT/usr/lib/debug%{_bindir}/
+for pyo in "" "-O";do
+ # RHEL-5: AttributeError: 'module' object has no attribute 'compile_file'
+ %{__python} $pyo -c 'import compileall, re, sys; sys.exit (not compileall.compile_dir("'"$RPM_BUILD_ROOT/usr/lib/debug%{_bindir}"'", 1, "'"/usr/lib/debug%{_bindir}"'"))'
+done
+%endif
+
+# Compile python files
+%if 0%{!?_without_python:1}
+%py_byte_compile %{__python3} %{buildroot}%{_datadir}/gdb/python/gdb
+
+# BZ 999645: /usr/share/gdb/auto-load/ needs filesystem symlinks
+for i in $(echo bin lib $(basename %{_libdir}) sbin|tr ' ' '\n'|sort -u);do
+ # mkdir to satisfy dangling symlinks build check.
+ mkdir -p $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load/%{_root_prefix}/$i
+ ln -s $(echo %{_root_prefix}|sed 's#^/*##')/$i \
+ $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load/$i
+done
+for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb -name "*.py"`; do
+ # Files are installed by install(1) not preserving the timestamps.
+ touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i
+done
+%endif
+
+# Remove the files that are part of a gdb build but that are owned and
+# provided by other packages.
+# These are part of binutils
+
+rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/
+rm -f $RPM_BUILD_ROOT%{_infodir}/bfd*
+rm -f $RPM_BUILD_ROOT%{_infodir}/standard*
+rm -f $RPM_BUILD_ROOT%{_infodir}/configure*
+rm -f $RPM_BUILD_ROOT%{_infodir}/sframe-spec*
+# Just exclude the header files in the top directory, and don't exclude
+# the gdb/ directory, as it contains jit-reader.h.
+rm -rf $RPM_BUILD_ROOT%{_includedir}/*.h
+rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*,ctf*,sframe*}
+
+# pstack obsoletion
+
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/gstack.1
+ln -s gstack.1 $RPM_BUILD_ROOT%{_mandir}/man1/pstack.1
+ln -s gstack $RPM_BUILD_ROOT%{_bindir}/pstack
+
+# Packaged GDB is not a cross-target one.
+(cd $RPM_BUILD_ROOT%{_datadir}/gdb/syscalls
+ rm -f mips*.xml
+ rm -f sparc*.xml
+%ifnarch x86_64
+ rm -f amd64-linux.xml
+%endif
+%ifnarch %{ix86} x86_64
+ rm -f i386-linux.xml
+%endif
+)
+
+# Documentation only for development.
+rm -f $RPM_BUILD_ROOT%{_infodir}/gdbint*
+rm -f $RPM_BUILD_ROOT%{_infodir}/stabs*
+rm -f $RPM_BUILD_ROOT%{_infodir}/ctf-spec*
+
+# Delete this too because the dir file will be updated at rpm install time.
+# We don't want a gdb specific one overwriting the system wide one.
+
+rm -f $RPM_BUILD_ROOT%{_infodir}/dir
+
+# These files are unrelated to Fedora Linux.
+rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/system-gdbinit/elinos.py
+rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/system-gdbinit/wrs-linux.py
+rmdir $RPM_BUILD_ROOT%{_datadir}/gdb/system-gdbinit
+
+%files
+# File must begin with "/": {GFDL,COPYING3,COPYING,COPYING.LIB,COPYING3.LIB}
+%license COPYING3 COPYING COPYING.LIB COPYING3.LIB
+%doc README NEWS
+%{_bindir}/gdb
+%{_bindir}/gcore
+%{_mandir}/*/gcore.1*
+%{_bindir}/gstack
+%{_mandir}/*/gstack.1*
+%{_bindir}/pstack
+%{_mandir}/*/pstack.1*
+# Provide gdb/jit-reader.h so that users are able to write their own GDB JIT
+# plugins.
+%{_includedir}/gdb
+%if 0%{!?scl:1}
+%files headless
+%{_prefix}/libexec/gdb
+%endif
+%config(noreplace) %{_sysconfdir}/gdbinit
+%{_mandir}/*/gdb.1*
+%{_sysconfdir}/gdbinit.d
+%{_mandir}/*/gdbinit.5*
+%{_bindir}/gdb-add-index
+%{_mandir}/*/gdb-add-index.1*
+%{_datadir}/gdb
+
+# don't include the files in include, they are part of binutils
+
+%if 0%{?_build_minimal}
+%files minimal
+%{_bindir}/gdb.minimal
+%{_bindir}/gdb-add-index
+%endif
+
+%files gdbserver
+%{_bindir}/gdbserver
+%{_mandir}/*/gdbserver.1*
+%if %{have_inproctrace}
+%{_libdir}/libinproctrace.so
+%endif
+
+%if 0%{!?_without_python:1}
+# [rhel] Do not migrate /usr/share/gdb/auto-load/ with symlinks on RHELs.
+%if 0%{!?rhel:1}
+%pre
+for i in $(echo bin lib $(basename %{_libdir}) sbin|tr ' ' '\n'|sort -u);do
+ src="%{_datadir}/gdb/auto-load/$i"
+ dst="%{_datadir}/gdb/auto-load/%{_root_prefix}/$i"
+ if test -d $src -a ! -L $src;then
+ if ! rmdir 2>/dev/null $src;then
+ mv -n $src/* $dst/
+ rmdir $src
+ fi
+ fi
+done
+%endif
+%endif
+
+%files doc
+%doc %{gdb_build}/gdb/doc/{gdb,annotate}.{html,pdf}
+%{_infodir}/annotate.info*
+%{_infodir}/gdb.info*
+
+%if 0%{?scl:1}
+# As of F-28, packages won't need to call /sbin/install-info by hand
+# anymore. We make an exception for DTS here.
+# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/MP2QVJZBOJZEOQO2G7UB2HLXKXYPF2G5/
+
+%post doc
+# This step is part of the installation of the RPM. Not to be confused
+# with the 'make install ' of the build (rpmbuild) process.
+
+# For --excludedocs:
+if [ -e %{_infodir}/gdb.info.gz ]
+then
+ /sbin/install-info --info-dir=%{_infodir} %{_infodir}/annotate.info.gz || :
+ /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gdb.info.gz || :
+fi
+
+%preun doc
+if [ $1 = 0 ]
+then
+ # For --excludedocs:
+ if [ -e %{_infodir}/gdb.info.gz ]
+ then
+ /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/annotate.info.gz || :
+ /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gdb.info.gz || :
+ fi
+fi
+%endif
+# endif scl
+
+%changelog
+* Tue Apr 15 2025 Guinevere Larsen - 16.2-1
+- Initial import of sources for GTS15 repository
+* Thu Mar 27 2025 Keith Seitz
+- Backport "Fix gstack issues" from upstream.
+ (Keith Seitz, RH BZ 2354997)
+
+* Tue Feb 11 2025 Alexandra Hájková
+- Rebase to FSF GDB 16.2.
+ Dropped: gdb-6.3-gstack-20050411.patch
+ gdb-6.6-bz229517-gcore-without-terminal.patch
+ gdb-6.6-testsuite-timeouts.patch
+ gdb-backport-buildid-related-changes.patch
+ gdb-catchpoint-re-set.patch
+ gdb-remove-qnx-neutrino-support.patch
+ gdb-test-dw2-aranges.patch
+ Modified: gdb-add-rpm-suggestion-script.patch
+
+* Mon Feb 10 2025 Andrew Burgess
+- Add core-target-open-segfault.patch and tui-wrefresh-issue.patch,
+ these backport upstream commits 2fc56106422 and 2b646bb8767
+ respectively, both fix regressiosn in GDB 16 vs GDB 15.
+
+
+* Tue Jan 07 2025 Andrew Burgess
+- Remove
+ gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch,
+ gdb-6.6-buildid-locate.patch,
+ gdb-6.6-buildid-locate-solib-missing-ids.patch, and
+ gdb-remove-use-of-py-isascii. Add new patches
+ gdb-add-deprecated-settings-py-script.patch,
+ gdb-backport-buildid-related-changes.patch,
+ gdb-remove-qnx-neutrino-support.patch, and
+ gdb-6.6-buildid-locate-tests.patch. Update
+ gdb-add-rpm-suggestion-script.patch and
+ gdb-rhbz1156192-recursive-dlopen-test.patch. All of the RPM
+ suggestion feature is now provided via a Python extension. I
+ believe that the existing functionality should be covered by the new
+ implementation, but with no real tests for the existing code, we
+ cannot be certain. There are new GDB commands added as part of this
+ change related to controlling the RPM suggestion feature. These are
+ documented within the gdb-add-rpm-suggestion-script.patch patch by
+ changes to the GDB manual.
+
+* Tue Jan 07 2025 Andrew Burgess
+- Update generate-patches-from-git-repo.sh script to avoid loading git
+ config files.
+
+* Tue Nov 12 2024 Andrew Burgess
+- Add x86_64-redhat-linux-gnu to --enable-targets in gdb.spec, this
+ ensures we can remote debug x86-64 targets from non-x86-64 hosts.
+ This fixes rhbz 2308522.
+
+* Thu Nov 7 2024 Mark Wielaard - 15.2-2
+- Resolves: rhbz#2323513
+ - gdb-add-index.patch: Replace which with command -v
+ - Remove which Requires which was only there for gdb-add-index
+
+* Tue Oct 15 2024 Alexandra Hájková - 15.2-1
+- Rebase to FSF GDB 15.2.
+
+* Mon Sep 9 2024 Andrew Burgess
+- Backport upstream commit a92e943014f to fix rhbz2304296.
+
+* Thu Aug 8 2024 Guinevere Larsen
+- Remove gdb-6.7-ppc-clobbered-registers-O2-test.patch
+ This test is already upstreamed in gdb.opt
+- Remove gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
+ This is already covered by gdb.thread/tls.exp
+
+* Wed Jul 24 2024 Alexandra Hájková - 15.1-1
+- Rebase to FSF GDB 15.1.
+- Update local patches:
+ gdb-6.3-gstack-20050411.patch
+ gdb-6.6-buildid-locate-solib-missing-ids.patch
+ gdb-6.6-buildid-locate.patch
+ gdb-add-missing-debug-ext-lang-hook.patch
+ gdb-add-rpm-suggestion-script.patch
+ gdb-merge-debug-symbol-lookup.patch
+- Dropped:
+ gdb-add-missing-debug-ext-lang-hook.patch
+ gdb-add-missing-debug-info-python-hook.patch
+ gdb-do-not-import-py-curses-ascii-module.patch
+ gdb-ftbs-swapped-calloc-args.patch
+ gdb-handle-no-python-gdb-module.patch
+ gdb-refactor-find-and-add-separate-symbol-file.patch
+ gdb-reformat-missing-debug-py-file.patch
+ gdb-remove-path-in-test-name.patch
+ gdb-remove-use-of-py-isascii
+ gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
+ gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch
+ gdb-rhbz-2232086-generate-gdb-index-consistently.patch
+ gdb-rhbz-2232086-reduce-size-of-gdb-index.patch
+ gdb-rhbz2232086-refactor-selftest-support.patch
+ gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch
+ gdb-rhbz2250652-gdbpy_gil.patch
+ gdb-rhbz2261580-intrusive_list-assertion-fix.patch
+ gdb-rhbz2277160-apx-disasm.patch
+ gdb-rhel2295897-pre-read-DWZ-file-in-DWARF-reader.patch
+ gdb-sync-coffread-with-elfread.patch
+
+* Thu Jul 18 2024 Fedora Release Engineering
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
+
+* Fri Jul 5 2024 Guinevere Larsen - 14.2-14
+- backport commit 91874afabcd to solve RHEL-2295897
+ This fixes a double free when debugging mysql-workbench
+
+* Thu Jun 27 2024 Kevin Buettner - 14.2-13
+- Revise rpm-suggestions.py script so that message regarding
+ a not-found 'rpm' module is deferred until just prior to
+ printing the GDB prompt. (RHBZ 2275274)
+
+* Wed Jun 19 2024 Guinevere Larsen
+- Drop gdb-glibc-strstr-workaround.patch
+
+* Tue Jun 18 2024 Kevin Buettner
+- Remove gdb-core-open-vdso-warning.patch. This tests added by this
+ patch are similar to those of upstream test gdb.base/vdso-warning.exp.
+
+* Tue Jun 18 2024 Kevin Buettner - 14.2-12
+- Revise rpm-suggestions.py script so that message regarding
+ a not-found 'rpm' module is output to stderr. (RHBZ 2275274)
+
+* Sat Jun 08 2024 Python Maint
+- Rebuilt for Python 3.13
+
+* Thu Jun 06 2024 Python Maint - 14.2-10
+- Bootstrap for Python 3.13
+
+* Thu May 23 2024 Kevin Buettner - 14.2-9
+- Revise rpm-suggestions.py script so that a message is printed when
+ the 'rpm' module (found in the python3-rpm package) isn't found.
+ In particular, the ModuleNotFoundError will be caught, avoiding
+ a potential python import error. (RHBZ 2275274)
+
+* Wed May 22 2024 Guinevere Larsen
+- Remove gdb-fedora-libncursesw.patch, this workaround isn't needed
+ anymore.
+
+* Wed May 15 2024 Keith Seitz - 14.2-8
+- Sync x86 disassembler with (proposed) gdb-15.1 release.
+ (many authors, RHBZ 2277160)
+
+* Tue Apr 30 2024 Keith Seitz - 14.2-7
+- Remove bundled copy of libipt.
+- Remove bundled copy of libstdc++ pretty-printers.
+- Always include debuginfod support.
+- Purge RHEL < 8.
+
+* Thu Apr 25 2024 Kevin Buettner - 14.2-6
+- Further changes for fixing RHBZ 2275274: Add a
+ 'Requires: binutils' which is needed because gdb-add-index uses
+ readelf and objcopy. Also, delete librpm related stuff since
+ gdb/build-id.c no longer attempts to dlopen a librpm library. Add
+ 'Recommends python3-rpm' so that rpm-suggestions.py will find the
+ required python module.
+
+* Tue Apr 23 2024 Kevin Buettner - 14.2-5
+- Add "Requires: which" for RHBZ 2275274.
+
+* Mon Apr 22 2024 Keith Seitz
+- Remove gdb-linux_perf-bundle.patch.
+
+* Thu Mar 28 2024 Kevin Buettner
+- Drop gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch. I've
+ rewritten and expanded the test case and have submitted it for
+ upstream consideration. The hack which rewrote 'errno' into a
+ dereference of a call to '__errno_location' does still fix a problem
+ with printing errno in statically linked binaries. But it will fail
+ when attempting to debug a core file. The original test case
+ associated with this bug now works correctly due changes to glibc.
+
+* Tue Mar 19 2024 Andrew Burgess
+- Drop gdb-bz634108-solib_address.patch. This is a test only patch.
+ I've pushed upstream commit 52ca06e807b which covers this test case,
+ we'll pick up the upstream test next time Fedora is rebased.
+
+* Tue Mar 19 2024 Andrew Burgess
+- Drop gdb-container-rh-pkg.patch. This patch gave a warning when
+ connecting to very old gdbserver. The warning mentioned specific
+ RHEL versions, all of which are no longer supported. As such the
+ warning seems pointless.
+
+* Mon Mar 18 2024 Andrew Burgess
+- Drop gdb-6.3-attach-see-vdso-test.patch, this is a test only patch.
+ Upstream commit 93eb6c64ec4a6ea includes a similar test, and will be
+ picked up as part of the next rebase.
+
+* Wed Mar 13 2024 Andrew Burgess
+- Remove the use of librpm from GDB's C++ code, and instead provide
+ similar RPM suggestion feature using a Python extension. The Python
+ extension feature that supports this is an upstream feature which
+ has been back-ported (along with several dependencies and related
+ fixes). The actual RPM suggestion is now provided as a Python
+ script which is auto-loaded by GDB. Removing the use of librpm from
+ the C++ code allows some cleanup of the configure scripts.
+
+* Fri Mar 8 2024 Andrew Burgess
+- Reduce gdb-6.6-buildid-locate.patch by removing some unnecessary
+ casts added to bfd/ source files.
+
+* Fri Mar 8 2024 Andrew Burgess
+- Reduce gdb-6.6-buildid-locate.patch by removing the build_id_bfd_get
+ to build_id_bfd_shdr_get change. This was only changing the name of
+ a function, so seems pointless.
+
+* Wed Mar 6 2024 Alexandra Hájková - 14.2-1
+- Rebase to FSF GDB 14.2.
+
+* Mon Mar 4 2024 Alexandra Hájková - 14.1-10
+- Replace zlib to zlib-ng package in a debug-toolset-binary Fedora CI
+ test (RHBZ 2266910).
+
+* Wed Feb 21 2024 Richard W.M. Jones
+- Bump and rebuild for riscv64
+
+* Mon Jan 29 2024 Kevin Buettner - 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
+- 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 - 14.1-7
+- Backport "gdb: fix list . related crash"
+
+* Wed Jan 24 2024 Fedora Release Engineering
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
+
+* Fri Jan 19 2024 Fedora Release Engineering
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
+
+* Tue Jan 16 2024 Kevin Buettner - 14.1-4
+- Backport upstream commit bc23ea51f8a83e9524dfb553baa8baacb29e68a9,
+ potentially fixing RHBZ 2257562.
+
+* Thu Jan 11 2024 Alexandra Hájková - 14.1-3
+- Fix typo in gdb.spec.
+
+* Mon Jan 8 2024 Alexandra Hájková - 14.1-2
+- Backport upstream commits 7ae9ecfd801 and 8170efad364 to avoid
+ using _PyOS_ReadlineTState (RHBZ 2250652).
+
+* Fri Dec 8 2023 Kevin Buettner - 14.1-1
+- Rebase to FSF GDB 14.1.
+- Update local patches:
+ gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
+ gdb-6.6-buildid-locate-rpm.patch
+ gdb-6.6-buildid-locate.patch
+ gdb-container-rh-pkg.patch
+ gdb-core-open-vdso-warning.patch
+ gdb-fedora-libncursesw.patch
+ gdb-linux_perf-bundle.patch
+- Update backported patches which didn't make it into 14.1:
+ gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
+ gdb-rhbz-2232086-generate-gdb-index-consistently.patch
+- Drop upstreamed local patches:
+ gdb-6.5-sharedlibrary-path.patch
+- Drop gdb-13.2 backports (which are now in gdb-14.1):
+ gdb-binutils29988-read_indexed_address.patch
+ gdb-bz2196395-debuginfod-legacy-openssl-crash.patch
+ gdb-bz2237392-dwarf-obstack-allocation.patch
+ gdb-bz2237515-debuginfod-double-free.patch
+ gdb-rhbz2192105-ftbs-dangling-pointer
+ gdb-rhbz2233961-CVE-2022-4806.patch
+ gdb-rhbz2233965-memory-leak.patch
+- Adjust gdb.spec so that --with-mpfr is no longer passed to
+ configure; doing so, combined with some configury changes triggered
+ a latent build problem.
+
+* Mon Dec 4 2023 Kevin Buettner
+- Remove gdb-6.5-missed-trap-on-step-test.patch. Testing what happens
+ when stepping over/through a statement which triggers a watchpoint
+ is being added, upstream, to gdb.base/watchpoint.exp.
+
+* Tue Nov 28 2023 Andrew Burgess
+- Backport upstream commits 1f0fab7ff86, aa19bc1d259, acc117b57f7,
+ aff250145af, and 3644f41dc80. These commits reduce the size of the
+ generated gdb-index file, and also ensure that the gdb-index and
+ dwarf-5 index are generated consistently even as the number of
+ worker threads that GDB uses changes (RHBZ 2232086).
+
+* Thu Oct 19 2023 Alexandra Hájková
+- Remove gdb-6.5-ia64-libunwind-leak-test.patch.
+ The patch doesn't include any actual fixes, the architecture
+ is end of life and the kernel is planning to drop IA64 support.
+
+* Wed Oct 11 2023 Guinevere Larsen
+- Remove gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
+ as it was upstreamed back in 2010 with a different test name.
+
+* Mon Oct 2 2023 Kevin Buettner - 13.2-11
+- Backport upstream commit which prevents internal error when
+ generating an overly large gdb-index file. (RHBZ 1773651, Kevin
+ Buettner.)
+
+* Sun Oct 1 2023 Alexandra Hájková - 13.2-10
+- Backport upstream commit d28fbc7197b which fixes RHBZ 2233965 (
+ CVE-2022-48065).
+
+* Thu Sep 28 2023 Kevin Buettner
+- Remove gdb-6.5-sharedlibrary-path.patch, which was upstreamed in
+ commit 3ec033fab4a.
+
+* Tue Sep 19 2023 Keith Seitz
+- Remove gdb-rhbz1553104-s390x-arch12-test.patch, which is more thoroughly tested
+ by binutils.
+
+* Mon Sep 18 2023 Alexandra Hájková - 13.2-8
+- Bump release to 13.2-9.
+
+* Sun Sep 17 2023 Alexandra Hájková - 13.2-8
+- Backport upstream commit 8f2c64de86b which fixes RHBZ 2233961,
+ CVE-2022-48064, (Alan Modra).
+
+* Fri Sep 15 2023 Keith Seitz - 13.2-8
+- migrated to SPDX license
+
+* Fri Sep 15 2023 Andrew Burgess
+- Bump release to 13.2-8.
+
+* Thu Sep 14 2023 Andrew Burgess
+- Backport upstream commit 54392c4df604f20, which fixes RHBZ 2237392.
+
+* Wed Sep 13 2023 Andrew Burgess
+- Backport upstream commit f96328accde1e63, which fixes RHBZ 2237515.
+
+* Wed Aug 9 2023 Guinevere Larsen
+- Remove gdb-6.7-testsuite-stable-results.patch, it only made the test
+ fail more.
+
+* Mon Aug 7 2023 Kevin Buettner - 13.2-7
+- Bump release.
+
+* Thu Aug 3 2023 Andrew Burgess
+- Backport upstream commit f3eee586174, which fixes RHBZ 2196395.
+
+* Wed Jul 19 2023 Fedora Release Engineering
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
+
+* Fri Jul 07 2023 Python Maint
+- Rebuilt for Python 3.12
+
+* Tue Jul 4 2023 Andrew Burgess
+- Remove gdb-test-pid0-core.patch. This work has been upstreamed in
+ commit 8bcead69665.
+
+* Sat Jul 1 2023 Mark Wielaard - 13.2-4
+- Adjust gdb-add-index.patch to be silent about which gdb.
+
+* Fri Jun 30 2023 Kevin Buettner - 13.2-3
+- Backport upstream changes which prevent repeated warnings from being
+ printed when loading a core file (RHBZ 2160211, Lancelot SIX).
+
+* Wed Jun 28 2023 Python Maint - 13.2-2
+- Rebuilt for Python 3.12
+
+* Sun Jun 25 2023 Alexandra Hájková - 13.2-1
+- Rebase to FSF GDB 13.22.
+- Remove gdb-rhbz2177655-aarch64-pauth-valid-regcache.patch.
+- Remove gdb-rhbz2183595-rustc-inside_main.patch.
+
+* Tue Jun 13 2023 Python Maint
+- Rebuilt for Python 3.12
+
+* Tue Jun 13 2023 Python Maint
+- Bootstrap for Python 3.12
+
+* Sat May 20 2023 Andrew Burgess
+- Remove gdb-lineno-makeup-test.patch. An equivalent test has now
+ been merged to upstream binutils-gdb in commit ef56b006501.
+
+* Tue May 16 2023 Andrew Burgess
+- Remove gdb-ccache-workaround.patch. This patch works around
+ problems when using older versions of ccache, however, upstream GDB
+ now disables ccache during testing, see upstream commit 49b4de64242d.
+
+* Tue May 16 2023 Andrew Burgess
+- Remove gdb-ppc-power7-test.patch, this patch is already covered by
+ upstream tests gdb.arch/powerpc-*.exp.
+
+* Sat May 6 2023 Alexandra Hájková
+- Remove gdb-rhel5.9-testcase-xlf-var-inside-mod.patch, the patch adds
+ gdb.fortran/xlf-variable.exp test, the test can only be run on
+ PPC64 machines which are not supported anymore.
+
+* Thu May 4 2023 Kevin Buettner
+- Fix C89-isms in gdb-6.6-buildid-locate-rpm.patch. (Florian Weimer,
+ RHBZ 2143992)'. This change merely restores changes introduced by
+ Keith's Nov 30 2022 commit, but which were inadvertently lost during
+ the GDB 13.1 backport.
+
+* Thu May 4 2023 Andrew Burgess
+- Rewrite the changes to gdb-add-index.sh. If the user has set the
+ GDB environment variable then use that value, otherwise find a
+ suitable GDB executable by looking in various places.
+
+* Wed May 3 2023 Kevin Buettner 13.1-5
+- Backport "Pass const frame_info_ptr reference for
+ skip_[language_]trampoline". (Mark Wielaard, RHBZ 2192105, build/30413)
+
+* Tue May 2 2023 Andrew Burgess
+- Remove gdb-opcodes-clflushopt-test.patch. This patch tests that GDB
+ can disassemble the clflushopt instruction correctly. Such
+ disassembly is a feature of libopcode and is covered by the gas
+ tests i386/x86-64-clflushopt.s and i386/clflushopt.s. Lets remove
+ this test from GDB and just rely on the gas tests instead.
+
+* Sat Apr 29 2023 Kevin Buettner
+- Remove gdb-6.7-charsign-test.patch. This patch originally contained
+ some changes to GDB which were rejected by upstream maintainers. All
+ that remained was a testcase which had a number of failures due to
+ the rest of the work not being present in GDB.
+
+* Tue Apr 25 2023 Bruno Larsen
+- Remove gdb-6.5-bz109921-DW_AT_decl_file-test.patch. That patch was
+ only a test for basic DWARF-2 support, ensuring that GDB found a
+ variable in a .h file; tests such as gdb.linespec/linespec.exp already
+ tests for it.
+
+* Mon Apr 24 2023 Bruno Larsen
+- Remove gdb-6.5-last-address-space-byte-test.patch. It was used to
+ test for a regression in target_xfer_memory, a function that has
+ been removed from upstream back in 2006.
+
+* Thu Apr 13 2023 Alexandra Hájková
+- Remove gdb-6.3-bz140532-ppc-unwinding-test.patch, it adds
+ powerpc-bcl-prologue.exp test which seems to be a subset of
+ upstream powerpc-prologue.exp
+
+* Tue Apr 11 2023 Keith Seitz
+- Backport "Fix a potential illegal memory access in the BFD library..."
+ (Nick Clifton, binutils/29988)
+
+* Fri Mar 31 2023 Keith Seitz - 13.1-4
+- Backport "Fix crash in inside_main_func"
+ (Tom Tromey, RHBZ 2183595)
+
+* Thu Mar 30 2023 Alexandra Hájková - 12.1-3
+- Update gdb-6.6-buildid-locate.patch to fix RHBZ 2181221.
+
+* Wed Mar 29 2023 Andrew Burgess
+- Used --with-pkgversion to place the distribution name in the version
+ string rather than placing the string directly into the version.in
+ file.
+
+* Fri Mar 24 2023 Kevin Buettner - 13.1-2
+- Backport fix for RHBZ 2177655. (Luis Machado)
+
+* Mon Mar 20 2023 Bruno Larsen
+- Remove gdb-rhbz1350436-type-printers-error.patch since it is upstreamed.
+
+* Wed Mar 8 2023 Kevin Buettner - 13.1-1
+- Rebase to FSF GDB 13.1.
+- Update gdb-6.3-rh-testversion-20041202.patch.
+- Update gdb-6.3-bz140532-ppc-unwinding-test.patch.
+- Update gdb-6.6-buildid-locate.patch.
+- Update gdb-6.6-buildid-locate-rpm.patch.
+- Remove 'Recommends: ' line for gcc-gdb-plugin for BZ2149246.
+- Define _lto_cflags to nil to avoid ODR violations.
+- Add -Wno-stringop-overflow to --enable-gdb-build-warnings to work around
+ gcc problem.
+
+* Fri Jan 27 2023 Kevin Buettner - 12.1-16
+- Tweak gdb-6.3-rh-testversion-20041202.patch so that $_gdb_major
+ and $_gdb_minor will be obtained correctly.
+
+* Thu Jan 26 2023 Bruno Larsen
+- Remove gdb-rhbz1398387-tab-crash-test.patch as that test didn't
+ work anymore.
+
+* Tue Jan 24 2023 Keith Seitz - 12.1-15
+- NVR bump for failed build.
+
+* Mon Jan 23 2023 Kevin Buettner
+- More tweaks to gdb-6.6-buildid-locate-rpm.patch, in which rpmTag
+ is replaced with rpmDbiTagVal.
+
+* Mon Jan 23 2023 Keith Seitz - 12.1-14
+ From Sergey Mende:
+- Backport upstream patch "gdb: call check_typedef at beginning of
+ dwarf_expr_context::fetch_result". (Simon Marchi)
+
+
+* Fri Jan 20 2023 Kevin Buettner - 12.1-13
+- Backport fix for problems associated with GCC 13's self-move warning.
+ (Jan-Benedict Glaw)
+- Tweak gdb-6.6-buildid-locate-rpm.patch so that running GDB's configure
+ script will not error out due to GCC 13's warnings.
+
+* Thu Jan 19 2023 Alexandra Hájková - 12.1-12
+- Backport replace deprecated distutils.sysconfig in python-config.
+ (Lancelot SIX)
+
+* Thu Jan 19 2023 Fedora Release Engineering
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
+
+* Mon Dec 19 2022 Andrew Burgess
+- Backport upstream commits 38665d717a3 and c3efaf0afd9 to fix RHBZ
+ 2152431.
+
+* Fri Dec 16 2022 Keith Seitz
+- Remove gdb-6.6-buildid-locate-rpm-scl.patch and
+ gdb-bz601887-dwarf4-rh-test.patch.
+
+* Fri Dec 9 2022 Andrew Burgess
+- Remove gdb-fortran-frame-string.patch, a version of this test has
+ now been upstreamed.
+
+* Fri Dec 9 2022 Andrew Burgess
+- Remove gdb-bfd-aliasing.patch.
+
+* Fri Dec 9 2022 Andrew Burgess
+- Remove gdb-entryval-crash-1of3.patch, gdb-entryval-crash-2of3.patch,
+ and gdb-entryval-crash-3of3.patch.
+
+* Wed Dec 7 2022 Keith Seitz - 12.1-10
+- Disable Guile support for F38+, RHBZ 2151328.
+
+* Mon Dec 5 2022 Keith Seitz
+- Remove gdb-physname-pr11734-test.patch,
+ gdb-physname-pr12273-test.patch, gdb-runtest-pie-override.patch,
+ gdb-test-expr-cumulative-archer.patch.
+
+* Thu Dec 1 2022 Kevin Buettner
+- Remove gdb-6.3-threaded-watchpoints2-20050225.patch. The test in this
+ patch is a tweaked version of upstream test gdb.threads/watchthreads.exp
+ from 2004. It doesn't actually test anything new.
+
+* Thu Dec 1 2022 Bruno Larsen
+- Remove gdb-rhbz1325795-framefilters-test.patch. This test doesn't
+ pass in the curret state, and the code that introduced the original
+ problem has been changed beyong recognition at this point.
+
+* Wed Nov 30 2022 Keith Seitz
+- Backport "libiberty: Fix C89-isms in configure tests" and do likewise in
+ gdb-6.6-buildid-locate-rpm.patch.
+ (Florian Weimer, RHBZ 2143992)
+
+* Wed Nov 23 2022 Kevin Buettner
+- Remove gdb-6.3-inheritancetest-20050726.patch. Upstream testcase
+ gdb.cp/impl-this.exp tests the printing of an instance variable from
+ an inherited class in the "print c" test.
+
+* Fri Nov 18 2022 Kevin Buettner
+- Remove gdb-6.3-test-movedir-20050125.patch. Upstream test
+ gdb.base/fullname.exp provides coverage for this case and more.
+
+* Thu Nov 3 2022 Keith Seitz - 12.1-9
+- Add patch to fix ODR violations on powerpc and
+ enable LTO builds. (Keith Seitz, sw build/23395)
+
+* Tue Oct 18 2022 Bruno Larsen - 12.1-8
+- Backport fix to gdb.base/break-main-file-remove-fail.exp
+ (Tom de Vries)
+
+* Tue Oct 18 2022 Bruno Larsen - 12.1-7
+- Remove patch gdb-6.3-test-dtorfix.
+ Was upstreamed, will be back in the next rebase.
+
+* Thu Oct 13 2022 Alexandra Hájková - 12.1-7
+- Bump the release number.
+
+* Tue Oct 11 2022 Alexandra Hájková - 12.1-6
+- Backport upstream patch "Add support for readline 8.2". (Andreas Schwab)
+
+* Fri Oct 7 2022 Alexandra Hájková - 12.1-6
+- Update gdb-6.6-buildid-locate.patch to fix RHBZ 2122947.
+
+* Thu Jul 28 2022 Amit Shah
+- Use the dist_name macro to identify the distribution
+
+* Thu Jul 21 2022 Fedora Release Engineering
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
+
+* Mon Jun 13 2022 Python Maint
+- Rebuilt for Python 3.11
+
+* Mon Jun 13 2022 Python Maint - 12.1-2
+- Bootstrap for Python 3.11
+
+* Thu May 12 2022 Kevin Buettner - 12.1-1
+- Rebase to FSF GDB 12.1.
+- Update gdb-6.6-buildid-locate.patch.
+- Update gdb-6.6-buildid-locate-rpm.patch.
+- Dropped backported patches from GDB 11.1 and 11.2.
+
+* Wed Mar 30 2022 Kevin Buettner - 11.2-3
+- Backport upstream patch which removes sizes from debuginfod download
+ messages when the size is not available (RHBZ 2068280, Aaron Merey).
+
+* Wed Feb 9 2022 Kevin Buettner - 11.2-2
+- On ix86, add -Wno-format-overflow to --enable-gdb-build-warnings.
+ (This is a workaround for the bogus warning/error that we now see
+ on i686 regarding a "may write a terminating nul past the end of
+ the destination" message for the sprintf() call in
+ global_symbol_searcher::search() in gdb/symtab.c.)
+
+* Wed Feb 9 2022 Kevin Buettner - 11.2-1
+- Rebase to FSF GDB 11.2.
+
+* Mon Jan 31 2022 Kevin Buettner - 11.1-12
+- Fix "sect_index_data not initialized" internal error. (RHBZ 2042664,
+ Kevin Buettner).
+
+* Mon Jan 31 2022 Keith Seitz - 11.1-11
+- Fix buld issues. (RHBZ 2042257, Keith Seitz, Andrew Burgess)
+- Update libipt to 2.0.5.
+
+* Thu Jan 20 2022 Fedora Release Engineering
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
+
+* Wed Jan 12 2022 Alexandra Hájková - 11.1-9
+- Remove gdb-6.3-inferior-notification-20050721.patch
+ which adds problematic attach-32 test.
+
+* Tue Jan 11 2022 Alexandra Hájková - 11.1-8
+- Backport upstream patch "[PR gdb/27026] CTRL-C is ignored
+ when debug info is downloaded" (RHBZ 2024875, Aaron Merey).
+
+* Tue Jan 11 2022 Alexandra Hájková - 11.1-8
+- Backport upstream patch "rework "set debuginfod" commands"
+ (RHBZ 2024875, Simon Marchi).
+
+* Tue Jan 11 2022 Alexandra Hájková - 11.1-8
+- Backport upstream patch "Fix unittest.exp failure due to 'set debuginfod' addition"
+ (RHBZ 2024875, Tom Tromey).
+
+* Mon Jan 10 2022 Alexandra Hájková - 11.1-8
+- Add -Wno-unused-function to --enable-gdb-build-warnings to prevent the build failure:
+ "../../gdb/c-exp.y:3455:1: error: 'void c_print_token(FILE*, int, YYSTYPE)'
+ defined but not used [-Werror=unused-function]"
+
+* Mon Jan 10 2022 Alexandra Hájková - 11.1-8
+- Backport upstream patch "gdb: add set/show commands for managing debuginfod"
+ (RHBZ 2024875, Aaron Merey).
+
+* Mon Jan 10 2022 Alexandra Hájková - 11.1-8
+- Backport upstream patch "gdb.texinfo: Expand documentation for debuginfod"
+ (RHBZ 2024875, Aaron Merey).
+
+* Mon Dec 6 2021 Kevin Buettner - 11.1-7
+- Add -Wno-deprecated-declarations to --enable-gdb-build-warnings to work
+ around the python 3.11 deprecation of Py_SetProgramName.
+
+* Fri Nov 12 2021 Timm Bäder - 11.1-6
+- Use %%set_build_flags to populate all relevant build flags
+
+* Wed Nov 10 2021 Kevin Buettner - 11.1-5
+- Backport upstream fix and test case for a dprintf bug (RHBZ 2022177, Kevin
+ Buettner).
+
+* Tue Nov 9 2021 Bruno Larsen - 11.1-4
+- Backport manpage update to be closer to -help (RHBZ 853071)
+
+* Wed Nov 3 2021 Kevin Buettner - 11.1-3
+- Make adjustments to gdb-6.6-buildid-locate.patch, provided by Tom de Vries.
+
+* Mon Oct 11 2021 Kevin Buettner - 11.1-2
+- Backport upstream patch which papers over Fortran lexical analyzer
+ bug (RHBZ 2012976, Tom de Vries).
+
+* Mon Oct 04 2021 Kevin Buettner - 11.1-1
+- Rebase to FSF GDB 11.1.
+- Adjust build-id related patches.
+- Drop backported patches which are no longer relevant.
+- Bump 'snapgnulib' date.
+
+* Thu Sep 30 2021 Alexandra Hájková - 10.2-9
+- Backport test for RHBZ 1976887 (Kevin Buettner).
+
+* Thu Sep 30 2021 Alexandra Hájková - 10.2-9
+- Backport upstream patch which fixes internal-error: Unexpected
+ type field location kind (RHBZ 1976887, Alexandra Hájková).
+
+* Wed Sep 22 2021 Bruno Larsen - 10.2-8
+- Backport "[gdb] Improve early exits for env var in debuginfod-support.c"
+ (Tom de Vries)
+
+* Wed Sep 22 2021 Bruno Larsen - 10.2-8
+- Backport "[gdb/cli] Don't assert on empty string for core-file"
+ (Tom de Vries)
+
+* Tue Sep 21 2021 Peter Robinson 10.2-7
+- Use guile 2.2 (rhbz #1901353)
+
+* Wed Jul 21 2021 Fedora Release Engineering 10.2-6
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
+
+* Tue Jul 20 2021 Kevin Buettner - 10.2-5
+- Remove autoconf invocations from spec file.
+- Remove BuildRequires: autoconf.
+
+* Mon Jun 14 2021 Kevin Buettner - 10.2-4
+- Backport upstream patches which fix multi-threaded debugging for
+ glibc-2.34 (RHBZ 1971096, Simon Marchi, Kevin Buettner).
+
+* Fri Jun 11 2021 Keith Seitz - 10.2-3
+- Backport "Exclude debuginfo files from 'outside ELF segments' warning".
+ (Keith Seitz, RH BZ 1898252)
+- Backport "Fix crash when expanding partial symtab..."
+ (Tom Tromey. gdb/27743)
+- Backport "[gdb/server] Don't overwrite fs/gs_base with -m32"
+- (Tom de Vries)
+
+* Sun Jun 06 2021 Python Maint
+- Rebuilt for Python 3.10
+
+* Thu Jun 03 2021 Kevin Buettner - 10.2-1
+- Rebase to FSF GDB 10.2.
+- Drop gdb-6.3-test-pie-20050107.patch.
+- Drop gdb-6.3-test-self-20050110.patch.
+- Drop gdb-6.5-bz218379-ppc-solib-trampoline-test.patch.
+- Drop gdb-6.6-buildid-locate-core-as-arg.patch.
+- Drop gdb-6.8-quit-never-aborts.patch.
+- Drop gdb-archer-pie-addons-keep-disabled.patch.
+- Drop gdb-archer-pie-addons.patch.
+- Drop gdb-archer-vla-tests.patch.
+- Drop gdb-archer.patch.
+- Drop gdb-attach-fail-reasons-5of5.patch.
+- Drop gdb-btrobust.patch.
+- Drop gdb-bz1219747-attach-kills.patch.
+- Drop gdb-bz533176-fortran-omp-step.patch.
+- Drop gdb-dts-rhel6-python-compat.patch.
+- Drop gdb-gnat-dwarf-crash-3of3.patch.
+- Drop gdb-jit-reader-multilib.patch.
+- Drop gdb-moribund-utrace-workaround.patch.
+- Drop gdb-rhbz1930528-fix-gnulib-build-error.patch.
+- Drop gdb-rhbz1932645-aarch64-ptrace-header-order.patch.
+- Drop gdb-vla-intel-fix-print-char-array.patch.
+- Drop gdb-vla-intel-fortran-strides.patch.
+- Drop gdb-vla-intel-stringbt-fix.patch.
+- Drop gdb-vla-intel-tests.patch.
+- Drop process_psymtab_comp_unit-type-unit.patch.
+- Drop gdb-testsuite-readline63-sigint-revert.patch.
+- Drop gdb-config.patch.
+- Add following upstream patches for Fortran stride / slice support:
+ gdb-rhbz1964167-convert-enum-range_type.patch
+ gdb-rhbz1964167-fortran-array-slices-at-prompt.patch
+ gdb-rhbz1964167-fortran-array-strides-in-expressions.patch
+ gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch
+ gdb-rhbz1964167-fortran-range_type-to-range_flag.patch
+ gdb-rhbz1964167-fortran-whitespace_array.patch
+ gdb-rhbz1964167-move-fortran-expr-handling.patch
+
+* Tue Jun 01 2021 Python Maint
+- Bootstrap for Python 3.10
+
+* Wed Mar 31 2021 Keith Seitz - 10.1-18
+- Backport "Save/restore file offset while reading notes in core file"
+ (Keith Seitz, RHBZ 1931344)
+
+* Wed Mar 31 2021 Jonathan Wakely - 10.1-17
+- Rebuilt for removed libstdc++ symbols (#1937698)
+
+* Tue Mar 23 2021 Kevin Buettner
+- Remove spec file workaround for RHBZ 1912913.
+
+* Fri Mar 19 2021 Kevin Buettner - 10.1-16
+- Fix potential hang during gdbserver testing (RHBZ 1941080, Kevin Buettner).
+
+* Thu Mar 18 2021 Keith Seitz
+- Disable libctf on RHEL (RHBZ 1935517).
+
+* Thu Mar 11 2021 Kevin Buettner - 10.1-15
+- Update libipt to version 2.0.4.
+
+* Fri Mar 05 2021 Kevin Buettner - 10.1-14
+- Backport patches which fix frame_id_p assertion failure (RHBZ 1909902,
+ Pedro Alves).
+
+* Fri Mar 5 2021 Jan Kratochvil - 10.1-13
+- Drop gdb-vla-intel-fortran-vla-strings.patch as it was still regressing the
+ testsuite.
+
+* Thu Mar 4 2021 Jan Kratochvil