OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.base/] [cvexpr.exp] - Blame information for rev 330

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
#   Copyright (C) 2001, 2007, 2008, 2009, 2010 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 .
15
 
16
# Written by Michael Snyder, Red Hat, Inc., 9/20/2001
17
 
18
# This file is part of the gdb testsuite
19
# Tests for type expressions using const and volatile keywords.
20
 
21
if $tracelevel then {
22
        strace $tracelevel
23
        }
24
 
25
#
26
# test running programs
27
#
28
 
29
set testfile "cvexpr"
30
set srcfile ${testfile}.c
31
set binfile ${objdir}/${subdir}/${testfile}
32
 
33
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
34
     untested cvexpr.exp
35
     return -1
36
}
37
 
38
gdb_exit
39
gdb_start
40
gdb_reinitialize_dir $srcdir/$subdir
41
gdb_load ${binfile}
42
 
43
if [target_info exists gdb_stub] {
44
    gdb_step_for_stub;
45
}
46
 
47
gdb_test_no_output "set print sevenbit-strings"
48
gdb_test_no_output "set print address off"
49
gdb_test_no_output "set width 0"
50
 
51
set ws  "\[ \t\]*"
52
 
53
#
54
# Test casting a scalar to const
55
#
56
 
57
gdb_test "whatis (const char) v_char" \
58
        "type = const char" \
59
        "(const char)"
60
gdb_test "whatis (const signed char) v_signed_char" \
61
        "type = const signed char" \
62
        "(const signed char)"
63
gdb_test "whatis (const unsigned char) v_unsigned_char" \
64
        "type = const (unsigned char|char)" \
65
        "(const unsigned char)"
66
gdb_test "whatis (const short) v_short" \
67
        "type = const (short|short int)" \
68
        "(const short)"
69
gdb_test "whatis (const signed short) v_signed_short" \
70
        "type = const (short|short int|signed short|signed short int)" \
71
        "(const signed short)"
72
gdb_test "whatis (const unsigned short) v_unsigned_short" \
73
        "type = const (unsigned short|short unsigned int)" \
74
        "(const unsigned short)"
75
gdb_test "whatis (const int) v_int" \
76
        "type = const int" \
77
        "(const int)"
78
gdb_test "whatis (const signed int) v_signed_int" \
79
        "type = const (signed int|int)" \
80
        "(const signed int)"
81
gdb_test "whatis (const unsigned int) v_unsigned_int" \
82
        "type = const unsigned int" \
83
        "(const unsigned int)"
84
gdb_test "whatis (const long) v_long" \
85
        "type = const (long|long int)" \
86
        "(const long)"
87
gdb_test "whatis (const signed long) v_signed_long" \
88
        "type = const (signed |)long( int|)" \
89
        "(const signed long)"
90
gdb_test "whatis (const unsigned long) v_unsigned_long" \
91
        "type = const (unsigned long|long unsigned int)" \
92
        "(const unsigned long)"
93
gdb_test "whatis (const long long) v_long_long" \
94
        "type = const long long( int|)" \
95
        "(const long long)"
96
gdb_test "whatis (const signed long long) v_signed_long_long" \
97
        "type = const (signed |)long long( int|)" \
98
        "(const signed long long)"
99
gdb_test "whatis (const unsigned long long) v_unsigned_long_long" \
100
        "type = const (unsigned long long|long long unsigned int)" \
101
        "(const unsigned long long)"
102
gdb_test "whatis (const float) v_float" \
103
        "type = const float" \
104
        "(const float)"
105
gdb_test "whatis (const double) v_double" \
106
        "type = const double" \
107
        "(const double)"
108
 
109
#
110
# Test casting a scalar to volatile
111
#
112
 
113
gdb_test "whatis (volatile char) v_char" \
114
        "type = volatile char" \
115
        "(volatile char)"
116
gdb_test "whatis (volatile signed char) v_signed_char" \
117
        "type = volatile signed char" \
118
        "(volatile signed char)"
119
gdb_test "whatis (volatile unsigned char) v_unsigned_char" \
120
        "type = volatile (unsigned char|char)" \
121
        "(volatile unsigned char)"
122
gdb_test "whatis (volatile short) v_short" \
123
        "type = volatile (short|short int)" \
124
        "(volatile short)"
125
gdb_test "whatis (volatile signed short) v_signed_short" \
126
        "type = volatile (short|short int|signed short|signed short int)" \
127
        "(volatile signed short)"
128
gdb_test "whatis (volatile unsigned short) v_unsigned_short" \
129
        "type = volatile (unsigned short|short unsigned int)" \
130
        "(volatile unsigned short)"
131
gdb_test "whatis (volatile int) v_int" \
132
        "type = volatile int" \
133
        "(volatile int)"
134
gdb_test "whatis (volatile signed int) v_signed_int" \
135
        "type = volatile (signed int|int)" \
136
        "(volatile signed int)"
137
gdb_test "whatis (volatile unsigned int) v_unsigned_int" \
138
        "type = volatile unsigned int" \
139
        "(volatile unsigned int)"
140
gdb_test "whatis (volatile long) v_long" \
141
        "type = volatile (long|long int)" \
142
        "(volatile long)"
143
gdb_test "whatis (volatile signed long) v_signed_long" \
144
        "type = volatile (signed |)long( int|)" \
145
        "(volatile signed long)"
146
gdb_test "whatis (volatile unsigned long) v_unsigned_long" \
147
        "type = volatile (unsigned long|long unsigned int)" \
148
        "(volatile unsigned long)"
149
gdb_test "whatis (volatile long long) v_long_long" \
150
        "type = volatile long long( int|)" \
151
        "(volatile long long)"
152
gdb_test "whatis (volatile signed long long) v_signed_long_long" \
153
        "type = volatile (signed |)long long( int|)" \
154
        "(volatile signed long long)"
155
gdb_test "whatis (volatile unsigned long long) v_unsigned_long_long" \
156
        "type = volatile (unsigned long long|long long unsigned int)" \
157
        "(volatile unsigned long long)"
158
gdb_test "whatis (volatile float) v_float" \
159
        "type = volatile float" \
160
        "(volatile float)"
161
gdb_test "whatis (volatile double) v_double" \
162
        "type = volatile double" \
163
        "(volatile double)"
164
 
165
#
166
# Combine const and volatile
167
#
168
 
169
gdb_test "whatis (const volatile int) v_int" \
170
        "type = const volatile int" \
171
        "(const volatile int)"
172
gdb_test "whatis (volatile const int) v_int" \
173
        "type = const volatile int" \
174
        "(volatile const int)"
175
gdb_test "whatis (const int volatile) v_int" \
176
        "type = const volatile int" \
177
        "(const int volatile)"
178
gdb_test "whatis (volatile int const) v_int" \
179
        "type = const volatile int" \
180
        "(volatile int const)"
181
gdb_test "whatis (int const volatile) v_int" \
182
        "type = const volatile int" \
183
        "(int const volatile)"
184
gdb_test "whatis (int volatile const) v_int" \
185
        "type = const volatile int" \
186
        "(int volatile const)"
187
 
188
gdb_test "whatis (const volatile int *) v_int_pointer" \
189
        "type = const volatile int${ws}\\*" \
190
        "(const volatile int *)"
191
gdb_test "whatis (volatile const int *) v_int_pointer" \
192
        "type = const volatile int${ws}\\*" \
193
        "(volatile const int *)"
194
gdb_test "whatis (const int volatile *) v_int_pointer" \
195
        "type = const volatile int${ws}\\*" \
196
        "(const int volatile)"
197
gdb_test "whatis (volatile int const *) v_int_pointer" \
198
        "type = const volatile int${ws}\\*" \
199
        "(volatile int const *)"
200
gdb_test "whatis (int const volatile *) v_int_pointer" \
201
        "type = const volatile int${ws}\\*" \
202
        "(int const volatile *)"
203
gdb_test "whatis (int volatile const *) v_int_pointer" \
204
        "type = const volatile int${ws}\\*" \
205
        "(int volatile const *)"
206
gdb_test "whatis (int * const volatile) v_int_pointer" \
207
        "type = int${ws}\\*${ws}const volatile" \
208
        "(int * const volatile)"
209
gdb_test "whatis (int * volatile const) v_int_pointer" \
210
        "type = int${ws}\\*${ws}const volatile" \
211
        "(int * volatile const)"
212
 
213
 
214
#
215
# Put 'signed' and 'unsigned' before const/volatile (FIXME)
216
#
217
 
218
#gdb_test "whatis (signed const char) v_signed_char" \
219
#       "type = const char" \
220
#       "(signed const char)"
221
#gdb_test "whatis (unsigned const char) v_unsigned_char" \
222
#       "type = const (unsigned char|char)" \
223
#       "(unsigned const char)"
224
#gdb_test "whatis (signed const short) v_signed_short" \
225
#       "type = const (short|short int|signed short|signed short int)" \
226
#       "(signed const short)"
227
#gdb_test "whatis (unsigned const short) v_unsigned_short" \
228
#       "type = const (unsigned short|short unsigned int)" \
229
#       "(unsigned const short)"
230
#gdb_test "whatis (signed const int) v_signed_int" \
231
#       "type = const (signed int|int)" \
232
#       "(signed const int)"
233
#gdb_test "whatis (unsigned const int) v_unsigned_int" \
234
#       "type = const unsigned int" \
235
#       "(unsigned const int)"
236
#gdb_test "whatis (signed const long) v_signed_long" \
237
#       "type = const (signed |)long( int|)" \
238
#       "(signed const long)"
239
#gdb_test "whatis (unsigned const long) v_unsigned_long" \
240
#       "type = const (unsigned long|long unsigned int)" \
241
#       "(unsigned const long)"
242
#gdb_test "whatis (signed const long long) v_signed_long_long" \
243
#       "type = const (signed |)long long( int|)" \
244
#       "(signed const long long)"
245
#gdb_test "whatis (unsigned const long long) v_unsigned_long_long" \
246
#       "type = const (unsigned long long|long long unsigned int)" \
247
#       "(const unsigned long long)"
248
 
249
#gdb_test "whatis (signed volatile char) v_signed_char" \
250
#       "type = volatile char" \
251
#       "(signed volatile char)"
252
#gdb_test "whatis (unsigned volatile char) v_unsigned_char" \
253
#       "type = volatile (unsigned char|char)" \
254
#       "(unsigned volatile char)"
255
#gdb_test "whatis (signed volatile short) v_signed_short" \
256
#       "type = volatile (short|short int|signed short|signed short int)" \
257
#       "(signed volatile short)"
258
#gdb_test "whatis (unsigned volatile short) v_unsigned_short" \
259
#       "type = volatile (unsigned short|short unsigned int)" \
260
#       "(unsigned volatile short)"
261
#gdb_test "whatis (signed volatile int) v_signed_int" \
262
#       "type = volatile (signed int|int)" \
263
#       "(signed volatile int)"
264
#gdb_test "whatis (unsigned volatile int) v_unsigned_int" \
265
#       "type = volatile unsigned int" \
266
#       "(unsigned volatile int)"
267
#gdb_test "whatis (signed volatile long) v_signed_long" \
268
#       "type = volatile (signed |)long( int|)" \
269
#       "(signed volatile long)"
270
#gdb_test "whatis (unsigned volatile long) v_unsigned_long" \
271
#       "type = volatile (unsigned long|long unsigned int)" \
272
#       "(unsigned volatile long)"
273
#gdb_test "whatis (signed volatile long long) v_signed_long_long" \
274
#       "type = volatile (signed |)long long( int|)" \
275
#       "(signed volatile long long)"
276
#gdb_test "whatis (unsigned volatile long long) v_unsigned_long_long" \
277
#       "type = volatile (unsigned long long|long long unsigned int)" \
278
#       "(unsigned volatile long long)"
279
 
280
#
281
# Now put the 'const' and 'volatile' keywords after the base type.
282
#
283
 
284
gdb_test "whatis (char const) v_char" \
285
        "type = const char" \
286
        "(char const)"
287
gdb_test "whatis (signed char const) v_signed_char" \
288
        "type = const signed char" \
289
        "(signed char const)"
290
gdb_test "whatis (unsigned char const) v_unsigned_char" \
291
        "type = const (unsigned char|char)" \
292
        "(unsigned char const)"
293
gdb_test "whatis (short const) v_short" \
294
        "type = const (short|short int)" \
295
        "(short const)"
296
gdb_test "whatis (signed short const) v_signed_short" \
297
        "type = const (short|short int|signed short|signed short int)" \
298
        "(signed short const)"
299
gdb_test "whatis (unsigned short const) v_unsigned_short" \
300
        "type = const (unsigned short|short unsigned int)" \
301
        "(unsigned short const)"
302
gdb_test "whatis (int const) v_int" \
303
        "type = const int" \
304
        "(int const)"
305
gdb_test "whatis (signed int const) v_signed_int" \
306
        "type = const (signed int|int)" \
307
        "(signed int const)"
308
gdb_test "whatis (unsigned int const) v_unsigned_int" \
309
        "type = const unsigned int" \
310
        "(unsigned int const)"
311
gdb_test "whatis (long const) v_long" \
312
        "type = const (long|long int)" \
313
        "(long const)"
314
gdb_test "whatis (signed long const) v_signed_long" \
315
        "type = const (signed |)long( int|)" \
316
        "(signed long const)"
317
gdb_test "whatis (unsigned long const) v_unsigned_long" \
318
        "type = const (unsigned long|long unsigned int)" \
319
        "(unsigned long const)"
320
gdb_test "whatis (long long const) v_long_long" \
321
        "type = const long long( int|)" \
322
        "(long long const)"
323
gdb_test "whatis (signed long long const) v_signed_long_long" \
324
        "type = const (signed |)long long( int|)" \
325
        "(signed long long const)"
326
gdb_test "whatis (unsigned long long const) v_unsigned_long_long" \
327
        "type = const (unsigned long long|long long unsigned int)" \
328
        "(unsigned long long const)"
329
gdb_test "whatis (float const) v_float" \
330
        "type = const float" \
331
        "(float const)"
332
gdb_test "whatis (double const) v_double" \
333
        "type = const double" \
334
        "(double const)"
335
 
336
gdb_test "whatis (char volatile) v_char" \
337
        "type = volatile char" \
338
        "(char volatile)"
339
gdb_test "whatis (signed char volatile) v_signed_char" \
340
        "type = volatile signed char" \
341
        "(signed char volatile)"
342
gdb_test "whatis (unsigned char volatile) v_unsigned_char" \
343
        "type = volatile (unsigned char|char)" \
344
        "(unsigned char volatile)"
345
gdb_test "whatis (short volatile) v_short" \
346
        "type = volatile (short|short int)" \
347
        "(short volatile)"
348
gdb_test "whatis (signed short volatile) v_signed_short" \
349
        "type = volatile (short|short int|signed short|signed short int)" \
350
        "(signed short volatile)"
351
gdb_test "whatis (unsigned short volatile) v_unsigned_short" \
352
        "type = volatile (unsigned short|short unsigned int)" \
353
        "(unsigned short volatile)"
354
gdb_test "whatis (int volatile) v_int" \
355
        "type = volatile int" \
356
        "(int volatile)"
357
gdb_test "whatis (signed int volatile) v_signed_int" \
358
        "type = volatile (signed int|int)" \
359
        "(signed int volatile)"
360
gdb_test "whatis (unsigned int volatile) v_unsigned_int" \
361
        "type = volatile unsigned int" \
362
        "(unsigned int volatile)"
363
gdb_test "whatis (long volatile) v_long" \
364
        "type = volatile (long|long int)" \
365
        "(long volatile)"
366
gdb_test "whatis (signed long volatile) v_signed_long" \
367
        "type = volatile (signed |)long( int|)" \
368
        "(signed long volatile)"
369
gdb_test "whatis (unsigned long volatile) v_unsigned_long" \
370
        "type = volatile (unsigned long|long unsigned int)" \
371
        "(unsigned long volatile)"
372
gdb_test "whatis (long long volatile) v_long_long" \
373
        "type = volatile long long( int|)" \
374
        "(long long volatile)"
375
gdb_test "whatis (signed long long volatile) v_signed_long_long" \
376
        "type = volatile (signed |)long long( int|)" \
377
        "(signed long long volatile)"
378
gdb_test "whatis (unsigned long long volatile) v_unsigned_long_long" \
379
        "type = volatile (unsigned long long|long long unsigned int)" \
380
        "(unsigned long long volatile)"
381
gdb_test "whatis (float volatile) v_float" \
382
        "type = volatile float" \
383
        "(float volatile)"
384
gdb_test "whatis (double volatile) v_double" \
385
        "type = volatile double" \
386
        "(double volatile)"
387
 
388
#
389
# enums
390
#
391
 
392
gdb_test "whatis (const enum misordered) v_misordered" \
393
        "type = const enum misordered" \
394
        "(const enum misordered)"
395
gdb_test "whatis (enum misordered const) v_misordered" \
396
        "type = const enum misordered" \
397
        "(enum misordered const)"
398
gdb_test "whatis (volatile enum misordered) v_misordered" \
399
        "type = volatile enum misordered" \
400
        "(volatile enum misordered)"
401
gdb_test "whatis (enum misordered volatile) v_misordered" \
402
        "type = volatile enum misordered" \
403
        "(enum misordered volatile)"
404
 
405
#
406
# Pointers
407
#
408
 
409
gdb_test "whatis (const int *) v_int_pointer" \
410
        "type = const int${ws}\\*" \
411
        "(const int *)"
412
gdb_test "whatis (int const *) v_int_pointer" \
413
        "type = const int${ws}\\*" \
414
        "(int const *)"
415
gdb_test "whatis (int * const) v_int_pointer" \
416
        "type = int \\*${ws}const" \
417
        "(int * const)"
418
gdb_test "whatis (const int * const) v_int_pointer" \
419
        "type = const int${ws}\\*${ws}const" \
420
        "(const int * const)"
421
gdb_test "whatis (int const * const) v_int_pointer" \
422
        "type = const int${ws}\\*${ws}const" \
423
        "(int const * const)"
424
 
425
gdb_test "whatis (const int **) v_int_pointer_pointer" \
426
        "type = const int${ws}\\*${ws}\\*" \
427
        "(const int **)"
428
gdb_test "whatis (int const **) v_int_pointer_pointer" \
429
        "type = const int${ws}\\*${ws}\\*" \
430
        "(int const **)"
431
gdb_test "whatis (int ** const) v_int_pointer_pointer" \
432
        "type = int \\*${ws}\\*${ws}const" \
433
        "(int ** const)"
434
gdb_test "whatis (const int * const *) v_int_pointer_pointer" \
435
        "type = const int${ws}\\*${ws}const${ws}\\*" \
436
        "(const int * const *)"
437
gdb_test "whatis (int const * const *) v_int_pointer_pointer" \
438
        "type = const int${ws}\\*${ws}const${ws}\\*" \
439
        "(int const * const *)"
440
gdb_test "whatis (const int * const * const) v_int_pointer_pointer" \
441
        "type = const int${ws}\\*${ws}const${ws}\\*${ws}const" \
442
        "(const int * const * const)"
443
gdb_test "whatis (int const * const * const) v_int_pointer_pointer" \
444
        "type = const int${ws}\\*${ws}const${ws}\\*${ws}const" \
445
        "(int const * const * const)"
446
 
447
#
448
# Arrays TODO
449
#
450
 
451
#
452
# Pointers to arrays, arrays of pointers TODO
453
#
454
 
455
#
456
# Structs and Unions
457
#
458
 
459
gdb_test "whatis (const struct t_struct) v_struct1" \
460
        "type = const struct t_struct" \
461
        "(const struct t_struct)"
462
gdb_test "whatis (const union t_union) v_union" \
463
        "type = const union t_union" \
464
        "(const union t_union)"
465
gdb_test "whatis (struct t_struct const) v_struct1" \
466
        "type = const struct t_struct" \
467
        "(struct t_struct const)"
468
gdb_test "whatis (union t_union const) v_union" \
469
        "type = const union t_union" \
470
        "(union t_union const)"
471
gdb_test "whatis (const struct t_struct *) &v_struct1" \
472
        "type = const struct t_struct${ws}\\*" \
473
        "(const struct t_struct *)"
474
gdb_test "whatis (const union t_union *) &v_union" \
475
        "type = const union t_union${ws}\\*" \
476
        "(const union t_union *)"
477
gdb_test "whatis (struct t_struct const *) &v_struct1" \
478
        "type = const struct t_struct${ws}\\*" \
479
        "(struct t_struct const *)"
480
gdb_test "whatis (union t_union const *) &v_union" \
481
        "type = const union t_union${ws}\\*" \
482
        "(union t_union const *)"
483
gdb_test "whatis (struct t_struct * const) &v_struct1" \
484
        "type = struct t_struct${ws}\\*${ws}const" \
485
        "(struct t_struct * const)"
486
gdb_test "whatis (union t_union * const) &v_union" \
487
        "type = union t_union${ws}\\*${ws}const" \
488
        "(union t_union * const)"
489
gdb_test "whatis (const struct t_struct * const) &v_struct1" \
490
        "type = const struct t_struct${ws}\\*${ws}const" \
491
        "(const struct t_struct * const)"
492
gdb_test "whatis (const union t_union * const) &v_union" \
493
        "type = const union t_union${ws}\\*${ws}const" \
494
        "(const union t_union * const)"
495
gdb_test "whatis (struct t_struct const * const) &v_struct1" \
496
        "type = const struct t_struct${ws}\\*${ws}const" \
497
        "(struct t_struct const * const)"
498
gdb_test "whatis (union t_union const * const) &v_union" \
499
        "type = const union t_union${ws}\\*${ws}const" \
500
        "(union t_union const * const)"
501
 
502
#
503
# Function pointers TODO
504
#
505
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.