]>
Commit | Line | Data |
---|---|---|
18080350 | 1 | # Copyright 1997, 1998, 1999, 2003 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 | ||
17 | # Please email any bugs, comments, and/or additions to this file to: | |
18 | # [email protected] | |
19 | ||
20 | # Written by Satish Pai <[email protected]> 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 | ||
2cd045cd JL |
52 | # Create and source the file that provides information about the compiler |
53 | # used to compile the test case. | |
54 | if [get_compiler_info ${binfile}] { | |
55 | return -1; | |
56 | } | |
57 | ||
58 | if {$hp_aCC_compiler || $hp_cc_compiler} { | |
085dd6e6 JM |
59 | set lang "c++" |
60 | } else { | |
61 | set lang "" | |
62 | } | |
63 | ||
64 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat debug $lang]] != "" } { | |
c906108c SS |
65 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." |
66 | } | |
67 | ||
68 | remote_exec build "rm -f ${binfile}.ci" | |
69 | if [get_compiler_info ${binfile}] { | |
70 | return -1 | |
71 | } | |
72 | ||
73 | gdb_exit | |
74 | gdb_start | |
75 | gdb_reinitialize_dir $srcdir/$subdir | |
76 | gdb_load ${binfile} | |
77 | ||
78 | source ${binfile}.ci | |
79 | ||
80 | # | |
81 | # set it up at a breakpoint so we can play with the variable values | |
82 | # | |
83 | if ![runto_main] then { | |
84 | perror "couldn't run to breakpoint" | |
85 | continue | |
86 | } | |
87 | ||
b55a4771 MS |
88 | get_debug_format |
89 | ||
90 | proc local_compiler_xfail_check { } { | |
91 | global gcc_compiled; | |
92 | ||
18080350 | 93 | if {$gcc_compiled == 2} then { |
b55a4771 MS |
94 | if { ![test_debug_format "HP"] \ |
95 | && ![test_debug_format "DWARF 2"] } then { | |
96 | setup_xfail "*-*-*" | |
97 | } | |
98 | } | |
99 | } | |
100 | ||
c906108c SS |
101 | send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" |
102 | ||
103 | send_gdb "cont\n" | |
104 | gdb_expect { | |
105 | -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { | |
106 | send_gdb "up\n" | |
107 | gdb_expect { | |
108 | -re ".*$gdb_prompt $" {} | |
109 | timeout { fail "up from marker1" } | |
110 | } | |
111 | } | |
112 | -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" { | |
113 | fail "continue to marker1 (demangling)" | |
114 | send_gdb "up\n" | |
115 | gdb_expect { | |
116 | -re ".*$gdb_prompt $" {} | |
117 | timeout { fail "up from marker1" } | |
118 | } | |
119 | } | |
120 | -re "$gdb_prompt $" { fail "continue to marker1" } | |
121 | timeout { fail "(timeout) continue to marker1" } | |
122 | } | |
123 | ||
124 | # As of Feb 1999, GCC does not issue info about volatility of vars, so | |
125 | # these tests are all expected to fail if GCC is the compiler. -sts | |
126 | ||
b55a4771 | 127 | local_compiler_xfail_check |
085dd6e6 | 128 | gdb_test "ptype vox" "type = volatile char.*" |
c906108c | 129 | |
b55a4771 | 130 | local_compiler_xfail_check |
085dd6e6 | 131 | gdb_test "ptype victuals" "type = volatile unsigned char.*" |
c906108c | 132 | |
b55a4771 | 133 | local_compiler_xfail_check |
085dd6e6 | 134 | gdb_test "ptype vixen" "type = volatile short.*" |
c906108c | 135 | |
b55a4771 MS |
136 | local_compiler_xfail_check |
137 | gdb_test "ptype vitriol" "type = volatile (unsigned short|short unsigned)( int)?.*" | |
c906108c | 138 | |
b55a4771 | 139 | local_compiler_xfail_check |
085dd6e6 | 140 | gdb_test "ptype vellum" "type = volatile long.*" |
c906108c | 141 | |
b55a4771 MS |
142 | local_compiler_xfail_check |
143 | gdb_test "ptype valve" "type = volatile (unsigned long|long unsigned)( int)?.*" | |
c906108c | 144 | |
b55a4771 | 145 | local_compiler_xfail_check |
085dd6e6 | 146 | gdb_test "ptype vacuity" "type = volatile float.*" |
c906108c | 147 | |
b55a4771 | 148 | local_compiler_xfail_check |
085dd6e6 | 149 | gdb_test "ptype vertigo" "type = volatile double.*" |
c906108c | 150 | |
b55a4771 | 151 | local_compiler_xfail_check |
085dd6e6 | 152 | gdb_test "ptype vampire" "type = volatile char \\*.*" |
c906108c | 153 | |
b55a4771 | 154 | local_compiler_xfail_check |
085dd6e6 | 155 | gdb_test "ptype viper" "type = volatile unsigned char \\*.*" |
c906108c | 156 | |
b55a4771 MS |
157 | local_compiler_xfail_check |
158 | gdb_test "ptype vigour" "type = volatile short( int)? \\*.*" | |
c906108c | 159 | |
b55a4771 MS |
160 | local_compiler_xfail_check |
161 | gdb_test "ptype vapour" "type = volatile (unsigned short|short unsigned)( int)? \\*.*" | |
c906108c | 162 | |
b55a4771 MS |
163 | local_compiler_xfail_check |
164 | gdb_test "ptype ventricle" "type = volatile long( int)? \\*.*" | |
c906108c | 165 | |
b55a4771 MS |
166 | local_compiler_xfail_check |
167 | gdb_test "ptype vigintillion" "type = volatile (unsigned long|long unsigned)( int)? \\*.*" | |
c906108c | 168 | |
b55a4771 | 169 | local_compiler_xfail_check |
085dd6e6 | 170 | gdb_test "ptype vocation" "type = volatile float \\*.*" |
c906108c | 171 | |
b55a4771 | 172 | local_compiler_xfail_check |
085dd6e6 | 173 | gdb_test "ptype veracity" "type = volatile double \\*.*" |
c906108c | 174 | |
b55a4771 | 175 | local_compiler_xfail_check |
085dd6e6 | 176 | gdb_test "ptype vapidity" "type = volatile char \\* volatile.*" |
c906108c | 177 | |
b55a4771 | 178 | local_compiler_xfail_check |
085dd6e6 | 179 | gdb_test "ptype velocity" "type = volatile unsigned char \\* volatile.*" |
c906108c | 180 | |
b55a4771 MS |
181 | local_compiler_xfail_check |
182 | gdb_test "ptype veneer" "type = volatile short( int)? \\* volatile.*" | |
c906108c | 183 | |
b55a4771 MS |
184 | local_compiler_xfail_check |
185 | gdb_test "ptype video" "type = volatile (unsigned short|short unsigned)( int) \\* volatile.*" | |
c906108c | 186 | |
b55a4771 MS |
187 | local_compiler_xfail_check |
188 | gdb_test "ptype vacuum" "type = volatile long( int)? \\* volatile.*" | |
c906108c | 189 | |
b55a4771 MS |
190 | local_compiler_xfail_check |
191 | gdb_test "ptype veniality" "type = volatile (unsigned long|long unsigned)( int)? \\* volatile.*" | |
c906108c | 192 | |
b55a4771 | 193 | local_compiler_xfail_check |
085dd6e6 | 194 | gdb_test "ptype vitality" "type = volatile float \\* volatile.*" |
c906108c | 195 | |
b55a4771 | 196 | local_compiler_xfail_check |
085dd6e6 | 197 | gdb_test "ptype voracity" "type = volatile double \\* volatile.*" |
c906108c | 198 | |
b55a4771 | 199 | local_compiler_xfail_check |
085dd6e6 | 200 | gdb_test "ptype victor" "type = const volatile char.*" |
c906108c | 201 | |
b55a4771 | 202 | local_compiler_xfail_check |
085dd6e6 | 203 | gdb_test "ptype vicar" "type = const volatile unsigned char.*" |
c906108c | 204 | |
b55a4771 | 205 | local_compiler_xfail_check |
085dd6e6 | 206 | gdb_test "ptype victory" "type = const volatile char \\*.*" |
c906108c | 207 | |
b55a4771 | 208 | local_compiler_xfail_check |
085dd6e6 | 209 | gdb_test "ptype vicarage" "type = const volatile unsigned char \\*.*" |
c906108c | 210 | |
b55a4771 | 211 | local_compiler_xfail_check |
085dd6e6 | 212 | gdb_test "ptype vein" "type = volatile char \\* const.*" |
c906108c | 213 | |
b55a4771 | 214 | local_compiler_xfail_check |
085dd6e6 | 215 | gdb_test "ptype vogue" "type = volatile unsigned char \\* const.*" |
c906108c | 216 | |
b55a4771 | 217 | local_compiler_xfail_check |
085dd6e6 | 218 | gdb_test "ptype cavern" "type = const volatile char \\* const.*" |
c906108c | 219 | |
b55a4771 | 220 | local_compiler_xfail_check |
085dd6e6 | 221 | gdb_test "ptype coverlet" "type = const volatile unsigned char \\* const.*" |
c906108c | 222 | |
b55a4771 | 223 | local_compiler_xfail_check |
085dd6e6 | 224 | gdb_test "ptype caveat" "type = const char \\* volatile.*" |
c906108c | 225 | |
b55a4771 | 226 | local_compiler_xfail_check |
085dd6e6 | 227 | gdb_test "ptype covenant" "type = const unsigned char \\* volatile.*" |
c906108c | 228 | |
b55a4771 | 229 | local_compiler_xfail_check |
085dd6e6 | 230 | gdb_test "ptype vizier" "type = const volatile char \\* volatile.*" |
c906108c | 231 | |
b55a4771 | 232 | local_compiler_xfail_check |
085dd6e6 | 233 | gdb_test "ptype vanadium" "type = const volatile unsigned char \\* volatile.*" |
c906108c | 234 | |
b55a4771 | 235 | local_compiler_xfail_check |
085dd6e6 | 236 | gdb_test "ptype vane" "type = char \\* const volatile.*" |
c906108c | 237 | |
b55a4771 | 238 | local_compiler_xfail_check |
085dd6e6 | 239 | gdb_test "ptype veldt" "type = unsigned char \\* const volatile.*" |
c906108c | 240 | |
b55a4771 | 241 | local_compiler_xfail_check |
085dd6e6 | 242 | gdb_test "ptype cove" "type = const char \\* const volatile.*" |
c906108c | 243 | |
b55a4771 | 244 | local_compiler_xfail_check |
085dd6e6 | 245 | gdb_test "ptype cavity" "type = const unsigned char \\* const volatile.*" |
c906108c | 246 | |
b55a4771 | 247 | local_compiler_xfail_check |
085dd6e6 | 248 | gdb_test "ptype vagus" "type = volatile char \\* const volatile.*" |
c906108c | 249 | |
b55a4771 | 250 | local_compiler_xfail_check |
085dd6e6 | 251 | gdb_test "ptype vagrancy" "type = volatile unsigned char \\* const volatile.*" |
c906108c | 252 | |
b55a4771 | 253 | local_compiler_xfail_check |
085dd6e6 | 254 | gdb_test "ptype vagary" "type = const volatile char \\* const volatile.*" |
c906108c | 255 | |
b55a4771 | 256 | local_compiler_xfail_check |
085dd6e6 | 257 | gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.*" |
c906108c SS |
258 | |
259 | # test function parameters | |
b55a4771 | 260 | local_compiler_xfail_check |
18080350 DJ |
261 | if {$gcc_compiled == 3 && [test_debug_format "stabs"]} then { |
262 | # For reasons unknown, GCC 3 with stabs mangles several cv-qualified | |
263 | # arguments to this function. | |
264 | setup_xfail "*-*-*" | |
265 | } | |
c906108c SS |
266 | send_gdb "ptype qux2\n" |
267 | gdb_expect { | |
674f90ff | 268 | -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 |
269 | pass "ptype qux2" |
270 | } | |
271 | -re ".*$gdb_prompt $" { fail "ptype qux2" } | |
272 | timeout { fail "(timeout) ptype qux2" } | |
273 | } |