]>
Commit | Line | Data |
---|---|---|
6aba47ca | 1 | # Copyright 1997, 1998, 1999, 2003, 2004, 2007 Free Software Foundation, Inc. |
c906108c SS |
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 | ||
c906108c SS |
17 | # Written by Satish Pai <pai@apollo.hp.com> 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 | set testfile "constvars" | |
46 | set srcfile ${testfile}.c | |
47 | set binfile ${objdir}/${subdir}/${testfile} | |
48 | ||
2cd045cd JL |
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}] { | |
52 | return -1; | |
53 | } | |
54 | ||
053248ff | 55 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug ] != "" } { |
b60f0898 JB |
56 | untested volatile.exp |
57 | return -1 | |
c906108c SS |
58 | } |
59 | ||
c906108c SS |
60 | gdb_exit |
61 | gdb_start | |
62 | gdb_reinitialize_dir $srcdir/$subdir | |
63 | gdb_load ${binfile} | |
64 | ||
c906108c SS |
65 | # |
66 | # set it up at a breakpoint so we can play with the variable values | |
67 | # | |
68 | if ![runto_main] then { | |
69 | perror "couldn't run to breakpoint" | |
70 | continue | |
71 | } | |
72 | ||
b55a4771 MS |
73 | get_debug_format |
74 | ||
8e937346 MC |
75 | # Many tests xfail with gcc 2 -gstabs+. |
76 | # TODO: check out the hp side of this. | |
77 | ||
b55a4771 | 78 | proc local_compiler_xfail_check { } { |
9a77938e | 79 | if { [test_compiler_info gcc-2-*] } then { |
b55a4771 MS |
80 | if { ![test_debug_format "HP"] \ |
81 | && ![test_debug_format "DWARF 2"] } then { | |
82 | setup_xfail "*-*-*" | |
83 | } | |
84 | } | |
053248ff MC |
85 | |
86 | global hp_cc_compiler | |
87 | if { $hp_cc_compiler } { | |
88 | setup_xfail "hppa*-*-hpux*" | |
89 | } | |
b55a4771 MS |
90 | } |
91 | ||
8e937346 MC |
92 | # A few tests still xfail with gcc 3 -gstabs+ and gcc 4 -gstabs+. |
93 | ||
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" ] } { | |
97 | setup_xfail "*-*-*" | |
98 | } | |
99 | } | |
100 | } | |
101 | ||
c906108c SS |
102 | send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" |
103 | ||
104 | send_gdb "cont\n" | |
105 | gdb_expect { | |
106 | -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { | |
107 | send_gdb "up\n" | |
108 | gdb_expect { | |
109 | -re ".*$gdb_prompt $" {} | |
110 | timeout { fail "up from marker1" } | |
111 | } | |
112 | } | |
113 | -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" { | |
114 | fail "continue to marker1 (demangling)" | |
115 | send_gdb "up\n" | |
116 | gdb_expect { | |
117 | -re ".*$gdb_prompt $" {} | |
118 | timeout { fail "up from marker1" } | |
119 | } | |
120 | } | |
121 | -re "$gdb_prompt $" { fail "continue to marker1" } | |
122 | timeout { fail "(timeout) continue to marker1" } | |
123 | } | |
124 | ||
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 | |
127 | ||
b55a4771 | 128 | local_compiler_xfail_check |
085dd6e6 | 129 | gdb_test "ptype vox" "type = volatile char.*" |
c906108c | 130 | |
b55a4771 | 131 | local_compiler_xfail_check |
085dd6e6 | 132 | gdb_test "ptype victuals" "type = volatile unsigned char.*" |
c906108c | 133 | |
b55a4771 | 134 | local_compiler_xfail_check |
085dd6e6 | 135 | gdb_test "ptype vixen" "type = volatile short.*" |
c906108c | 136 | |
b55a4771 MS |
137 | local_compiler_xfail_check |
138 | gdb_test "ptype vitriol" "type = volatile (unsigned short|short unsigned)( int)?.*" | |
c906108c | 139 | |
b55a4771 | 140 | local_compiler_xfail_check |
085dd6e6 | 141 | gdb_test "ptype vellum" "type = volatile long.*" |
c906108c | 142 | |
b55a4771 MS |
143 | local_compiler_xfail_check |
144 | gdb_test "ptype valve" "type = volatile (unsigned long|long unsigned)( int)?.*" | |
c906108c | 145 | |
b55a4771 | 146 | local_compiler_xfail_check |
085dd6e6 | 147 | gdb_test "ptype vacuity" "type = volatile float.*" |
c906108c | 148 | |
b55a4771 | 149 | local_compiler_xfail_check |
085dd6e6 | 150 | gdb_test "ptype vertigo" "type = volatile double.*" |
c906108c | 151 | |
b55a4771 | 152 | local_compiler_xfail_check |
085dd6e6 | 153 | gdb_test "ptype vampire" "type = volatile char \\*.*" |
c906108c | 154 | |
b55a4771 | 155 | local_compiler_xfail_check |
085dd6e6 | 156 | gdb_test "ptype viper" "type = volatile unsigned char \\*.*" |
c906108c | 157 | |
b55a4771 MS |
158 | local_compiler_xfail_check |
159 | gdb_test "ptype vigour" "type = volatile short( int)? \\*.*" | |
c906108c | 160 | |
b55a4771 MS |
161 | local_compiler_xfail_check |
162 | gdb_test "ptype vapour" "type = volatile (unsigned short|short unsigned)( int)? \\*.*" | |
c906108c | 163 | |
b55a4771 MS |
164 | local_compiler_xfail_check |
165 | gdb_test "ptype ventricle" "type = volatile long( int)? \\*.*" | |
c906108c | 166 | |
b55a4771 MS |
167 | local_compiler_xfail_check |
168 | gdb_test "ptype vigintillion" "type = volatile (unsigned long|long unsigned)( int)? \\*.*" | |
c906108c | 169 | |
b55a4771 | 170 | local_compiler_xfail_check |
085dd6e6 | 171 | gdb_test "ptype vocation" "type = volatile float \\*.*" |
c906108c | 172 | |
b55a4771 | 173 | local_compiler_xfail_check |
085dd6e6 | 174 | gdb_test "ptype veracity" "type = volatile double \\*.*" |
c906108c | 175 | |
b55a4771 | 176 | local_compiler_xfail_check |
085dd6e6 | 177 | gdb_test "ptype vapidity" "type = volatile char \\* volatile.*" |
c906108c | 178 | |
b55a4771 | 179 | local_compiler_xfail_check |
085dd6e6 | 180 | gdb_test "ptype velocity" "type = volatile unsigned char \\* volatile.*" |
c906108c | 181 | |
b55a4771 MS |
182 | local_compiler_xfail_check |
183 | gdb_test "ptype veneer" "type = volatile short( int)? \\* volatile.*" | |
c906108c | 184 | |
b55a4771 MS |
185 | local_compiler_xfail_check |
186 | gdb_test "ptype video" "type = volatile (unsigned short|short unsigned)( int) \\* volatile.*" | |
c906108c | 187 | |
b55a4771 MS |
188 | local_compiler_xfail_check |
189 | gdb_test "ptype vacuum" "type = volatile long( int)? \\* volatile.*" | |
c906108c | 190 | |
b55a4771 MS |
191 | local_compiler_xfail_check |
192 | gdb_test "ptype veniality" "type = volatile (unsigned long|long unsigned)( int)? \\* volatile.*" | |
c906108c | 193 | |
b55a4771 | 194 | local_compiler_xfail_check |
085dd6e6 | 195 | gdb_test "ptype vitality" "type = volatile float \\* volatile.*" |
c906108c | 196 | |
b55a4771 | 197 | local_compiler_xfail_check |
085dd6e6 | 198 | gdb_test "ptype voracity" "type = volatile double \\* volatile.*" |
c906108c | 199 | |
b55a4771 | 200 | local_compiler_xfail_check |
085dd6e6 | 201 | gdb_test "ptype victor" "type = const volatile char.*" |
c906108c | 202 | |
b55a4771 | 203 | local_compiler_xfail_check |
085dd6e6 | 204 | gdb_test "ptype vicar" "type = const volatile unsigned char.*" |
c906108c | 205 | |
b55a4771 | 206 | local_compiler_xfail_check |
085dd6e6 | 207 | gdb_test "ptype victory" "type = const volatile char \\*.*" |
c906108c | 208 | |
b55a4771 | 209 | local_compiler_xfail_check |
085dd6e6 | 210 | gdb_test "ptype vicarage" "type = const volatile unsigned char \\*.*" |
c906108c | 211 | |
b55a4771 | 212 | local_compiler_xfail_check |
085dd6e6 | 213 | gdb_test "ptype vein" "type = volatile char \\* const.*" |
c906108c | 214 | |
b55a4771 | 215 | local_compiler_xfail_check |
085dd6e6 | 216 | gdb_test "ptype vogue" "type = volatile unsigned char \\* const.*" |
c906108c | 217 | |
b55a4771 | 218 | local_compiler_xfail_check |
085dd6e6 | 219 | gdb_test "ptype cavern" "type = const volatile char \\* const.*" |
c906108c | 220 | |
b55a4771 | 221 | local_compiler_xfail_check |
085dd6e6 | 222 | gdb_test "ptype coverlet" "type = const volatile unsigned char \\* const.*" |
c906108c | 223 | |
b55a4771 | 224 | local_compiler_xfail_check |
085dd6e6 | 225 | gdb_test "ptype caveat" "type = const char \\* volatile.*" |
c906108c | 226 | |
b55a4771 | 227 | local_compiler_xfail_check |
085dd6e6 | 228 | gdb_test "ptype covenant" "type = const unsigned char \\* volatile.*" |
c906108c | 229 | |
b55a4771 | 230 | local_compiler_xfail_check |
085dd6e6 | 231 | gdb_test "ptype vizier" "type = const volatile char \\* volatile.*" |
c906108c | 232 | |
b55a4771 | 233 | local_compiler_xfail_check |
085dd6e6 | 234 | gdb_test "ptype vanadium" "type = const volatile unsigned char \\* volatile.*" |
c906108c | 235 | |
b55a4771 | 236 | local_compiler_xfail_check |
085dd6e6 | 237 | gdb_test "ptype vane" "type = char \\* const volatile.*" |
c906108c | 238 | |
b55a4771 | 239 | local_compiler_xfail_check |
085dd6e6 | 240 | gdb_test "ptype veldt" "type = unsigned char \\* const volatile.*" |
c906108c | 241 | |
b55a4771 | 242 | local_compiler_xfail_check |
085dd6e6 | 243 | gdb_test "ptype cove" "type = const char \\* const volatile.*" |
c906108c | 244 | |
b55a4771 | 245 | local_compiler_xfail_check |
085dd6e6 | 246 | gdb_test "ptype cavity" "type = const unsigned char \\* const volatile.*" |
c906108c | 247 | |
b55a4771 | 248 | local_compiler_xfail_check |
085dd6e6 | 249 | gdb_test "ptype vagus" "type = volatile char \\* const volatile.*" |
c906108c | 250 | |
b55a4771 | 251 | local_compiler_xfail_check |
085dd6e6 | 252 | gdb_test "ptype vagrancy" "type = volatile unsigned char \\* const volatile.*" |
c906108c | 253 | |
b55a4771 | 254 | local_compiler_xfail_check |
085dd6e6 | 255 | gdb_test "ptype vagary" "type = const volatile char \\* const volatile.*" |
c906108c | 256 | |
b55a4771 | 257 | local_compiler_xfail_check |
085dd6e6 | 258 | gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.*" |
c906108c SS |
259 | |
260 | # test function parameters | |
b55a4771 | 261 | local_compiler_xfail_check |
8e937346 | 262 | local_compiler_xfail_check_2 |
c906108c SS |
263 | send_gdb "ptype qux2\n" |
264 | gdb_expect { | |
674f90ff | 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 $" { |
c906108c SS |
266 | pass "ptype qux2" |
267 | } | |
268 | -re ".*$gdb_prompt $" { fail "ptype qux2" } | |
269 | timeout { fail "(timeout) ptype qux2" } | |
270 | } |