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

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