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

Subversion Repositories openrisc_me

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

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

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

powered by: WebSVN 2.1.0

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