1 |
227 |
jeremybenn |
# Copyright 1997, 1998, 1999, 2003, 2004, 2007, 2008, 2009, 2010
|
2 |
|
|
# Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
# This program is free software; you can redistribute it and/or modify
|
5 |
|
|
# it under the terms of the GNU General Public License as published by
|
6 |
|
|
# the Free Software Foundation; either version 3 of the License, or
|
7 |
|
|
# (at your option) any later version.
|
8 |
|
|
#
|
9 |
|
|
# This program is distributed in the hope that it will be useful,
|
10 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
# GNU General Public License for more details.
|
13 |
|
|
#
|
14 |
|
|
# You should have received a copy of the GNU General Public License
|
15 |
|
|
# along with this program. If not, see .
|
16 |
|
|
|
17 |
|
|
# Written by Satish Pai 1997-07-07
|
18 |
|
|
# In the spirit of constvars.exp: added volatile, const-volatile stuff.
|
19 |
|
|
|
20 |
|
|
# This file is part of the gdb testsuite
|
21 |
|
|
# Tests for:
|
22 |
|
|
# volatile vars
|
23 |
|
|
# pointers to volatile vars
|
24 |
|
|
# const volatile vars
|
25 |
|
|
# pointers to const volatile vars
|
26 |
|
|
# const pointers to volatile vars
|
27 |
|
|
# volatile pointers to const vars
|
28 |
|
|
# const volatile pointers to const vars
|
29 |
|
|
# const volatile pointers to volatile vars
|
30 |
|
|
# ... etc. (you get the idea)
|
31 |
|
|
# Mostly with char and unsigned char.
|
32 |
|
|
|
33 |
|
|
if $tracelevel then {
|
34 |
|
|
strace $tracelevel
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
#
|
38 |
|
|
# test running programs
|
39 |
|
|
#
|
40 |
|
|
set prms_id 0
|
41 |
|
|
set bug_id 0
|
42 |
|
|
|
43 |
|
|
# Use the same test program constvars.c.
|
44 |
|
|
|
45 |
|
|
if { [prepare_for_testing volatile.exp volatile constvars.c] } {
|
46 |
|
|
return -1
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
# Create and source the file that provides information about the compiler
|
50 |
|
|
# used to compile the test case.
|
51 |
|
|
if [get_compiler_info not-used] {
|
52 |
|
|
return -1;
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
#
|
56 |
|
|
# set it up at a breakpoint so we can play with the variable values
|
57 |
|
|
#
|
58 |
|
|
if ![runto_main] then {
|
59 |
|
|
perror "couldn't run to breakpoint"
|
60 |
|
|
continue
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
get_debug_format
|
64 |
|
|
|
65 |
|
|
# Many tests xfail with gcc 2 -gstabs+.
|
66 |
|
|
# TODO: check out the hp side of this.
|
67 |
|
|
|
68 |
|
|
proc local_compiler_xfail_check { } {
|
69 |
|
|
if { [test_compiler_info gcc-2-*] } then {
|
70 |
|
|
if { ![test_debug_format "HP"] \
|
71 |
|
|
&& ![test_debug_format "DWARF 2"] } then {
|
72 |
|
|
setup_xfail "*-*-*"
|
73 |
|
|
}
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
global hp_cc_compiler
|
77 |
|
|
if { $hp_cc_compiler } {
|
78 |
|
|
setup_xfail "hppa*-*-hpux*"
|
79 |
|
|
}
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
# A few tests still xfail with gcc 3 -gstabs+ and gcc 4 -gstabs+.
|
83 |
|
|
|
84 |
|
|
proc local_compiler_xfail_check_2 { } {
|
85 |
|
|
if { [test_compiler_info gcc-3-*] || [test_compiler_info gcc-4-*] } {
|
86 |
|
|
if { [test_debug_format "stabs" ] } {
|
87 |
|
|
setup_xfail "*-*-*"
|
88 |
|
|
}
|
89 |
|
|
}
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
|
93 |
|
|
|
94 |
|
|
send_gdb "cont\n"
|
95 |
|
|
gdb_expect {
|
96 |
|
|
-re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
|
97 |
|
|
send_gdb "up\n"
|
98 |
|
|
gdb_expect {
|
99 |
|
|
-re ".*$gdb_prompt $" {}
|
100 |
|
|
timeout { fail "up from marker1" }
|
101 |
|
|
}
|
102 |
|
|
}
|
103 |
|
|
-re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
|
104 |
|
|
fail "continue to marker1 (demangling)"
|
105 |
|
|
send_gdb "up\n"
|
106 |
|
|
gdb_expect {
|
107 |
|
|
-re ".*$gdb_prompt $" {}
|
108 |
|
|
timeout { fail "up from marker1" }
|
109 |
|
|
}
|
110 |
|
|
}
|
111 |
|
|
-re "$gdb_prompt $" { fail "continue to marker1" }
|
112 |
|
|
timeout { fail "(timeout) continue to marker1" }
|
113 |
|
|
}
|
114 |
|
|
|
115 |
|
|
# As of Feb 1999, GCC does not issue info about volatility of vars, so
|
116 |
|
|
# these tests are all expected to fail if GCC is the compiler. -sts
|
117 |
|
|
|
118 |
|
|
local_compiler_xfail_check
|
119 |
|
|
gdb_test "ptype vox" "type = volatile char.*"
|
120 |
|
|
|
121 |
|
|
local_compiler_xfail_check
|
122 |
|
|
gdb_test "ptype victuals" "type = volatile unsigned char.*"
|
123 |
|
|
|
124 |
|
|
local_compiler_xfail_check
|
125 |
|
|
gdb_test "ptype vixen" "type = volatile short.*"
|
126 |
|
|
|
127 |
|
|
local_compiler_xfail_check
|
128 |
|
|
gdb_test "ptype vitriol" "type = volatile (unsigned short|short unsigned)( int)?.*"
|
129 |
|
|
|
130 |
|
|
local_compiler_xfail_check
|
131 |
|
|
gdb_test "ptype vellum" "type = volatile long.*"
|
132 |
|
|
|
133 |
|
|
local_compiler_xfail_check
|
134 |
|
|
gdb_test "ptype valve" "type = volatile (unsigned long|long unsigned)( int)?.*"
|
135 |
|
|
|
136 |
|
|
local_compiler_xfail_check
|
137 |
|
|
gdb_test "ptype vacuity" "type = volatile float.*"
|
138 |
|
|
|
139 |
|
|
local_compiler_xfail_check
|
140 |
|
|
gdb_test "ptype vertigo" "type = volatile double.*"
|
141 |
|
|
|
142 |
|
|
local_compiler_xfail_check
|
143 |
|
|
gdb_test "ptype vampire" "type = volatile char \\*.*"
|
144 |
|
|
|
145 |
|
|
local_compiler_xfail_check
|
146 |
|
|
gdb_test "ptype viper" "type = volatile unsigned char \\*.*"
|
147 |
|
|
|
148 |
|
|
local_compiler_xfail_check
|
149 |
|
|
gdb_test "ptype vigour" "type = volatile short( int)? \\*.*"
|
150 |
|
|
|
151 |
|
|
local_compiler_xfail_check
|
152 |
|
|
gdb_test "ptype vapour" "type = volatile (unsigned short|short unsigned)( int)? \\*.*"
|
153 |
|
|
|
154 |
|
|
local_compiler_xfail_check
|
155 |
|
|
gdb_test "ptype ventricle" "type = volatile long( int)? \\*.*"
|
156 |
|
|
|
157 |
|
|
local_compiler_xfail_check
|
158 |
|
|
gdb_test "ptype vigintillion" "type = volatile (unsigned long|long unsigned)( int)? \\*.*"
|
159 |
|
|
|
160 |
|
|
local_compiler_xfail_check
|
161 |
|
|
gdb_test "ptype vocation" "type = volatile float \\*.*"
|
162 |
|
|
|
163 |
|
|
local_compiler_xfail_check
|
164 |
|
|
gdb_test "ptype veracity" "type = volatile double \\*.*"
|
165 |
|
|
|
166 |
|
|
local_compiler_xfail_check
|
167 |
|
|
gdb_test "ptype vapidity" "type = volatile char \\* volatile.*"
|
168 |
|
|
|
169 |
|
|
local_compiler_xfail_check
|
170 |
|
|
gdb_test "ptype velocity" "type = volatile unsigned char \\* volatile.*"
|
171 |
|
|
|
172 |
|
|
local_compiler_xfail_check
|
173 |
|
|
gdb_test "ptype veneer" "type = volatile short( int)? \\* volatile.*"
|
174 |
|
|
|
175 |
|
|
local_compiler_xfail_check
|
176 |
|
|
gdb_test "ptype video" "type = volatile (unsigned short|short unsigned)( int) \\* volatile.*"
|
177 |
|
|
|
178 |
|
|
local_compiler_xfail_check
|
179 |
|
|
gdb_test "ptype vacuum" "type = volatile long( int)? \\* volatile.*"
|
180 |
|
|
|
181 |
|
|
local_compiler_xfail_check
|
182 |
|
|
gdb_test "ptype veniality" "type = volatile (unsigned long|long unsigned)( int)? \\* volatile.*"
|
183 |
|
|
|
184 |
|
|
local_compiler_xfail_check
|
185 |
|
|
gdb_test "ptype vitality" "type = volatile float \\* volatile.*"
|
186 |
|
|
|
187 |
|
|
local_compiler_xfail_check
|
188 |
|
|
gdb_test "ptype voracity" "type = volatile double \\* volatile.*"
|
189 |
|
|
|
190 |
|
|
local_compiler_xfail_check
|
191 |
|
|
gdb_test "ptype victor" "type = const volatile char.*"
|
192 |
|
|
|
193 |
|
|
local_compiler_xfail_check
|
194 |
|
|
gdb_test "ptype vicar" "type = const volatile unsigned char.*"
|
195 |
|
|
|
196 |
|
|
local_compiler_xfail_check
|
197 |
|
|
gdb_test "ptype victory" "type = const volatile char \\*.*"
|
198 |
|
|
|
199 |
|
|
local_compiler_xfail_check
|
200 |
|
|
gdb_test "ptype vicarage" "type = const volatile unsigned char \\*.*"
|
201 |
|
|
|
202 |
|
|
local_compiler_xfail_check
|
203 |
|
|
gdb_test "ptype vein" "type = volatile char \\* const.*"
|
204 |
|
|
|
205 |
|
|
local_compiler_xfail_check
|
206 |
|
|
gdb_test "ptype vogue" "type = volatile unsigned char \\* const.*"
|
207 |
|
|
|
208 |
|
|
local_compiler_xfail_check
|
209 |
|
|
gdb_test "ptype cavern" "type = const volatile char \\* const.*"
|
210 |
|
|
|
211 |
|
|
local_compiler_xfail_check
|
212 |
|
|
gdb_test "ptype coverlet" "type = const volatile unsigned char \\* const.*"
|
213 |
|
|
|
214 |
|
|
local_compiler_xfail_check
|
215 |
|
|
gdb_test "ptype caveat" "type = const char \\* volatile.*"
|
216 |
|
|
|
217 |
|
|
local_compiler_xfail_check
|
218 |
|
|
gdb_test "ptype covenant" "type = const unsigned char \\* volatile.*"
|
219 |
|
|
|
220 |
|
|
local_compiler_xfail_check
|
221 |
|
|
gdb_test "ptype vizier" "type = const volatile char \\* volatile.*"
|
222 |
|
|
|
223 |
|
|
local_compiler_xfail_check
|
224 |
|
|
gdb_test "ptype vanadium" "type = const volatile unsigned char \\* volatile.*"
|
225 |
|
|
|
226 |
|
|
local_compiler_xfail_check
|
227 |
|
|
gdb_test "ptype vane" "type = char \\* const volatile.*"
|
228 |
|
|
|
229 |
|
|
local_compiler_xfail_check
|
230 |
|
|
gdb_test "ptype veldt" "type = unsigned char \\* const volatile.*"
|
231 |
|
|
|
232 |
|
|
local_compiler_xfail_check
|
233 |
|
|
gdb_test "ptype cove" "type = const char \\* const volatile.*"
|
234 |
|
|
|
235 |
|
|
local_compiler_xfail_check
|
236 |
|
|
gdb_test "ptype cavity" "type = const unsigned char \\* const volatile.*"
|
237 |
|
|
|
238 |
|
|
local_compiler_xfail_check
|
239 |
|
|
gdb_test "ptype vagus" "type = volatile char \\* const volatile.*"
|
240 |
|
|
|
241 |
|
|
local_compiler_xfail_check
|
242 |
|
|
gdb_test "ptype vagrancy" "type = volatile unsigned char \\* const volatile.*"
|
243 |
|
|
|
244 |
|
|
local_compiler_xfail_check
|
245 |
|
|
gdb_test "ptype vagary" "type = const volatile char \\* const volatile.*"
|
246 |
|
|
|
247 |
|
|
local_compiler_xfail_check
|
248 |
|
|
gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.*"
|
249 |
|
|
|
250 |
|
|
# test function parameters
|
251 |
|
|
local_compiler_xfail_check
|
252 |
|
|
local_compiler_xfail_check_2
|
253 |
|
|
send_gdb "ptype qux2\n"
|
254 |
|
|
gdb_expect {
|
255 |
|
|
-re "type = int \\(volatile unsigned char, const volatile int, volatile short( int)?, volatile long( int)? \\*, float \\* volatile, const volatile signed char \\* const volatile\\).*$gdb_prompt $" {
|
256 |
|
|
pass "ptype qux2"
|
257 |
|
|
}
|
258 |
|
|
-re ".*$gdb_prompt $" { fail "ptype qux2" }
|
259 |
|
|
timeout { fail "(timeout) ptype qux2" }
|
260 |
|
|
}
|