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

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