Commit | Line | Data |
---|---|---|
c906108c SS |
1 | # Copyright (C) 1997, 1998, 1999 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 2 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, write to the Free Software | |
15 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
16 | ||
17 | # Please email any bugs, comments, and/or additions to this file to: | |
18 | # bug-gdb@prep.ai.mit.edu | |
19 | ||
20 | # Written by Satish Pai <pai@apollo.hp.com> 1997-07-07 | |
21 | # In the spirit of constvars.exp: added volatile, const-volatile stuff. | |
22 | ||
23 | # This file is part of the gdb testsuite | |
24 | # Tests for: | |
25 | # volatile vars | |
26 | # pointers to volatile vars | |
27 | # const 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. | |
35 | ||
36 | if $tracelevel then { | |
37 | strace $tracelevel | |
38 | } | |
39 | ||
40 | # | |
41 | # test running programs | |
42 | # | |
43 | set prms_id 0 | |
44 | set bug_id 0 | |
45 | ||
46 | # Use the same test program constvars.c. | |
47 | ||
48 | set testfile "constvars" | |
49 | set srcfile ${testfile}.c | |
50 | set binfile ${objdir}/${subdir}/${testfile} | |
51 | ||
085dd6e6 JM |
52 | if [istarget "hppa*-*-*"] { |
53 | set lang "c++" | |
54 | } else { | |
55 | set lang "" | |
56 | } | |
57 | ||
58 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat debug $lang]] != "" } { | |
c906108c SS |
59 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." |
60 | } | |
61 | ||
62 | remote_exec build "rm -f ${binfile}.ci" | |
63 | if [get_compiler_info ${binfile}] { | |
64 | return -1 | |
65 | } | |
66 | ||
67 | gdb_exit | |
68 | gdb_start | |
69 | gdb_reinitialize_dir $srcdir/$subdir | |
70 | gdb_load ${binfile} | |
71 | ||
72 | source ${binfile}.ci | |
73 | ||
74 | # | |
75 | # set it up at a breakpoint so we can play with the variable values | |
76 | # | |
77 | if ![runto_main] then { | |
78 | perror "couldn't run to breakpoint" | |
79 | continue | |
80 | } | |
81 | ||
82 | send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" | |
83 | ||
84 | send_gdb "cont\n" | |
85 | gdb_expect { | |
86 | -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { | |
87 | send_gdb "up\n" | |
88 | gdb_expect { | |
89 | -re ".*$gdb_prompt $" {} | |
90 | timeout { fail "up from marker1" } | |
91 | } | |
92 | } | |
93 | -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" { | |
94 | fail "continue to marker1 (demangling)" | |
95 | send_gdb "up\n" | |
96 | gdb_expect { | |
97 | -re ".*$gdb_prompt $" {} | |
98 | timeout { fail "up from marker1" } | |
99 | } | |
100 | } | |
101 | -re "$gdb_prompt $" { fail "continue to marker1" } | |
102 | timeout { fail "(timeout) continue to marker1" } | |
103 | } | |
104 | ||
105 | # As of Feb 1999, GCC does not issue info about volatility of vars, so | |
106 | # these tests are all expected to fail if GCC is the compiler. -sts | |
107 | ||
108 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 109 | gdb_test "ptype vox" "type = volatile char.*" |
c906108c SS |
110 | |
111 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 112 | gdb_test "ptype victuals" "type = volatile unsigned char.*" |
c906108c SS |
113 | |
114 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 115 | gdb_test "ptype vixen" "type = volatile short.*" |
c906108c SS |
116 | |
117 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 118 | gdb_test "ptype vitriol" "type = volatile unsigned short.*" |
c906108c SS |
119 | |
120 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 121 | gdb_test "ptype vellum" "type = volatile long.*" |
c906108c SS |
122 | |
123 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 124 | gdb_test "ptype valve" "type = volatile unsigned long.*" |
c906108c SS |
125 | |
126 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 127 | gdb_test "ptype vacuity" "type = volatile float.*" |
c906108c SS |
128 | |
129 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 130 | gdb_test "ptype vertigo" "type = volatile double.*" |
c906108c SS |
131 | |
132 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 133 | gdb_test "ptype vampire" "type = volatile char \\*.*" |
c906108c SS |
134 | |
135 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 136 | gdb_test "ptype viper" "type = volatile unsigned char \\*.*" |
c906108c SS |
137 | |
138 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 139 | gdb_test "ptype vigour" "type = volatile short \\*.*" |
c906108c SS |
140 | |
141 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 142 | gdb_test "ptype vapour" "type = volatile unsigned short \\*.*" |
c906108c SS |
143 | |
144 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 145 | gdb_test "ptype ventricle" "type = volatile long \\*.*" |
c906108c SS |
146 | |
147 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 148 | gdb_test "ptype vigintillion" "type = volatile unsigned long \\*.*" |
c906108c SS |
149 | |
150 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 151 | gdb_test "ptype vocation" "type = volatile float \\*.*" |
c906108c SS |
152 | |
153 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 154 | gdb_test "ptype veracity" "type = volatile double \\*.*" |
c906108c SS |
155 | |
156 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 157 | gdb_test "ptype vapidity" "type = volatile char \\* volatile.*" |
c906108c SS |
158 | |
159 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 160 | gdb_test "ptype velocity" "type = volatile unsigned char \\* volatile.*" |
c906108c SS |
161 | |
162 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 163 | gdb_test "ptype veneer" "type = volatile short \\* volatile.*" |
c906108c SS |
164 | |
165 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 166 | gdb_test "ptype video" "type = volatile unsigned short \\* volatile.*" |
c906108c SS |
167 | |
168 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 169 | gdb_test "ptype vacuum" "type = volatile long \\* volatile.*" |
c906108c SS |
170 | |
171 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 172 | gdb_test "ptype veniality" "type = volatile unsigned long \\* volatile.*" |
c906108c SS |
173 | |
174 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 175 | gdb_test "ptype vitality" "type = volatile float \\* volatile.*" |
c906108c SS |
176 | |
177 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 178 | gdb_test "ptype voracity" "type = volatile double \\* volatile.*" |
c906108c SS |
179 | |
180 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 181 | gdb_test "ptype victor" "type = const volatile char.*" |
c906108c SS |
182 | |
183 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 184 | gdb_test "ptype vicar" "type = const volatile unsigned char.*" |
c906108c SS |
185 | |
186 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 187 | gdb_test "ptype victory" "type = const volatile char \\*.*" |
c906108c SS |
188 | |
189 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 190 | gdb_test "ptype vicarage" "type = const volatile unsigned char \\*.*" |
c906108c SS |
191 | |
192 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 193 | gdb_test "ptype vein" "type = volatile char \\* const.*" |
c906108c SS |
194 | |
195 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 196 | gdb_test "ptype vogue" "type = volatile unsigned char \\* const.*" |
c906108c SS |
197 | |
198 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 199 | gdb_test "ptype cavern" "type = const volatile char \\* const.*" |
c906108c SS |
200 | |
201 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 202 | gdb_test "ptype coverlet" "type = const volatile unsigned char \\* const.*" |
c906108c SS |
203 | |
204 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 205 | gdb_test "ptype caveat" "type = const char \\* volatile.*" |
c906108c SS |
206 | |
207 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 208 | gdb_test "ptype covenant" "type = const unsigned char \\* volatile.*" |
c906108c SS |
209 | |
210 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 211 | gdb_test "ptype vizier" "type = const volatile char \\* volatile.*" |
c906108c SS |
212 | |
213 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 214 | gdb_test "ptype vanadium" "type = const volatile unsigned char \\* volatile.*" |
c906108c SS |
215 | |
216 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 217 | gdb_test "ptype vane" "type = char \\* const volatile.*" |
c906108c SS |
218 | |
219 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 220 | gdb_test "ptype veldt" "type = unsigned char \\* const volatile.*" |
c906108c SS |
221 | |
222 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 223 | gdb_test "ptype cove" "type = const char \\* const volatile.*" |
c906108c SS |
224 | |
225 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 226 | gdb_test "ptype cavity" "type = const unsigned char \\* const volatile.*" |
c906108c SS |
227 | |
228 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 229 | gdb_test "ptype vagus" "type = volatile char \\* const volatile.*" |
c906108c SS |
230 | |
231 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 232 | gdb_test "ptype vagrancy" "type = volatile unsigned char \\* const volatile.*" |
c906108c SS |
233 | |
234 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 235 | gdb_test "ptype vagary" "type = const volatile char \\* const volatile.*" |
c906108c SS |
236 | |
237 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
085dd6e6 | 238 | gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.*" |
c906108c SS |
239 | |
240 | # test function parameters | |
241 | if {$gcc_compiled} then { setup_xfail "*-*-*" } | |
242 | send_gdb "ptype qux2\n" | |
243 | gdb_expect { | |
085dd6e6 | 244 | -re "type = int \\(volatile unsigned char, const volatile int, volatile short, volatile long \\*, float \\* volatile, const volatile signed char \\* const volatile\\).*$gdb_prompt $" { |
c906108c SS |
245 | pass "ptype qux2" |
246 | } | |
247 | -re ".*$gdb_prompt $" { fail "ptype qux2" } | |
248 | timeout { fail "(timeout) ptype qux2" } | |
249 | } |