Blame SOURCES/gdb-6.5-section-num-fixup-test.patch

132741
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
132741
From: Fedora GDB patches <invalid@email.com>
132741
Date: Fri, 27 Oct 2017 21:07:50 +0200
132741
Subject: gdb-6.5-section-num-fixup-test.patch
132741
132741
;; Test a crash on libraries missing the .text section.
132741
;;=fedoratest
132741
132741
diff --git a/gdb/testsuite/gdb.base/datalib-lib.c b/gdb/testsuite/gdb.base/datalib-lib.c
132741
new file mode 100644
132741
--- /dev/null
132741
+++ b/gdb/testsuite/gdb.base/datalib-lib.c
132741
@@ -0,0 +1,22 @@
132741
+/* This testcase is part of GDB, the GNU debugger.
132741
+
132741
+   Copyright 2008 Free Software Foundation, Inc.
132741
+
132741
+   This program is free software; you can redistribute it and/or modify
132741
+   it under the terms of the GNU General Public License as published by
132741
+   the Free Software Foundation; either version 2 of the License, or
132741
+   (at your option) any later version.
132741
+
132741
+   This program is distributed in the hope that it will be useful,
132741
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
132741
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
132741
+   GNU General Public License for more details.
132741
+
132741
+   You should have received a copy of the GNU General Public License
132741
+   along with this program; if not, write to the Free Software
132741
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
132741
+
132741
+   Please email any bugs, comments, and/or additions to this file to:
132741
+   bug-gdb@prep.ai.mit.edu  */
132741
+
132741
+int var;
132741
diff --git a/gdb/testsuite/gdb.base/datalib-main.c b/gdb/testsuite/gdb.base/datalib-main.c
132741
new file mode 100644
132741
--- /dev/null
132741
+++ b/gdb/testsuite/gdb.base/datalib-main.c
132741
@@ -0,0 +1,26 @@
132741
+/* This testcase is part of GDB, the GNU debugger.
132741
+
132741
+   Copyright 2008 Free Software Foundation, Inc.
132741
+
132741
+   This program is free software; you can redistribute it and/or modify
132741
+   it under the terms of the GNU General Public License as published by
132741
+   the Free Software Foundation; either version 2 of the License, or
132741
+   (at your option) any later version.
132741
+
132741
+   This program is distributed in the hope that it will be useful,
132741
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
132741
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
132741
+   GNU General Public License for more details.
132741
+
132741
+   You should have received a copy of the GNU General Public License
132741
+   along with this program; if not, write to the Free Software
132741
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
132741
+
132741
+   Please email any bugs, comments, and/or additions to this file to:
132741
+   bug-gdb@prep.ai.mit.edu  */
132741
+
132741
+int
132741
+main (void)
132741
+{
132741
+  return 0;
132741
+}
132741
diff --git a/gdb/testsuite/gdb.base/datalib.exp b/gdb/testsuite/gdb.base/datalib.exp
132741
new file mode 100644
132741
--- /dev/null
132741
+++ b/gdb/testsuite/gdb.base/datalib.exp
132741
@@ -0,0 +1,56 @@
132741
+# Copyright 2008 Free Software Foundation, Inc.
132741
+
132741
+# This program is free software; you can redistribute it and/or modify
132741
+# it under the terms of the GNU General Public License as published by
132741
+# the Free Software Foundation; either version 2 of the License, or
132741
+# (at your option) any later version.
132741
+#
132741
+# This program is distributed in the hope that it will be useful,
132741
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
132741
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
132741
+# GNU General Public License for more details.
132741
+#
132741
+# You should have received a copy of the GNU General Public License
132741
+# along with this program; if not, write to the Free Software
132741
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
132741
+
132741
+if {[use_gdb_stub]} {
132741
+    untested "skipping test because of use_gdb_stub"
132741
+    return -1
132741
+}
132741
+
132741
+set testfile datalib
132741
+set srcfilemain ${testfile}-main.c
132741
+set srcfilelib ${testfile}-lib.c
132741
+set libfile [standard_output_file ${testfile}-lib.so]
132741
+set binfile [standard_output_file ${testfile}-main]
132741
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfilelib}" "${libfile}" executable [list debug {additional_flags=-shared -nostdlib}]] != "" } {
132741
+    untested "Couldn't compile test program"
132741
+    return -1
132741
+}
132741
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfilemain}" "${binfile} ${libfile}" executable {debug}] != "" } {
132741
+    untested "Couldn't compile test program"
132741
+    return -1
132741
+}
132741
+
132741
+# Get things started.
132741
+
132741
+gdb_exit
132741
+gdb_start
132741
+gdb_reinitialize_dir $srcdir/$subdir
132741
+gdb_load ${binfile}
132741
+
132741
+# We must use a separate library as the main executable is compiled to the
132741
+# address 0 by default and it would get fixed up already at the end of
132741
+# INIT_OBJFILE_SECT_INDICES.  We also cannot PRELINK it as PRELINK is missing
132741
+# on ia64.  The library must be NOSTDLIB as otherwise some stub code would
132741
+# create the `.text' section there.  Also DEBUG option is useful as some of
132741
+# the crashes occur in dwarf2read.c.
132741
+
132741
+# FAIL case:
132741
+# ../../gdb/ia64-tdep.c:2838: internal-error: sect_index_text not initialized
132741
+# A problem internal to GDB has been detected,
132741
+
132741
+gdb_test "start" \
132741
+         "main \\(\\) at .*${srcfilemain}.*" \
132741
+         "start"