1 # Copyright 1997, 1998, 1999, 2003, 2004, 2007, 2008
2 # Free Software Foundation, Inc.
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.
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.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Written by Satish Pai <pai@apollo.hp.com> 1997-07-07
18 # In the spirit of constvars.exp: added volatile, const-volatile stuff.
20 # This file is part of the gdb testsuite
23 # pointers to 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.
38 # test running programs
43 # Use the same test program constvars.c.
45 set testfile "constvars"
46 set srcfile ${testfile}.c
47 set binfile ${objdir}/${subdir}/${testfile}
49 # Create and source the file that provides information about the compiler
50 # used to compile the test case.
51 if [get_compiler_info ${binfile}] {
55 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug ] != "" } {
62 gdb_reinitialize_dir $srcdir/$subdir
66 # set it up at a breakpoint so we can play with the variable values
68 if ![runto_main] then {
69 perror "couldn't run to breakpoint"
75 # Many tests xfail with gcc 2 -gstabs+.
76 # TODO: check out the hp side of this.
78 proc local_compiler_xfail_check { } {
79 if { [test_compiler_info gcc-2-*] } then {
80 if { ![test_debug_format "HP"] \
81 && ![test_debug_format "DWARF 2"] } then {
87 if { $hp_cc_compiler } {
88 setup_xfail "hppa*-*-hpux*"
92 # A few tests still xfail with gcc 3 -gstabs+ and gcc 4 -gstabs+.
94 proc local_compiler_xfail_check_2 { } {
95 if { [test_compiler_info gcc-3-*] || [test_compiler_info gcc-4-*] } {
96 if { [test_debug_format "stabs" ] } {
102 send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
106 -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
109 -re ".*$gdb_prompt $" {}
110 timeout { fail "up from marker1" }
113 -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
114 fail "continue to marker1 (demangling)"
117 -re ".*$gdb_prompt $" {}
118 timeout { fail "up from marker1" }
121 -re "$gdb_prompt $" { fail "continue to marker1" }
122 timeout { fail "(timeout) continue to marker1" }
125 # As of Feb 1999, GCC does not issue info about volatility of vars, so
126 # these tests are all expected to fail if GCC is the compiler. -sts
128 local_compiler_xfail_check
129 gdb_test "ptype vox" "type = volatile char.*"
131 local_compiler_xfail_check
132 gdb_test "ptype victuals" "type = volatile unsigned char.*"
134 local_compiler_xfail_check
135 gdb_test "ptype vixen" "type = volatile short.*"
137 local_compiler_xfail_check
138 gdb_test "ptype vitriol" "type = volatile (unsigned short|short unsigned)( int)?.*"
140 local_compiler_xfail_check
141 gdb_test "ptype vellum" "type = volatile long.*"
143 local_compiler_xfail_check
144 gdb_test "ptype valve" "type = volatile (unsigned long|long unsigned)( int)?.*"
146 local_compiler_xfail_check
147 gdb_test "ptype vacuity" "type = volatile float.*"
149 local_compiler_xfail_check
150 gdb_test "ptype vertigo" "type = volatile double.*"
152 local_compiler_xfail_check
153 gdb_test "ptype vampire" "type = volatile char \\*.*"
155 local_compiler_xfail_check
156 gdb_test "ptype viper" "type = volatile unsigned char \\*.*"
158 local_compiler_xfail_check
159 gdb_test "ptype vigour" "type = volatile short( int)? \\*.*"
161 local_compiler_xfail_check
162 gdb_test "ptype vapour" "type = volatile (unsigned short|short unsigned)( int)? \\*.*"
164 local_compiler_xfail_check
165 gdb_test "ptype ventricle" "type = volatile long( int)? \\*.*"
167 local_compiler_xfail_check
168 gdb_test "ptype vigintillion" "type = volatile (unsigned long|long unsigned)( int)? \\*.*"
170 local_compiler_xfail_check
171 gdb_test "ptype vocation" "type = volatile float \\*.*"
173 local_compiler_xfail_check
174 gdb_test "ptype veracity" "type = volatile double \\*.*"
176 local_compiler_xfail_check
177 gdb_test "ptype vapidity" "type = volatile char \\* volatile.*"
179 local_compiler_xfail_check
180 gdb_test "ptype velocity" "type = volatile unsigned char \\* volatile.*"
182 local_compiler_xfail_check
183 gdb_test "ptype veneer" "type = volatile short( int)? \\* volatile.*"
185 local_compiler_xfail_check
186 gdb_test "ptype video" "type = volatile (unsigned short|short unsigned)( int) \\* volatile.*"
188 local_compiler_xfail_check
189 gdb_test "ptype vacuum" "type = volatile long( int)? \\* volatile.*"
191 local_compiler_xfail_check
192 gdb_test "ptype veniality" "type = volatile (unsigned long|long unsigned)( int)? \\* volatile.*"
194 local_compiler_xfail_check
195 gdb_test "ptype vitality" "type = volatile float \\* volatile.*"
197 local_compiler_xfail_check
198 gdb_test "ptype voracity" "type = volatile double \\* volatile.*"
200 local_compiler_xfail_check
201 gdb_test "ptype victor" "type = const volatile char.*"
203 local_compiler_xfail_check
204 gdb_test "ptype vicar" "type = const volatile unsigned char.*"
206 local_compiler_xfail_check
207 gdb_test "ptype victory" "type = const volatile char \\*.*"
209 local_compiler_xfail_check
210 gdb_test "ptype vicarage" "type = const volatile unsigned char \\*.*"
212 local_compiler_xfail_check
213 gdb_test "ptype vein" "type = volatile char \\* const.*"
215 local_compiler_xfail_check
216 gdb_test "ptype vogue" "type = volatile unsigned char \\* const.*"
218 local_compiler_xfail_check
219 gdb_test "ptype cavern" "type = const volatile char \\* const.*"
221 local_compiler_xfail_check
222 gdb_test "ptype coverlet" "type = const volatile unsigned char \\* const.*"
224 local_compiler_xfail_check
225 gdb_test "ptype caveat" "type = const char \\* volatile.*"
227 local_compiler_xfail_check
228 gdb_test "ptype covenant" "type = const unsigned char \\* volatile.*"
230 local_compiler_xfail_check
231 gdb_test "ptype vizier" "type = const volatile char \\* volatile.*"
233 local_compiler_xfail_check
234 gdb_test "ptype vanadium" "type = const volatile unsigned char \\* volatile.*"
236 local_compiler_xfail_check
237 gdb_test "ptype vane" "type = char \\* const volatile.*"
239 local_compiler_xfail_check
240 gdb_test "ptype veldt" "type = unsigned char \\* const volatile.*"
242 local_compiler_xfail_check
243 gdb_test "ptype cove" "type = const char \\* const volatile.*"
245 local_compiler_xfail_check
246 gdb_test "ptype cavity" "type = const unsigned char \\* const volatile.*"
248 local_compiler_xfail_check
249 gdb_test "ptype vagus" "type = volatile char \\* const volatile.*"
251 local_compiler_xfail_check
252 gdb_test "ptype vagrancy" "type = volatile unsigned char \\* const volatile.*"
254 local_compiler_xfail_check
255 gdb_test "ptype vagary" "type = const volatile char \\* const volatile.*"
257 local_compiler_xfail_check
258 gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.*"
260 # test function parameters
261 local_compiler_xfail_check
262 local_compiler_xfail_check_2
263 send_gdb "ptype qux2\n"
265 -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 $" {
268 -re ".*$gdb_prompt $" { fail "ptype qux2" }
269 timeout { fail "(timeout) ptype qux2" }