Blame SOURCES/gdb-libexec-add-index.patch

4a80f0
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
4a80f0
From: Fedora GDB patches <invalid@email.com>
4a80f0
Date: Fri, 27 Oct 2017 21:07:50 +0200
4a80f0
Subject: gdb-libexec-add-index.patch
4a80f0
4a80f0
;; Fix gdb-headless /usr/bin/ executables (BZ 1390251).
4a80f0
;;
4a80f0
;; Also, make /usr/bin/gdb.minimal be the default GDB used, if it's
4a80f0
;; present.  For rationale, see:
4a80f0
;;
4a80f0
;;   https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot
4a80f0
;;=fedora
4a80f0
4a80f0
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
4a80f0
--- a/gdb/contrib/gdb-add-index.sh
4a80f0
+++ b/gdb/contrib/gdb-add-index.sh
4a80f0
@@ -22,6 +22,20 @@ GDB=${GDB:=gdb}
4a80f0
 OBJCOPY=${OBJCOPY:=objcopy}
4a80f0
 READELF=${READELF:=readelf}
4a80f0
 
4a80f0
+GDB2=/usr/libexec/gdb
4a80f0
+if test -x $GDB2 && ! which $GDB &>/dev/null; then
4a80f0
+    GDB=$GDB2
4a80f0
+fi
4a80f0
+
4a80f0
+# We default to using /usr/bin/gdb.minimal if it's present.  See
4a80f0
+# https://bugzilla.redhat.com/show_bug.cgi?id=1695015 and
4a80f0
+# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot for
4a80f0
+# explanations.
4a80f0
+GDB3=/usr/bin/gdb.minimal
4a80f0
+if test -x $GDB3; then
4a80f0
+    GDB=$GDB3
4a80f0
+fi
4a80f0
+
4a80f0
 myname="${0##*/}"
4a80f0
 
4a80f0
 dwarf5=""