1 # Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
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 2 of the License, or
6 # (at your option) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # Written by Satish Pai <pai@apollo.hp.com> 1997-07-07
21 # In the spirit of constvars.exp: added volatile, const-volatile stuff.
23 # This file is part of the gdb testsuite
26 # pointers to volatile vars
28 # pointers to const volatile vars
29 # const pointers to volatile vars
30 # volatile pointers to const vars
31 # const volatile pointers to const vars
32 # const volatile pointers to volatile vars
33 # ... etc. (you get the idea)
34 # Mostly with char and unsigned char.
41 # test running programs
46 # Use the same test program constvars.c.
48 set testfile "constvars"
49 set srcfile ${testfile}.c
50 set binfile ${objdir}/${subdir}/${testfile}
52 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
53 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
56 remote_exec build "rm -f ${binfile}.ci"
57 if [get_compiler_info ${binfile}] {
63 gdb_reinitialize_dir $srcdir/$subdir
69 # set it up at a breakpoint so we can play with the variable values
71 if ![runto_main] then {
72 perror "couldn't run to breakpoint"
76 send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
80 -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
83 -re ".*$gdb_prompt $" {}
84 timeout { fail "up from marker1" }
87 -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
88 fail "continue to marker1 (demangling)"
91 -re ".*$gdb_prompt $" {}
92 timeout { fail "up from marker1" }
95 -re "$gdb_prompt $" { fail "continue to marker1" }
96 timeout { fail "(timeout) continue to marker1" }
99 # As of Feb 1999, GCC does not issue info about volatility of vars, so
100 # these tests are all expected to fail if GCC is the compiler. -sts
102 if {$gcc_compiled} then { setup_xfail "*-*-*" }
103 gdb_test "ptype vox" "type = volatile char"
105 if {$gcc_compiled} then { setup_xfail "*-*-*" }
106 gdb_test "ptype victuals" "type = volatile unsigned char"
108 if {$gcc_compiled} then { setup_xfail "*-*-*" }
109 gdb_test "ptype vixen" "type = volatile short"
111 if {$gcc_compiled} then { setup_xfail "*-*-*" }
112 gdb_test "ptype vitriol" "type = volatile unsigned short"
114 if {$gcc_compiled} then { setup_xfail "*-*-*" }
115 gdb_test "ptype vellum" "type = volatile long"
117 if {$gcc_compiled} then { setup_xfail "*-*-*" }
118 gdb_test "ptype valve" "type = volatile unsigned long"
120 if {$gcc_compiled} then { setup_xfail "*-*-*" }
121 gdb_test "ptype vacuity" "type = volatile float"
123 if {$gcc_compiled} then { setup_xfail "*-*-*" }
124 gdb_test "ptype vertigo" "type = volatile double"
126 if {$gcc_compiled} then { setup_xfail "*-*-*" }
127 gdb_test "ptype vampire" "type = volatile char *"
129 if {$gcc_compiled} then { setup_xfail "*-*-*" }
130 gdb_test "ptype viper" "type = volatile unsigned char *"
132 if {$gcc_compiled} then { setup_xfail "*-*-*" }
133 gdb_test "ptype vigour" "type = volatile short *"
135 if {$gcc_compiled} then { setup_xfail "*-*-*" }
136 gdb_test "ptype vapour" "type = volatile unsigned short *"
138 if {$gcc_compiled} then { setup_xfail "*-*-*" }
139 gdb_test "ptype ventricle" "type = volatile long *"
141 if {$gcc_compiled} then { setup_xfail "*-*-*" }
142 gdb_test "ptype vigintillion" "type = volatile unsigned long *"
144 if {$gcc_compiled} then { setup_xfail "*-*-*" }
145 gdb_test "ptype vocation" "type = volatile float *"
147 if {$gcc_compiled} then { setup_xfail "*-*-*" }
148 gdb_test "ptype veracity" "type = volatile double *"
150 if {$gcc_compiled} then { setup_xfail "*-*-*" }
151 gdb_test "ptype vapidity" "type = volatile char * volatile"
153 if {$gcc_compiled} then { setup_xfail "*-*-*" }
154 gdb_test "ptype velocity" "type = volatile unsigned char * volatile"
156 if {$gcc_compiled} then { setup_xfail "*-*-*" }
157 gdb_test "ptype veneer" "type = volatile short * volatile"
159 if {$gcc_compiled} then { setup_xfail "*-*-*" }
160 gdb_test "ptype video" "type = volatile unsigned short * volatile"
162 if {$gcc_compiled} then { setup_xfail "*-*-*" }
163 gdb_test "ptype vacuum" "type = volatile long * volatile"
165 if {$gcc_compiled} then { setup_xfail "*-*-*" }
166 gdb_test "ptype veniality" "type = volatile unsigned long * volatile"
168 if {$gcc_compiled} then { setup_xfail "*-*-*" }
169 gdb_test "ptype vitality" "type = volatile float * volatile"
171 if {$gcc_compiled} then { setup_xfail "*-*-*" }
172 gdb_test "ptype voracity" "type = volatile double * volatile"
174 if {$gcc_compiled} then { setup_xfail "*-*-*" }
175 gdb_test "ptype victor" "type = const volatile char"
177 if {$gcc_compiled} then { setup_xfail "*-*-*" }
178 gdb_test "ptype vicar" "type = const volatile unsigned char"
180 if {$gcc_compiled} then { setup_xfail "*-*-*" }
181 gdb_test "ptype victory" "type = const volatile char *"
183 if {$gcc_compiled} then { setup_xfail "*-*-*" }
184 gdb_test "ptype vicarage" "type = const volatile unsigned char *"
186 if {$gcc_compiled} then { setup_xfail "*-*-*" }
187 gdb_test "ptype vein" "type = volatile char * const"
189 if {$gcc_compiled} then { setup_xfail "*-*-*" }
190 gdb_test "ptype vogue" "type = volatile unsigned char * const"
192 if {$gcc_compiled} then { setup_xfail "*-*-*" }
193 gdb_test "ptype cavern" "type = const volatile char * const"
195 if {$gcc_compiled} then { setup_xfail "*-*-*" }
196 gdb_test "ptype coverlet" "type = const volatile unsigned char * const"
198 if {$gcc_compiled} then { setup_xfail "*-*-*" }
199 gdb_test "ptype caveat" "type = const char * volatile"
201 if {$gcc_compiled} then { setup_xfail "*-*-*" }
202 gdb_test "ptype covenant" "type = const unsigned char * volatile"
204 if {$gcc_compiled} then { setup_xfail "*-*-*" }
205 gdb_test "ptype vizier" "type = const volatile char * volatile"
207 if {$gcc_compiled} then { setup_xfail "*-*-*" }
208 gdb_test "ptype vanadium" "type = const volatile unsigned char * volatile"
210 if {$gcc_compiled} then { setup_xfail "*-*-*" }
211 gdb_test "ptype vane" "type = char * const volatile"
213 if {$gcc_compiled} then { setup_xfail "*-*-*" }
214 gdb_test "ptype veldt" "type = unsigned char * const volatile"
216 if {$gcc_compiled} then { setup_xfail "*-*-*" }
217 gdb_test "ptype cove" "type = const char * const volatile"
219 if {$gcc_compiled} then { setup_xfail "*-*-*" }
220 gdb_test "ptype cavity" "type = const unsigned char * const volatile"
222 if {$gcc_compiled} then { setup_xfail "*-*-*" }
223 gdb_test "ptype vagus" "type = volatile char * const volatile"
225 if {$gcc_compiled} then { setup_xfail "*-*-*" }
226 gdb_test "ptype vagrancy" "type = volatile unsigned char * const volatile"
228 if {$gcc_compiled} then { setup_xfail "*-*-*" }
229 gdb_test "ptype vagary" "type = const volatile char * const volatile"
231 if {$gcc_compiled} then { setup_xfail "*-*-*" }
232 gdb_test "ptype vendor" "type = const volatile unsigned char * const volatile"
234 # test function parameters
235 if {$gcc_compiled} then { setup_xfail "*-*-*" }
236 send_gdb "ptype qux2\n"
238 -re "type = int \\(volatile unsigned char, const volatile int, volatile short &, volatile long \\*, float \\* volatile, const volatile signed char \\* const volatile\\)" {
241 -re ".*$gdb_prompt $" { fail "ptype qux2" }
242 timeout { fail "(timeout) ptype qux2" }