1# Copyright 1997-2013 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.
15
16# Written by Satish Pai <pai@apollo.hp.com> 1997-07-07
17#    In the spirit of constvars.exp: added volatile, const-volatile stuff.
18
19# This file is part of the gdb testsuite
20# Tests for:
21#           volatile vars
22#           pointers to volatile vars
23#           const volatile vars
24#           pointers to const volatile vars
25#           const pointers to volatile vars
26#           volatile pointers to const vars
27#           const volatile pointers to const vars
28#           const volatile pointers to volatile vars
29#           ... etc.  (you get the idea)
30# Mostly with char and unsigned char.
31
32#
33# test running programs
34#
35
36# Use the same test program constvars.c.
37
38if { [prepare_for_testing volatile.exp volatile constvars.c] } {
39    return -1
40}
41
42# Create and source the file that provides information about the compiler
43# used to compile the test case.
44if [get_compiler_info] {
45    return -1;
46}
47
48#
49# set it up at a breakpoint so we can play with the variable values
50#
51if ![runto_main] then {
52    perror "couldn't run to breakpoint"
53    continue
54}
55
56get_debug_format
57
58# Many tests xfail with gcc 2 -gstabs+.
59# TODO: check out the hp side of this.
60
61proc local_compiler_xfail_check { } {
62    if { [test_compiler_info gcc-2-*] } then {
63	if { ![test_debug_format "HP"] \
64		&& ![test_debug_format "DWARF 2"] } then {
65	    setup_xfail "*-*-*"
66	}
67    }
68
69    global hp_cc_compiler
70    if { $hp_cc_compiler } {
71	setup_xfail "hppa*-*-hpux*"
72    }
73}
74
75# A few tests still xfail with gcc 3 -gstabs+ and gcc 4 -gstabs+.
76
77proc local_compiler_xfail_check_2 { } {
78    if { [test_compiler_info gcc-3-*] || [test_compiler_info gcc-4-*] } {
79	if { [test_debug_format "stabs" ] } {
80	    setup_xfail "*-*-*"
81	}
82    }
83}
84
85gdb_test "break marker1" ".*" ""
86
87gdb_test_multiple "cont" "continue to marker1" {
88    -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
89	pass "continue to marker1"
90    }
91    -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
92	fail "continue to marker1 (demangling)"
93    }
94}
95gdb_test "up" " in main .*" "up from marker1"
96
97# As of Feb 1999, GCC does not issue info about volatility of vars, so
98# these tests are all expected to fail if GCC is the compiler. -sts
99
100local_compiler_xfail_check
101gdb_test "ptype vox" "type = volatile char.*"
102
103local_compiler_xfail_check
104gdb_test "ptype victuals" "type = volatile unsigned char.*"
105
106local_compiler_xfail_check
107gdb_test "ptype vixen" "type = volatile short.*"
108
109local_compiler_xfail_check
110gdb_test "ptype vitriol" "type = volatile (unsigned short|short unsigned)( int)?.*"
111
112local_compiler_xfail_check
113gdb_test "ptype vellum" "type = volatile long.*"
114
115local_compiler_xfail_check
116gdb_test "ptype valve" "type = volatile (unsigned long|long unsigned)( int)?.*"
117
118local_compiler_xfail_check
119gdb_test "ptype vacuity" "type = volatile float.*"
120
121local_compiler_xfail_check
122gdb_test "ptype vertigo" "type = volatile double.*"
123
124local_compiler_xfail_check
125gdb_test "ptype vampire" "type = volatile char \\*.*"
126
127local_compiler_xfail_check
128gdb_test "ptype viper" "type = volatile unsigned char \\*.*"
129
130local_compiler_xfail_check
131gdb_test "ptype vigour" "type = volatile short( int)? \\*.*"
132
133local_compiler_xfail_check
134gdb_test "ptype vapour" "type = volatile (unsigned short|short unsigned)( int)? \\*.*"
135
136local_compiler_xfail_check
137gdb_test "ptype ventricle" "type = volatile long( int)? \\*.*"
138
139local_compiler_xfail_check
140gdb_test "ptype vigintillion" "type = volatile (unsigned long|long unsigned)( int)? \\*.*"
141
142local_compiler_xfail_check
143gdb_test "ptype vocation" "type = volatile float \\*.*"
144
145local_compiler_xfail_check
146gdb_test "ptype veracity" "type = volatile double \\*.*"
147
148local_compiler_xfail_check
149gdb_test "ptype vapidity" "type = volatile char \\* volatile.*"
150
151local_compiler_xfail_check
152gdb_test "ptype velocity" "type = volatile unsigned char \\* volatile.*"
153
154local_compiler_xfail_check
155gdb_test "ptype veneer" "type = volatile short( int)? \\* volatile.*"
156
157local_compiler_xfail_check
158gdb_test "ptype video" "type = volatile (unsigned short|short unsigned) \\* volatile.*"
159
160local_compiler_xfail_check
161gdb_test "ptype vacuum" "type = volatile long( int)? \\* volatile.*"
162
163local_compiler_xfail_check
164gdb_test "ptype veniality" "type = volatile (unsigned long|long unsigned)( int)? \\* volatile.*"
165
166local_compiler_xfail_check
167gdb_test "ptype vitality" "type = volatile float \\* volatile.*"
168
169local_compiler_xfail_check
170gdb_test "ptype voracity" "type = volatile double \\* volatile.*"
171
172local_compiler_xfail_check
173gdb_test "ptype victor" "type = const volatile char.*"
174
175local_compiler_xfail_check
176gdb_test "ptype vicar" "type = const volatile unsigned char.*"
177
178local_compiler_xfail_check
179gdb_test "ptype victory" "type = const volatile char \\*.*"
180
181local_compiler_xfail_check
182gdb_test "ptype vicarage" "type = const volatile unsigned char \\*.*"
183
184local_compiler_xfail_check
185gdb_test "ptype vein" "type = volatile char \\* const.*"
186
187local_compiler_xfail_check
188gdb_test "ptype vogue" "type = volatile unsigned char \\* const.*"
189
190local_compiler_xfail_check
191gdb_test "ptype cavern" "type = const volatile char \\* const.*"
192
193local_compiler_xfail_check
194gdb_test "ptype coverlet" "type = const volatile unsigned char \\* const.*"
195
196local_compiler_xfail_check
197gdb_test "ptype caveat" "type = const char \\* volatile.*"
198
199local_compiler_xfail_check
200gdb_test "ptype covenant" "type = const unsigned char \\* volatile.*"
201
202local_compiler_xfail_check
203gdb_test "ptype vizier" "type = const volatile char \\* volatile.*"
204
205local_compiler_xfail_check
206gdb_test "ptype vanadium" "type = const volatile unsigned char \\* volatile.*"
207
208local_compiler_xfail_check
209gdb_test "ptype vane" "type = char \\* const volatile.*"
210
211local_compiler_xfail_check
212gdb_test "ptype veldt" "type = unsigned char \\* const volatile.*"
213
214local_compiler_xfail_check
215gdb_test "ptype cove" "type = const char \\* const volatile.*"
216
217local_compiler_xfail_check
218gdb_test "ptype cavity" "type = const unsigned char \\* const volatile.*"
219
220local_compiler_xfail_check
221gdb_test "ptype vagus" "type = volatile char \\* const volatile.*"
222
223local_compiler_xfail_check
224gdb_test "ptype vagrancy" "type = volatile unsigned char \\* const volatile.*"
225
226local_compiler_xfail_check
227gdb_test "ptype vagary" "type = const volatile char \\* const volatile.*"
228
229local_compiler_xfail_check
230gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.*"
231
232# test function parameters
233local_compiler_xfail_check
234local_compiler_xfail_check_2
235
236gdb_test "ptype qux2" \
237    "type = int \\(volatile unsigned char, const volatile int, volatile short( int)?, volatile long( int)? \\*, float \\* volatile, const volatile signed char \\* const volatile\\)" \
238    "ptype qux2"
239