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