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

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