Blame SOURCES/gdb-test-dw2-aranges.patch

a8223e
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
a8223e
From: Fedora GDB patches <invalid@email.com>
a8223e
Date: Fri, 27 Oct 2017 21:07:50 +0200
a8223e
Subject: gdb-test-dw2-aranges.patch
a8223e
a8223e
;; [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp.
a8223e
;;=fedoratest
a8223e
a8223e
[archer-tromey-delayed-symfile]
a8223e
a8223e
commit 77fa7778a37b0d28a7e4e5235f074a10ecf1815d
a8223e
Author: Jan Kratochvil <jkratoch@host1.dyn.jankratochvil.net>
a8223e
Date:   Sat Aug 15 15:05:54 2009 +0200
a8223e
a8223e
    Test for "handle incorrect aranges".
a8223e
a8223e
    readelf:
a8223e
    Contents of the .debug_aranges section:
a8223e
a8223e
      Length:                   8
a8223e
      Version:                  2
a8223e
      Offset into .debug_info:  0x0
a8223e
      Pointer Size:             0
a8223e
      Segment Size:             0
a8223e
a8223e
        Address    Length
a8223e
    Floating point exception
a8223e
a8223e
    	* gdb.dwarf2/dw2-aranges.exp, gdb.dwarf2/dw2-aranges.S: New files.
a8223e
a8223e
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
a8223e
@@ -0,0 +1,140 @@
a8223e
+/* This testcase is part of GDB, the GNU debugger.
a8223e
+
a8223e
+   Copyright 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
a8223e
+
a8223e
+   This program is free software; you can redistribute it and/or modify
a8223e
+   it under the terms of the GNU General Public License as published by
a8223e
+   the Free Software Foundation; either version 3 of the License, or
a8223e
+   (at your option) any later version.
a8223e
+
a8223e
+   This program is distributed in the hope that it will be useful,
a8223e
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
a8223e
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a8223e
+   GNU General Public License for more details.
a8223e
+
a8223e
+   You should have received a copy of the GNU General Public License
a8223e
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
a8223e
+
a8223e
+/* Test .debug_aranges containing zero address_size.  */
a8223e
+
a8223e
+/* Dummy function to provide debug information for.  */
a8223e
+
a8223e
+	.text
a8223e
+.Lbegin_text1:
a8223e
+	.globl main
a8223e
+	.type main, %function
a8223e
+main:
a8223e
+.Lbegin_main:
a8223e
+	.int 0
a8223e
+.Lend_main:
a8223e
+	.size main, .-main
a8223e
+.Lend_text1:
a8223e
+
a8223e
+/* Debug information */
a8223e
+
a8223e
+	.section .debug_info
a8223e
+.Lcu1_begin:
a8223e
+	/* CU header */
a8223e
+	.4byte	.Lcu1_end - .Lcu1_start		/* Length of Compilation Unit */
a8223e
+.Lcu1_start:
a8223e
+	.2byte	2				/* DWARF Version */
a8223e
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
a8223e
+	.byte	4				/* Pointer size */
a8223e
+
a8223e
+	/* CU die */
a8223e
+	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
a8223e
+	.4byte	.Lend_text1			/* DW_AT_high_pc */
a8223e
+	.4byte	.Lbegin_text1			/* DW_AT_low_pc */
a8223e
+	.ascii	"file1.txt\0"			/* DW_AT_name */
a8223e
+	.ascii	"GNU C 3.3.3\0"			/* DW_AT_producer */
a8223e
+	.byte	1				/* DW_AT_language (C) */
a8223e
+
a8223e
+	/* main */
a8223e
+	.uleb128	2			/* Abbrev: DW_TAG_subprogram */
a8223e
+	.byte		1			/* DW_AT_external */
a8223e
+	.byte		1			/* DW_AT_decl_file */
a8223e
+	.byte		2			/* DW_AT_decl_line */
a8223e
+	.ascii		"main\0"		/* DW_AT_name */
a8223e
+	.4byte		.Ltype_int-.Lcu1_begin	/* DW_AT_type */
a8223e
+	.4byte		.Lbegin_main	/* DW_AT_low_pc */
a8223e
+	.4byte		.Lend_main		/* DW_AT_high_pc */
a8223e
+	.byte		1			/* DW_AT_frame_base: length */
a8223e
+	.byte		0x55			/* DW_AT_frame_base: DW_OP_reg5 */
a8223e
+
a8223e
+.Ltype_int:
a8223e
+	.uleb128	3			/* Abbrev: DW_TAG_base_type */
a8223e
+	.ascii		"int\0"			/* DW_AT_name */
a8223e
+	.byte		4			/* DW_AT_byte_size */
a8223e
+	.byte		5			/* DW_AT_encoding */
a8223e
+
a8223e
+	.byte		0			/* End of children of CU */
a8223e
+
a8223e
+.Lcu1_end:
a8223e
+
a8223e
+/* Abbrev table */
a8223e
+	.section .debug_abbrev
a8223e
+.Labbrev1_begin:
a8223e
+	.uleb128	1			/* Abbrev code */
a8223e
+	.uleb128	0x11			/* DW_TAG_compile_unit */
a8223e
+	.byte		1			/* has_children */
a8223e
+	.uleb128	0x12			/* DW_AT_high_pc */
a8223e
+	.uleb128	0x1			/* DW_FORM_addr */
a8223e
+	.uleb128	0x11			/* DW_AT_low_pc */
a8223e
+	.uleb128	0x1			/* DW_FORM_addr */
a8223e
+	.uleb128	0x3			/* DW_AT_name */
a8223e
+	.uleb128	0x8			/* DW_FORM_string */
a8223e
+	.uleb128	0x25			/* DW_AT_producer */
a8223e
+	.uleb128	0x8			/* DW_FORM_string */
a8223e
+	.uleb128	0x13			/* DW_AT_language */
a8223e
+	.uleb128	0xb			/* DW_FORM_data1 */
a8223e
+	.byte		0x0			/* Terminator */
a8223e
+	.byte		0x0			/* Terminator */
a8223e
+
a8223e
+	.uleb128	2			/* Abbrev code */
a8223e
+	.uleb128	0x2e			/* DW_TAG_subprogram */
a8223e
+	.byte		0			/* has_children */
a8223e
+	.uleb128	0x3f			/* DW_AT_external */
a8223e
+	.uleb128	0xc			/* DW_FORM_flag */
a8223e
+	.uleb128	0x3a			/* DW_AT_decl_file */
a8223e
+	.uleb128	0xb			/* DW_FORM_data1 */
a8223e
+	.uleb128	0x3b			/* DW_AT_decl_line */
a8223e
+	.uleb128	0xb			/* DW_FORM_data1 */
a8223e
+	.uleb128	0x3			/* DW_AT_name */
a8223e
+	.uleb128	0x8			/* DW_FORM_string */
a8223e
+	.uleb128	0x49			/* DW_AT_type */
a8223e
+	.uleb128	0x13			/* DW_FORM_ref4 */
a8223e
+	.uleb128	0x11			/* DW_AT_low_pc */
a8223e
+	.uleb128	0x1			/* DW_FORM_addr */
a8223e
+	.uleb128	0x12			/* DW_AT_high_pc */
a8223e
+	.uleb128	0x1			/* DW_FORM_addr */
a8223e
+	.uleb128	0x40			/* DW_AT_frame_base */
a8223e
+	.uleb128	0xa			/* DW_FORM_block1 */
a8223e
+	.byte		0x0			/* Terminator */
a8223e
+	.byte		0x0			/* Terminator */
a8223e
+
a8223e
+	.uleb128	3			/* Abbrev code */
a8223e
+	.uleb128	0x24			/* DW_TAG_base_type */
a8223e
+	.byte		0			/* has_children */
a8223e
+	.uleb128	0x3			/* DW_AT_name */
a8223e
+	.uleb128	0x8			/* DW_FORM_string */
a8223e
+	.uleb128	0xb			/* DW_AT_byte_size */
a8223e
+	.uleb128	0xb			/* DW_FORM_data1 */
a8223e
+	.uleb128	0x3e			/* DW_AT_encoding */
a8223e
+	.uleb128	0xb			/* DW_FORM_data1 */
a8223e
+	.byte		0x0			/* Terminator */
a8223e
+	.byte		0x0			/* Terminator */
a8223e
+
a8223e
+	.byte		0x0			/* Terminator */
a8223e
+	.byte		0x0			/* Terminator */
a8223e
+
a8223e
+/* aranges table */
a8223e
+	.section .debug_aranges
a8223e
+	.long	.Laranges_end - 1f
a8223e
+1:
a8223e
+	.2byte	2				/* aranges Version */
a8223e
+	.4byte	.Lcu1_begin - .debug_info	/* Offset into .debug_info section */
a8223e
+	/* The GDB crasher is this zero value.  */
a8223e
+	.byte		0			/* aranges address_size */
a8223e
+	.byte		0			/* aranges segment_size */
a8223e
+
a8223e
+.Laranges_end:
a8223e
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
a8223e
@@ -0,0 +1,40 @@
a8223e
+# Copyright 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
a8223e
+
a8223e
+# This program is free software; you can redistribute it and/or modify
a8223e
+# it under the terms of the GNU General Public License as published by
a8223e
+# the Free Software Foundation; either version 3 of the License, or
a8223e
+# (at your option) any later version.
a8223e
+#
a8223e
+# This program is distributed in the hope that it will be useful,
a8223e
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
a8223e
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a8223e
+# GNU General Public License for more details.
a8223e
+#
a8223e
+# You should have received a copy of the GNU General Public License
a8223e
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
a8223e
+
a8223e
+# Test .debug_aranges containing zero address_size.
a8223e
+
a8223e
+# This test can only be run on targets which support DWARF-2 and use gas.
a8223e
+# For now pick a sampling of likely targets.
a8223e
+if {![istarget *-*-linux*]
a8223e
+    && ![istarget *-*-gnu*]
a8223e
+    && ![istarget *-*-elf*]
a8223e
+    && ![istarget *-*-openbsd*]
a8223e
+    && ![istarget arm-*-eabi*]
a8223e
+    && ![istarget powerpc-*-eabi*]} {
a8223e
+    return 0
a8223e
+}
a8223e
+
a8223e
+set testfile "dw2-aranges"
a8223e
+set srcfile ${testfile}.S
a8223e
+set binfile [standard_output_file ${testfile}]
a8223e
+
a8223e
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {nodebug}] != "" } {
a8223e
+    return -1
a8223e
+}
a8223e
+
a8223e
+clean_restart $testfile
a8223e
+
a8223e
+# Failed gdb_load would abort the testcase execution earlier.
a8223e
+pass "file loaded"