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

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