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

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