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

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