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