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

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