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

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