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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [cvexpr.exp] - Blame information for rev 816

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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