gdb/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / volatile.exp
CommitLineData
0fb0cc75 1# Copyright 1997, 1998, 1999, 2003, 2004, 2007, 2008, 2009
9b254dd1 2# Free Software Foundation, Inc.
c906108c
SS
3
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
e22f8b7c 6# the Free Software Foundation; either version 3 of the License, or
c906108c 7# (at your option) any later version.
e22f8b7c 8#
c906108c
SS
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.
e22f8b7c 13#
c906108c 14# You should have received a copy of the GNU General Public License
e22f8b7c 15# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 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
33if $tracelevel then {
34 strace $tracelevel
35 }
36
37#
38# test running programs
39#
40set prms_id 0
41set bug_id 0
42
43# Use the same test program constvars.c.
44
aa81e255
JK
45if { [prepare_for_testing volatile.exp volatile constvars.c] } {
46 return -1
47}
c906108c 48
2cd045cd
JL
49# Create and source the file that provides information about the compiler
50# used to compile the test case.
aa81e255 51if [get_compiler_info not-used] {
2cd045cd
JL
52 return -1;
53}
54
c906108c
SS
55#
56# set it up at a breakpoint so we can play with the variable values
57#
58if ![runto_main] then {
59 perror "couldn't run to breakpoint"
60 continue
61}
62
b55a4771
MS
63get_debug_format
64
8e937346
MC
65# Many tests xfail with gcc 2 -gstabs+.
66# TODO: check out the hp side of this.
67
b55a4771 68proc local_compiler_xfail_check { } {
9a77938e 69 if { [test_compiler_info gcc-2-*] } then {
b55a4771
MS
70 if { ![test_debug_format "HP"] \
71 && ![test_debug_format "DWARF 2"] } then {
72 setup_xfail "*-*-*"
73 }
74 }
053248ff
MC
75
76 global hp_cc_compiler
77 if { $hp_cc_compiler } {
78 setup_xfail "hppa*-*-hpux*"
79 }
b55a4771
MS
80}
81
8e937346
MC
82# A few tests still xfail with gcc 3 -gstabs+ and gcc 4 -gstabs+.
83
84proc local_compiler_xfail_check_2 { } {
85 if { [test_compiler_info gcc-3-*] || [test_compiler_info gcc-4-*] } {
86 if { [test_debug_format "stabs" ] } {
87 setup_xfail "*-*-*"
88 }
89 }
90}
91
c906108c
SS
92send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
93
94 send_gdb "cont\n"
95 gdb_expect {
96 -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
97 send_gdb "up\n"
98 gdb_expect {
99 -re ".*$gdb_prompt $" {}
100 timeout { fail "up from marker1" }
101 }
102 }
103 -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
104 fail "continue to marker1 (demangling)"
105 send_gdb "up\n"
106 gdb_expect {
107 -re ".*$gdb_prompt $" {}
108 timeout { fail "up from marker1" }
109 }
110 }
111 -re "$gdb_prompt $" { fail "continue to marker1" }
112 timeout { fail "(timeout) continue to marker1" }
113 }
114
115# As of Feb 1999, GCC does not issue info about volatility of vars, so
116# these tests are all expected to fail if GCC is the compiler. -sts
117
b55a4771 118local_compiler_xfail_check
085dd6e6 119gdb_test "ptype vox" "type = volatile char.*"
c906108c 120
b55a4771 121local_compiler_xfail_check
085dd6e6 122gdb_test "ptype victuals" "type = volatile unsigned char.*"
c906108c 123
b55a4771 124local_compiler_xfail_check
085dd6e6 125gdb_test "ptype vixen" "type = volatile short.*"
c906108c 126
b55a4771
MS
127local_compiler_xfail_check
128gdb_test "ptype vitriol" "type = volatile (unsigned short|short unsigned)( int)?.*"
c906108c 129
b55a4771 130local_compiler_xfail_check
085dd6e6 131gdb_test "ptype vellum" "type = volatile long.*"
c906108c 132
b55a4771
MS
133local_compiler_xfail_check
134gdb_test "ptype valve" "type = volatile (unsigned long|long unsigned)( int)?.*"
c906108c 135
b55a4771 136local_compiler_xfail_check
085dd6e6 137gdb_test "ptype vacuity" "type = volatile float.*"
c906108c 138
b55a4771 139local_compiler_xfail_check
085dd6e6 140gdb_test "ptype vertigo" "type = volatile double.*"
c906108c 141
b55a4771 142local_compiler_xfail_check
085dd6e6 143gdb_test "ptype vampire" "type = volatile char \\*.*"
c906108c 144
b55a4771 145local_compiler_xfail_check
085dd6e6 146gdb_test "ptype viper" "type = volatile unsigned char \\*.*"
c906108c 147
b55a4771
MS
148local_compiler_xfail_check
149gdb_test "ptype vigour" "type = volatile short( int)? \\*.*"
c906108c 150
b55a4771
MS
151local_compiler_xfail_check
152gdb_test "ptype vapour" "type = volatile (unsigned short|short unsigned)( int)? \\*.*"
c906108c 153
b55a4771
MS
154local_compiler_xfail_check
155gdb_test "ptype ventricle" "type = volatile long( int)? \\*.*"
c906108c 156
b55a4771
MS
157local_compiler_xfail_check
158gdb_test "ptype vigintillion" "type = volatile (unsigned long|long unsigned)( int)? \\*.*"
c906108c 159
b55a4771 160local_compiler_xfail_check
085dd6e6 161gdb_test "ptype vocation" "type = volatile float \\*.*"
c906108c 162
b55a4771 163local_compiler_xfail_check
085dd6e6 164gdb_test "ptype veracity" "type = volatile double \\*.*"
c906108c 165
b55a4771 166local_compiler_xfail_check
085dd6e6 167gdb_test "ptype vapidity" "type = volatile char \\* volatile.*"
c906108c 168
b55a4771 169local_compiler_xfail_check
085dd6e6 170gdb_test "ptype velocity" "type = volatile unsigned char \\* volatile.*"
c906108c 171
b55a4771
MS
172local_compiler_xfail_check
173gdb_test "ptype veneer" "type = volatile short( int)? \\* volatile.*"
c906108c 174
b55a4771
MS
175local_compiler_xfail_check
176gdb_test "ptype video" "type = volatile (unsigned short|short unsigned)( int) \\* volatile.*"
c906108c 177
b55a4771
MS
178local_compiler_xfail_check
179gdb_test "ptype vacuum" "type = volatile long( int)? \\* volatile.*"
c906108c 180
b55a4771
MS
181local_compiler_xfail_check
182gdb_test "ptype veniality" "type = volatile (unsigned long|long unsigned)( int)? \\* volatile.*"
c906108c 183
b55a4771 184local_compiler_xfail_check
085dd6e6 185gdb_test "ptype vitality" "type = volatile float \\* volatile.*"
c906108c 186
b55a4771 187local_compiler_xfail_check
085dd6e6 188gdb_test "ptype voracity" "type = volatile double \\* volatile.*"
c906108c 189
b55a4771 190local_compiler_xfail_check
085dd6e6 191gdb_test "ptype victor" "type = const volatile char.*"
c906108c 192
b55a4771 193local_compiler_xfail_check
085dd6e6 194gdb_test "ptype vicar" "type = const volatile unsigned char.*"
c906108c 195
b55a4771 196local_compiler_xfail_check
085dd6e6 197gdb_test "ptype victory" "type = const volatile char \\*.*"
c906108c 198
b55a4771 199local_compiler_xfail_check
085dd6e6 200gdb_test "ptype vicarage" "type = const volatile unsigned char \\*.*"
c906108c 201
b55a4771 202local_compiler_xfail_check
085dd6e6 203gdb_test "ptype vein" "type = volatile char \\* const.*"
c906108c 204
b55a4771 205local_compiler_xfail_check
085dd6e6 206gdb_test "ptype vogue" "type = volatile unsigned char \\* const.*"
c906108c 207
b55a4771 208local_compiler_xfail_check
085dd6e6 209gdb_test "ptype cavern" "type = const volatile char \\* const.*"
c906108c 210
b55a4771 211local_compiler_xfail_check
085dd6e6 212gdb_test "ptype coverlet" "type = const volatile unsigned char \\* const.*"
c906108c 213
b55a4771 214local_compiler_xfail_check
085dd6e6 215gdb_test "ptype caveat" "type = const char \\* volatile.*"
c906108c 216
b55a4771 217local_compiler_xfail_check
085dd6e6 218gdb_test "ptype covenant" "type = const unsigned char \\* volatile.*"
c906108c 219
b55a4771 220local_compiler_xfail_check
085dd6e6 221gdb_test "ptype vizier" "type = const volatile char \\* volatile.*"
c906108c 222
b55a4771 223local_compiler_xfail_check
085dd6e6 224gdb_test "ptype vanadium" "type = const volatile unsigned char \\* volatile.*"
c906108c 225
b55a4771 226local_compiler_xfail_check
085dd6e6 227gdb_test "ptype vane" "type = char \\* const volatile.*"
c906108c 228
b55a4771 229local_compiler_xfail_check
085dd6e6 230gdb_test "ptype veldt" "type = unsigned char \\* const volatile.*"
c906108c 231
b55a4771 232local_compiler_xfail_check
085dd6e6 233gdb_test "ptype cove" "type = const char \\* const volatile.*"
c906108c 234
b55a4771 235local_compiler_xfail_check
085dd6e6 236gdb_test "ptype cavity" "type = const unsigned char \\* const volatile.*"
c906108c 237
b55a4771 238local_compiler_xfail_check
085dd6e6 239gdb_test "ptype vagus" "type = volatile char \\* const volatile.*"
c906108c 240
b55a4771 241local_compiler_xfail_check
085dd6e6 242gdb_test "ptype vagrancy" "type = volatile unsigned char \\* const volatile.*"
c906108c 243
b55a4771 244local_compiler_xfail_check
085dd6e6 245gdb_test "ptype vagary" "type = const volatile char \\* const volatile.*"
c906108c 246
b55a4771 247local_compiler_xfail_check
085dd6e6 248gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.*"
c906108c
SS
249
250# test function parameters
b55a4771 251local_compiler_xfail_check
8e937346 252local_compiler_xfail_check_2
c906108c
SS
253send_gdb "ptype qux2\n"
254gdb_expect {
674f90ff 255 -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
256 pass "ptype qux2"
257 }
258 -re ".*$gdb_prompt $" { fail "ptype qux2" }
259 timeout { fail "(timeout) ptype qux2" }
260 }
This page took 0.96032 seconds and 4 git commands to generate.