]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-test-dw2-aranges.patch
- updated (performance fixes).
[packages/gdb.git] / gdb-test-dw2-aranges.patch
CommitLineData
6ed6bacf
AM
1[archer-tromey-delayed-symfile]
2
3commit 77fa7778a37b0d28a7e4e5235f074a10ecf1815d
4Author: Jan Kratochvil <jkratoch@host1.dyn.jankratochvil.net>
5Date: Sat Aug 15 15:05:54 2009 +0200
6
7 Test for "handle incorrect aranges".
8
9 readelf:
10 Contents of the .debug_aranges section:
11
12 Length: 8
13 Version: 2
14 Offset into .debug_info: 0x0
15 Pointer Size: 0
16 Segment Size: 0
17
18 Address Length
19 Floating point exception
20
21 * gdb.dwarf2/dw2-aranges.exp, gdb.dwarf2/dw2-aranges.S: New files.
22
23diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
24new file mode 100644
25index 0000000..d5b9ca5a
26--- /dev/null
27+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
28@@ -0,0 +1,140 @@
29+/* This testcase is part of GDB, the GNU debugger.
30+
31+ Copyright 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
32+
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.
37+
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.
42+
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/>. */
45+
46+/* Test .debug_aranges containing zero address_size. */
47+
48+/* Dummy function to provide debug information for. */
49+
50+ .text
51+.Lbegin_text1:
52+ .globl main
53+ .type main, %function
54+main:
55+.Lbegin_main:
56+ .int 0
57+.Lend_main:
58+ .size main, .-main
59+.Lend_text1:
60+
61+/* Debug information */
62+
63+ .section .debug_info
64+.Lcu1_begin:
65+ /* CU header */
66+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
67+.Lcu1_start:
68+ .2byte 2 /* DWARF Version */
69+ .4byte .Labbrev1_begin /* Offset into abbrev section */
70+ .byte 4 /* Pointer size */
71+
72+ /* CU die */
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) */
79+
80+ /* main */
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 */
91+
92+.Ltype_int:
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 */
97+
98+ .byte 0 /* End of children of CU */
99+
100+.Lcu1_end:
101+
102+/* Abbrev table */
103+ .section .debug_abbrev
104+.Labbrev1_begin:
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 */
120+
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 */
142+
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 */
154+
155+ .byte 0x0 /* Terminator */
156+ .byte 0x0 /* Terminator */
157+
158+/* aranges table */
159+ .section .debug_aranges
160+ .long .Laranges_end - 1f
161+1:
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 */
167+
168+.Laranges_end:
169diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
170new file mode 100644
171index 0000000..39632d5
172--- /dev/null
173+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
174@@ -0,0 +1,40 @@
175+# Copyright 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
176+
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.
181+#
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.
186+#
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/>.
189+
190+# Test .debug_aranges containing zero address_size.
191+
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*]} {
200+ return 0
201+}
202+
203+set testfile "dw2-aranges"
204+set srcfile ${testfile}.S
205+set binfile ${objdir}/${subdir}/${testfile}
206+
207+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {nodebug}] != "" } {
208+ return -1
209+}
210+
211+clean_restart $testfile
212+
213+# Failed gdb_load would abort the testcase execution earlier.
214+pass "file loaded"
This page took 0.159047 seconds and 4 git commands to generate.