2004-01-06 Michael Chastain <mec.gnu@mindspring.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / volatile.exp
CommitLineData
9b4e0f94 1# Copyright 1997, 1998, 1999, 2003, 2004 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# 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
36if $tracelevel then {
37 strace $tracelevel
38 }
39
40#
41# test running programs
42#
43set prms_id 0
44set bug_id 0
45
46# Use the same test program constvars.c.
47
48set testfile "constvars"
49set srcfile ${testfile}.c
50set 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.
54if [get_compiler_info ${binfile}] {
55 return -1;
56}
57
58if {$hp_aCC_compiler || $hp_cc_compiler} {
085dd6e6
JM
59 set lang "c++"
60} else {
61 set lang ""
62}
63
64if { [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
c906108c
SS
68if [get_compiler_info ${binfile}] {
69 return -1
70}
71
72gdb_exit
73gdb_start
74gdb_reinitialize_dir $srcdir/$subdir
75gdb_load ${binfile}
76
c906108c
SS
77#
78# set it up at a breakpoint so we can play with the variable values
79#
80if ![runto_main] then {
81 perror "couldn't run to breakpoint"
82 continue
83}
84
b55a4771
MS
85get_debug_format
86
87proc local_compiler_xfail_check { } {
9a77938e 88 if { [test_compiler_info gcc-2-*] } then {
b55a4771
MS
89 if { ![test_debug_format "HP"] \
90 && ![test_debug_format "DWARF 2"] } then {
91 setup_xfail "*-*-*"
92 }
93 }
94}
95
c906108c
SS
96send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
97
98 send_gdb "cont\n"
99 gdb_expect {
100 -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
101 send_gdb "up\n"
102 gdb_expect {
103 -re ".*$gdb_prompt $" {}
104 timeout { fail "up from marker1" }
105 }
106 }
107 -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
108 fail "continue to marker1 (demangling)"
109 send_gdb "up\n"
110 gdb_expect {
111 -re ".*$gdb_prompt $" {}
112 timeout { fail "up from marker1" }
113 }
114 }
115 -re "$gdb_prompt $" { fail "continue to marker1" }
116 timeout { fail "(timeout) continue to marker1" }
117 }
118
119# As of Feb 1999, GCC does not issue info about volatility of vars, so
120# these tests are all expected to fail if GCC is the compiler. -sts
121
b55a4771 122local_compiler_xfail_check
085dd6e6 123gdb_test "ptype vox" "type = volatile char.*"
c906108c 124
b55a4771 125local_compiler_xfail_check
085dd6e6 126gdb_test "ptype victuals" "type = volatile unsigned char.*"
c906108c 127
b55a4771 128local_compiler_xfail_check
085dd6e6 129gdb_test "ptype vixen" "type = volatile short.*"
c906108c 130
b55a4771
MS
131local_compiler_xfail_check
132gdb_test "ptype vitriol" "type = volatile (unsigned short|short unsigned)( int)?.*"
c906108c 133
b55a4771 134local_compiler_xfail_check
085dd6e6 135gdb_test "ptype vellum" "type = volatile long.*"
c906108c 136
b55a4771
MS
137local_compiler_xfail_check
138gdb_test "ptype valve" "type = volatile (unsigned long|long unsigned)( int)?.*"
c906108c 139
b55a4771 140local_compiler_xfail_check
085dd6e6 141gdb_test "ptype vacuity" "type = volatile float.*"
c906108c 142
b55a4771 143local_compiler_xfail_check
085dd6e6 144gdb_test "ptype vertigo" "type = volatile double.*"
c906108c 145
b55a4771 146local_compiler_xfail_check
085dd6e6 147gdb_test "ptype vampire" "type = volatile char \\*.*"
c906108c 148
b55a4771 149local_compiler_xfail_check
085dd6e6 150gdb_test "ptype viper" "type = volatile unsigned char \\*.*"
c906108c 151
b55a4771
MS
152local_compiler_xfail_check
153gdb_test "ptype vigour" "type = volatile short( int)? \\*.*"
c906108c 154
b55a4771
MS
155local_compiler_xfail_check
156gdb_test "ptype vapour" "type = volatile (unsigned short|short unsigned)( int)? \\*.*"
c906108c 157
b55a4771
MS
158local_compiler_xfail_check
159gdb_test "ptype ventricle" "type = volatile long( int)? \\*.*"
c906108c 160
b55a4771
MS
161local_compiler_xfail_check
162gdb_test "ptype vigintillion" "type = volatile (unsigned long|long unsigned)( int)? \\*.*"
c906108c 163
b55a4771 164local_compiler_xfail_check
085dd6e6 165gdb_test "ptype vocation" "type = volatile float \\*.*"
c906108c 166
b55a4771 167local_compiler_xfail_check
085dd6e6 168gdb_test "ptype veracity" "type = volatile double \\*.*"
c906108c 169
b55a4771 170local_compiler_xfail_check
085dd6e6 171gdb_test "ptype vapidity" "type = volatile char \\* volatile.*"
c906108c 172
b55a4771 173local_compiler_xfail_check
085dd6e6 174gdb_test "ptype velocity" "type = volatile unsigned char \\* volatile.*"
c906108c 175
b55a4771
MS
176local_compiler_xfail_check
177gdb_test "ptype veneer" "type = volatile short( int)? \\* volatile.*"
c906108c 178
b55a4771
MS
179local_compiler_xfail_check
180gdb_test "ptype video" "type = volatile (unsigned short|short unsigned)( int) \\* volatile.*"
c906108c 181
b55a4771
MS
182local_compiler_xfail_check
183gdb_test "ptype vacuum" "type = volatile long( int)? \\* volatile.*"
c906108c 184
b55a4771
MS
185local_compiler_xfail_check
186gdb_test "ptype veniality" "type = volatile (unsigned long|long unsigned)( int)? \\* volatile.*"
c906108c 187
b55a4771 188local_compiler_xfail_check
085dd6e6 189gdb_test "ptype vitality" "type = volatile float \\* volatile.*"
c906108c 190
b55a4771 191local_compiler_xfail_check
085dd6e6 192gdb_test "ptype voracity" "type = volatile double \\* volatile.*"
c906108c 193
b55a4771 194local_compiler_xfail_check
085dd6e6 195gdb_test "ptype victor" "type = const volatile char.*"
c906108c 196
b55a4771 197local_compiler_xfail_check
085dd6e6 198gdb_test "ptype vicar" "type = const volatile unsigned char.*"
c906108c 199
b55a4771 200local_compiler_xfail_check
085dd6e6 201gdb_test "ptype victory" "type = const volatile char \\*.*"
c906108c 202
b55a4771 203local_compiler_xfail_check
085dd6e6 204gdb_test "ptype vicarage" "type = const volatile unsigned char \\*.*"
c906108c 205
b55a4771 206local_compiler_xfail_check
085dd6e6 207gdb_test "ptype vein" "type = volatile char \\* const.*"
c906108c 208
b55a4771 209local_compiler_xfail_check
085dd6e6 210gdb_test "ptype vogue" "type = volatile unsigned char \\* const.*"
c906108c 211
b55a4771 212local_compiler_xfail_check
085dd6e6 213gdb_test "ptype cavern" "type = const volatile char \\* const.*"
c906108c 214
b55a4771 215local_compiler_xfail_check
085dd6e6 216gdb_test "ptype coverlet" "type = const volatile unsigned char \\* const.*"
c906108c 217
b55a4771 218local_compiler_xfail_check
085dd6e6 219gdb_test "ptype caveat" "type = const char \\* volatile.*"
c906108c 220
b55a4771 221local_compiler_xfail_check
085dd6e6 222gdb_test "ptype covenant" "type = const unsigned char \\* volatile.*"
c906108c 223
b55a4771 224local_compiler_xfail_check
085dd6e6 225gdb_test "ptype vizier" "type = const volatile char \\* volatile.*"
c906108c 226
b55a4771 227local_compiler_xfail_check
085dd6e6 228gdb_test "ptype vanadium" "type = const volatile unsigned char \\* volatile.*"
c906108c 229
b55a4771 230local_compiler_xfail_check
085dd6e6 231gdb_test "ptype vane" "type = char \\* const volatile.*"
c906108c 232
b55a4771 233local_compiler_xfail_check
085dd6e6 234gdb_test "ptype veldt" "type = unsigned char \\* const volatile.*"
c906108c 235
b55a4771 236local_compiler_xfail_check
085dd6e6 237gdb_test "ptype cove" "type = const char \\* const volatile.*"
c906108c 238
b55a4771 239local_compiler_xfail_check
085dd6e6 240gdb_test "ptype cavity" "type = const unsigned char \\* const volatile.*"
c906108c 241
b55a4771 242local_compiler_xfail_check
085dd6e6 243gdb_test "ptype vagus" "type = volatile char \\* const volatile.*"
c906108c 244
b55a4771 245local_compiler_xfail_check
085dd6e6 246gdb_test "ptype vagrancy" "type = volatile unsigned char \\* const volatile.*"
c906108c 247
b55a4771 248local_compiler_xfail_check
085dd6e6 249gdb_test "ptype vagary" "type = const volatile char \\* const volatile.*"
c906108c 250
b55a4771 251local_compiler_xfail_check
085dd6e6 252gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.*"
c906108c
SS
253
254# test function parameters
b55a4771 255local_compiler_xfail_check
9a77938e 256if { [test_compiler_info gcc-3-*] && [test_debug_format "stabs"] } then {
18080350
DJ
257 # For reasons unknown, GCC 3 with stabs mangles several cv-qualified
258 # arguments to this function.
259 setup_xfail "*-*-*"
260}
c906108c
SS
261send_gdb "ptype qux2\n"
262gdb_expect {
674f90ff 263 -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
264 pass "ptype qux2"
265 }
266 -re ".*$gdb_prompt $" { fail "ptype qux2" }
267 timeout { fail "(timeout) ptype qux2" }
268 }
This page took 0.817218 seconds and 4 git commands to generate.