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

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