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

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