Skip to content

Commit 07a8d14

Browse files
ivanivanov884jeffmahoney
authored andcommitted
gdb-test-dw2-aranges.patch
;; [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp. ;;=fedoratest [archer-tromey-delayed-symfile] commit 77fa7778a37b0d28a7e4e5235f074a10ecf1815d Author: Jan Kratochvil <jkratoch@host1.dyn.jankratochvil.net> Date: Sat Aug 15 15:05:54 2009 +0200 Test for "handle incorrect aranges". readelf: Contents of the .debug_aranges section: Length: 8 Version: 2 Offset into .debug_info: 0x0 Pointer Size: 0 Segment Size: 0 Address Length Floating point exception * gdb.dwarf2/dw2-aranges.exp, gdb.dwarf2/dw2-aranges.S: New files.
1 parent ab9cb5e commit 07a8d14

File tree

2 files changed

+180
-0
lines changed

2 files changed

+180
-0
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/* This testcase is part of GDB, the GNU debugger.
2+
3+
Copyright 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
4+
5+
This program is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation; either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program. If not, see <http://www.gnu.org/licenses/>. */
17+
18+
/* Test .debug_aranges containing zero address_size. */
19+
20+
/* Dummy function to provide debug information for. */
21+
22+
.text
23+
.Lbegin_text1:
24+
.globl main
25+
.type main, %function
26+
main:
27+
.Lbegin_main:
28+
.int 0
29+
.Lend_main:
30+
.size main, .-main
31+
.Lend_text1:
32+
33+
/* Debug information */
34+
35+
.section .debug_info
36+
.Lcu1_begin:
37+
/* CU header */
38+
.4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
39+
.Lcu1_start:
40+
.2byte 2 /* DWARF Version */
41+
.4byte .Labbrev1_begin /* Offset into abbrev section */
42+
.byte 4 /* Pointer size */
43+
44+
/* CU die */
45+
.uleb128 1 /* Abbrev: DW_TAG_compile_unit */
46+
.4byte .Lend_text1 /* DW_AT_high_pc */
47+
.4byte .Lbegin_text1 /* DW_AT_low_pc */
48+
.ascii "file1.txt\0" /* DW_AT_name */
49+
.ascii "GNU C 3.3.3\0" /* DW_AT_producer */
50+
.byte 1 /* DW_AT_language (C) */
51+
52+
/* main */
53+
.uleb128 2 /* Abbrev: DW_TAG_subprogram */
54+
.byte 1 /* DW_AT_external */
55+
.byte 1 /* DW_AT_decl_file */
56+
.byte 2 /* DW_AT_decl_line */
57+
.ascii "main\0" /* DW_AT_name */
58+
.4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
59+
.4byte .Lbegin_main /* DW_AT_low_pc */
60+
.4byte .Lend_main /* DW_AT_high_pc */
61+
.byte 1 /* DW_AT_frame_base: length */
62+
.byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */
63+
64+
.Ltype_int:
65+
.uleb128 3 /* Abbrev: DW_TAG_base_type */
66+
.ascii "int\0" /* DW_AT_name */
67+
.byte 4 /* DW_AT_byte_size */
68+
.byte 5 /* DW_AT_encoding */
69+
70+
.byte 0 /* End of children of CU */
71+
72+
.Lcu1_end:
73+
74+
/* Abbrev table */
75+
.section .debug_abbrev
76+
.Labbrev1_begin:
77+
.uleb128 1 /* Abbrev code */
78+
.uleb128 0x11 /* DW_TAG_compile_unit */
79+
.byte 1 /* has_children */
80+
.uleb128 0x12 /* DW_AT_high_pc */
81+
.uleb128 0x1 /* DW_FORM_addr */
82+
.uleb128 0x11 /* DW_AT_low_pc */
83+
.uleb128 0x1 /* DW_FORM_addr */
84+
.uleb128 0x3 /* DW_AT_name */
85+
.uleb128 0x8 /* DW_FORM_string */
86+
.uleb128 0x25 /* DW_AT_producer */
87+
.uleb128 0x8 /* DW_FORM_string */
88+
.uleb128 0x13 /* DW_AT_language */
89+
.uleb128 0xb /* DW_FORM_data1 */
90+
.byte 0x0 /* Terminator */
91+
.byte 0x0 /* Terminator */
92+
93+
.uleb128 2 /* Abbrev code */
94+
.uleb128 0x2e /* DW_TAG_subprogram */
95+
.byte 0 /* has_children */
96+
.uleb128 0x3f /* DW_AT_external */
97+
.uleb128 0xc /* DW_FORM_flag */
98+
.uleb128 0x3a /* DW_AT_decl_file */
99+
.uleb128 0xb /* DW_FORM_data1 */
100+
.uleb128 0x3b /* DW_AT_decl_line */
101+
.uleb128 0xb /* DW_FORM_data1 */
102+
.uleb128 0x3 /* DW_AT_name */
103+
.uleb128 0x8 /* DW_FORM_string */
104+
.uleb128 0x49 /* DW_AT_type */
105+
.uleb128 0x13 /* DW_FORM_ref4 */
106+
.uleb128 0x11 /* DW_AT_low_pc */
107+
.uleb128 0x1 /* DW_FORM_addr */
108+
.uleb128 0x12 /* DW_AT_high_pc */
109+
.uleb128 0x1 /* DW_FORM_addr */
110+
.uleb128 0x40 /* DW_AT_frame_base */
111+
.uleb128 0xa /* DW_FORM_block1 */
112+
.byte 0x0 /* Terminator */
113+
.byte 0x0 /* Terminator */
114+
115+
.uleb128 3 /* Abbrev code */
116+
.uleb128 0x24 /* DW_TAG_base_type */
117+
.byte 0 /* has_children */
118+
.uleb128 0x3 /* DW_AT_name */
119+
.uleb128 0x8 /* DW_FORM_string */
120+
.uleb128 0xb /* DW_AT_byte_size */
121+
.uleb128 0xb /* DW_FORM_data1 */
122+
.uleb128 0x3e /* DW_AT_encoding */
123+
.uleb128 0xb /* DW_FORM_data1 */
124+
.byte 0x0 /* Terminator */
125+
.byte 0x0 /* Terminator */
126+
127+
.byte 0x0 /* Terminator */
128+
.byte 0x0 /* Terminator */
129+
130+
/* aranges table */
131+
.section .debug_aranges
132+
.long .Laranges_end - 1f
133+
1:
134+
.2byte 2 /* aranges Version */
135+
.4byte .Lcu1_begin - .debug_info /* Offset into .debug_info section */
136+
/* The GDB crasher is this zero value. */
137+
.byte 0 /* aranges address_size */
138+
.byte 0 /* aranges segment_size */
139+
140+
.Laranges_end:
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
2+
3+
# This program is free software; you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation; either version 3 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
16+
# Test .debug_aranges containing zero address_size.
17+
18+
# This test can only be run on targets which support DWARF-2 and use gas.
19+
# For now pick a sampling of likely targets.
20+
if {![istarget *-*-linux*]
21+
&& ![istarget *-*-gnu*]
22+
&& ![istarget *-*-elf*]
23+
&& ![istarget *-*-openbsd*]
24+
&& ![istarget arm-*-eabi*]
25+
&& ![istarget powerpc-*-eabi*]} {
26+
return 0
27+
}
28+
29+
set testfile "dw2-aranges"
30+
set srcfile ${testfile}.S
31+
set binfile [standard_output_file ${testfile}]
32+
33+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {nodebug}] != "" } {
34+
return -1
35+
}
36+
37+
clean_restart $testfile
38+
39+
# Failed gdb_load would abort the testcase execution earlier.
40+
pass "file loaded"

0 commit comments

Comments
 (0)