1 [archer-tromey-delayed-symfile]
3 commit 77fa7778a37b0d28a7e4e5235f074a10ecf1815d
4 Author: Jan Kratochvil <jkratoch@host1.dyn.jankratochvil.net>
5 Date: Sat Aug 15 15:05:54 2009 +0200
7 Test for "handle incorrect aranges".
10 Contents of the .debug_aranges section:
14 Offset into .debug_info: 0x0
19 Floating point exception
21 * gdb.dwarf2/dw2-aranges.exp, gdb.dwarf2/dw2-aranges.S: New files.
23 diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
25 index 0000000..d5b9ca5a
27 +++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
29 +/* This testcase is part of GDB, the GNU debugger.
31 + Copyright 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
33 + This program is free software; you can redistribute it and/or modify
34 + it under the terms of the GNU General Public License as published by
35 + the Free Software Foundation; either version 3 of the License, or
36 + (at your option) any later version.
38 + This program is distributed in the hope that it will be useful,
39 + but WITHOUT ANY WARRANTY; without even the implied warranty of
40 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41 + GNU General Public License for more details.
43 + You should have received a copy of the GNU General Public License
44 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
46 +/* Test .debug_aranges containing zero address_size. */
48 +/* Dummy function to provide debug information for. */
53 + .type main, %function
61 +/* Debug information */
63 + .section .debug_info
66 + .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
68 + .2byte 2 /* DWARF Version */
69 + .4byte .Labbrev1_begin /* Offset into abbrev section */
70 + .byte 4 /* Pointer size */
73 + .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
74 + .4byte .Lend_text1 /* DW_AT_high_pc */
75 + .4byte .Lbegin_text1 /* DW_AT_low_pc */
76 + .ascii "file1.txt\0" /* DW_AT_name */
77 + .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
78 + .byte 1 /* DW_AT_language (C) */
81 + .uleb128 2 /* Abbrev: DW_TAG_subprogram */
82 + .byte 1 /* DW_AT_external */
83 + .byte 1 /* DW_AT_decl_file */
84 + .byte 2 /* DW_AT_decl_line */
85 + .ascii "main\0" /* DW_AT_name */
86 + .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
87 + .4byte .Lbegin_main /* DW_AT_low_pc */
88 + .4byte .Lend_main /* DW_AT_high_pc */
89 + .byte 1 /* DW_AT_frame_base: length */
90 + .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */
93 + .uleb128 3 /* Abbrev: DW_TAG_base_type */
94 + .ascii "int\0" /* DW_AT_name */
95 + .byte 4 /* DW_AT_byte_size */
96 + .byte 5 /* DW_AT_encoding */
98 + .byte 0 /* End of children of CU */
103 + .section .debug_abbrev
105 + .uleb128 1 /* Abbrev code */
106 + .uleb128 0x11 /* DW_TAG_compile_unit */
107 + .byte 1 /* has_children */
108 + .uleb128 0x12 /* DW_AT_high_pc */
109 + .uleb128 0x1 /* DW_FORM_addr */
110 + .uleb128 0x11 /* DW_AT_low_pc */
111 + .uleb128 0x1 /* DW_FORM_addr */
112 + .uleb128 0x3 /* DW_AT_name */
113 + .uleb128 0x8 /* DW_FORM_string */
114 + .uleb128 0x25 /* DW_AT_producer */
115 + .uleb128 0x8 /* DW_FORM_string */
116 + .uleb128 0x13 /* DW_AT_language */
117 + .uleb128 0xb /* DW_FORM_data1 */
118 + .byte 0x0 /* Terminator */
119 + .byte 0x0 /* Terminator */
121 + .uleb128 2 /* Abbrev code */
122 + .uleb128 0x2e /* DW_TAG_subprogram */
123 + .byte 0 /* has_children */
124 + .uleb128 0x3f /* DW_AT_external */
125 + .uleb128 0xc /* DW_FORM_flag */
126 + .uleb128 0x3a /* DW_AT_decl_file */
127 + .uleb128 0xb /* DW_FORM_data1 */
128 + .uleb128 0x3b /* DW_AT_decl_line */
129 + .uleb128 0xb /* DW_FORM_data1 */
130 + .uleb128 0x3 /* DW_AT_name */
131 + .uleb128 0x8 /* DW_FORM_string */
132 + .uleb128 0x49 /* DW_AT_type */
133 + .uleb128 0x13 /* DW_FORM_ref4 */
134 + .uleb128 0x11 /* DW_AT_low_pc */
135 + .uleb128 0x1 /* DW_FORM_addr */
136 + .uleb128 0x12 /* DW_AT_high_pc */
137 + .uleb128 0x1 /* DW_FORM_addr */
138 + .uleb128 0x40 /* DW_AT_frame_base */
139 + .uleb128 0xa /* DW_FORM_block1 */
140 + .byte 0x0 /* Terminator */
141 + .byte 0x0 /* Terminator */
143 + .uleb128 3 /* Abbrev code */
144 + .uleb128 0x24 /* DW_TAG_base_type */
145 + .byte 0 /* has_children */
146 + .uleb128 0x3 /* DW_AT_name */
147 + .uleb128 0x8 /* DW_FORM_string */
148 + .uleb128 0xb /* DW_AT_byte_size */
149 + .uleb128 0xb /* DW_FORM_data1 */
150 + .uleb128 0x3e /* DW_AT_encoding */
151 + .uleb128 0xb /* DW_FORM_data1 */
152 + .byte 0x0 /* Terminator */
153 + .byte 0x0 /* Terminator */
155 + .byte 0x0 /* Terminator */
156 + .byte 0x0 /* Terminator */
159 + .section .debug_aranges
160 + .long .Laranges_end - 1f
162 + .2byte 2 /* aranges Version */
163 + .4byte .Lcu1_begin - .debug_info /* Offset into .debug_info section */
164 + /* The GDB crasher is this zero value. */
165 + .byte 0 /* aranges address_size */
166 + .byte 0 /* aranges segment_size */
169 diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
171 index 0000000..39632d5
173 +++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
175 +# Copyright 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
177 +# This program is free software; you can redistribute it and/or modify
178 +# it under the terms of the GNU General Public License as published by
179 +# the Free Software Foundation; either version 3 of the License, or
180 +# (at your option) any later version.
182 +# This program is distributed in the hope that it will be useful,
183 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
184 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
185 +# GNU General Public License for more details.
187 +# You should have received a copy of the GNU General Public License
188 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
190 +# Test .debug_aranges containing zero address_size.
192 +# This test can only be run on targets which support DWARF-2 and use gas.
193 +# For now pick a sampling of likely targets.
194 +if {![istarget *-*-linux*]
195 + && ![istarget *-*-gnu*]
196 + && ![istarget *-*-elf*]
197 + && ![istarget *-*-openbsd*]
198 + && ![istarget arm-*-eabi*]
199 + && ![istarget powerpc-*-eabi*]} {
203 +set testfile "dw2-aranges"
204 +set srcfile ${testfile}.S
205 +set binfile ${objdir}/${subdir}/${testfile}
207 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {nodebug}] != "" } {
211 +clean_restart $testfile
213 +# Failed gdb_load would abort the testcase execution earlier.