You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
4.8 KiB
128 lines
4.8 KiB
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
From: Fedora GDB patches <invalid@email.com>
|
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
Subject: gdb-6.5-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"
|