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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1999, 2002, 2003,
2
# 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see .
16
 
17
# This file was written by Rob Savoye. (rob@cygnus.com)
18
 
19
if $tracelevel {
20
    strace $tracelevel
21
}
22
 
23
#
24
# test running programs
25
#
26
set prms_id 0
27
set bug_id 0
28
 
29
if [target_info exists no_long_long] {
30
    set exec_opts [list debug additional_flags=-DNO_LONG_LONG]
31
} else {
32
    set exec_opts [list debug]
33
}
34
 
35
set testfile whatis
36
set srcfile ${testfile}.c
37
set binfile ${objdir}/${subdir}/${testfile}
38
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $exec_opts] != "" } {
39
     untested whatis.exp
40
     return -1
41
}
42
 
43
# Create and source the file that provides information about the compiler
44
# used to compile the test case.
45
if [get_compiler_info ${binfile}] {
46
    return -1;
47
}
48
 
49
# Start with a fresh gdb.
50
 
51
gdb_exit
52
gdb_start
53
gdb_reinitialize_dir $srcdir/$subdir
54
gdb_load $binfile
55
 
56
# Define a procedure to set up an xfail for all targets that put out a
57
# `long' type as an `int' type.
58
# Sun/Ultrix cc have this problem.
59
# It was said that COFF targets can not distinguish int from long either.
60
 
61
proc setup_xfail_on_long_vs_int {} {
62
    global gcc_compiled
63
 
64
    if {!$gcc_compiled} {
65
        setup_xfail "*-sun-sunos4*" "*-*-ultrix*" "i*86-sequent-bsd*"
66
    }
67
}
68
 
69
#
70
# Test whatis command with basic C types
71
#
72
# The name printed now (as of 23 May 1993) is whatever name the compiler
73
# uses in the stabs.  So we need to deal with names both from gcc and
74
# native compilers.
75
#
76
 
77
gdb_test "whatis v_char" \
78
    "type = (unsigned char|char)" \
79
    "whatis char"
80
 
81
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
82
gdb_test "whatis v_signed_char" \
83
    "type = (signed char|char)" \
84
    "whatis signed char"
85
 
86
gdb_test "whatis v_unsigned_char" \
87
    "type = unsigned char" \
88
    "whatis unsigned char"
89
 
90
gdb_test "whatis v_short" \
91
    "type = (short|short int)" \
92
    "whatis short"
93
 
94
gdb_test "whatis v_signed_short" \
95
    "type = (short|short int|signed short|signed short int)" \
96
    "whatis signed short"
97
 
98
gdb_test "whatis v_unsigned_short" \
99
    "type = (unsigned short|short unsigned int)" \
100
    "whatis unsigned short"
101
 
102
gdb_test "whatis v_int" \
103
    "type = int" \
104
    "whatis int"
105
 
106
gdb_test "whatis v_signed_int" \
107
    "type = (signed |)int" \
108
    "whatis signed int"
109
 
110
gdb_test "whatis v_unsigned_int" \
111
    "type = unsigned int" \
112
    "whatis unsigned int"
113
 
114
setup_xfail_on_long_vs_int
115
# AIX xlc gets this wrong and unsigned long right.  Go figure.
116
if {!$gcc_compiled} then {setup_xfail "rs6000-*-aix*"}
117
gdb_test "whatis v_long" \
118
    "type = (long|long int)" \
119
    "whatis long"
120
 
121
setup_xfail_on_long_vs_int
122
# AIX xlc gets this wrong and unsigned long right.  Go figure.
123
if {!$gcc_compiled} then {setup_xfail "rs6000-*-aix*"}
124
gdb_test "whatis v_signed_long" \
125
    "type = (signed |)(long|long int)" \
126
    "whatis signed long"
127
 
128
setup_xfail_on_long_vs_int
129
gdb_test "whatis v_unsigned_long" \
130
    "type = (unsigned long|long unsigned int)" \
131
    "whatis unsigned long"
132
 
133
 
134
if ![target_info exists no_long_long] {
135
    gdb_test "whatis v_unsigned_long_long" \
136
        "type = (unsigned long long|long long unsigned int)" \
137
        "whatis unsigned long long"
138
}
139
 
140
gdb_test "whatis v_float" \
141
    "type = float" \
142
    "whatis float"
143
 
144
gdb_test "whatis v_double" \
145
    "type = double" \
146
    "whatis double"
147
 
148
 
149
# test whatis command with arrays
150
#
151
# We already tested whether char prints as "char", so here we accept
152
# "unsigned char", "signed char", and other perversions.  No need for more
153
# than one xfail for the same thing.
154
gdb_test "whatis v_char_array" \
155
    "type = (signed |unsigned |)char \\\[2\\\]" \
156
    "whatis char array"
157
 
158
gdb_test "whatis v_signed_char_array" \
159
    "type = (signed |unsigned |)char \\\[2\\\]" \
160
    "whatis signed char array"
161
 
162
gdb_test "whatis v_unsigned_char_array" \
163
    "type = unsigned char \\\[2\\\]" \
164
    "whatis unsigned char array"
165
 
166
gdb_test "whatis v_short_array" \
167
    "type = (short|short int) \\\[2\\\]" \
168
    "whatis short array"
169
 
170
gdb_test "whatis v_signed_short_array" \
171
    "type = (signed |)(short|short int) \\\[2\\\]" \
172
    "whatis signed short array"
173
 
174
gdb_test "whatis v_unsigned_short_array" \
175
    "type = (unsigned short|short unsigned int) \\\[2\\\]" \
176
    "whatis unsigned short array"
177
 
178
gdb_test "whatis v_int_array" \
179
    "type = int \\\[2\\\]" \
180
    "whatis int array"
181
 
182
gdb_test "whatis v_signed_int_array" \
183
    "type = (signed |)int \\\[2\\\]" \
184
    "whatis signed int array"
185
 
186
gdb_test "whatis v_unsigned_int_array" \
187
    "type = unsigned int \\\[2\\\]" \
188
    "whatis unsigned int array"
189
 
190
# We already tested whether long prints as long, so here we accept int
191
# No need for more than one xfail for the same thing.
192
gdb_test "whatis v_long_array" \
193
    "type = (int|long|long int) \\\[2\\\]" \
194
    "whatis long array"
195
 
196
gdb_test "whatis v_signed_long_array" \
197
    "type = (signed |)(int|long|long int) \\\[2\\\]" \
198
    "whatis signed long array"
199
 
200
gdb_test "whatis v_unsigned_long_array" \
201
    "type = (unsigned (int|long|long int)|long unsigned int) \\\[2\\\]" \
202
    "whatis unsigned long array"
203
 
204
if ![target_info exists no_long_long] {
205
    gdb_test "whatis v_unsigned_long_long_array" \
206
        "type = (unsigned long long|long long unsigned int) \\\[2\\\]" \
207
        "whatis unsigned long array"
208
}
209
 
210
gdb_test "whatis v_float_array" \
211
    "type = float \\\[2\\\]" \
212
    "whatis float array"
213
 
214
gdb_test "whatis v_double_array" \
215
    "type = double \\\[2\\\]" \
216
    "whatis double array"
217
 
218
 
219
# test whatis command with pointers
220
#
221
# We already tested whether char prints as char, so accept various perversions
222
# here.  We especially want to make sure we test that it doesn't print as
223
# caddr_t.
224
gdb_test "whatis v_char_pointer" \
225
    "type = (unsigned |signed |)char \\*" \
226
    "whatis char pointer"
227
 
228
gdb_test "whatis v_signed_char_pointer" \
229
    "type = (unsigned |signed |)char \\*" \
230
    "whatis signed char pointer"
231
 
232
gdb_test "whatis v_unsigned_char_pointer" \
233
    "type = unsigned char \\*" \
234
    "whatis unsigned char pointer"
235
 
236
gdb_test "whatis v_short_pointer" \
237
    "type = (short|short int) \\*" \
238
    "whatis short pointer"
239
 
240
gdb_test "whatis v_signed_short_pointer" \
241
    "type = (signed |)(short|short int) \\*" \
242
    "whatis signed short pointer"
243
 
244
gdb_test "whatis v_unsigned_short_pointer" \
245
    "type = (unsigned short|short unsigned int) \\*" \
246
    "whatis unsigned short pointer"
247
 
248
gdb_test "whatis v_int_pointer" \
249
    "type = int \\*" \
250
    "whatis int pointer"
251
 
252
gdb_test "whatis v_signed_int_pointer" \
253
    "type = (signed |)int \\*" \
254
    "whatis signed int pointer"
255
 
256
gdb_test "whatis v_unsigned_int_pointer" \
257
    "type = unsigned int \\*" \
258
    "whatis unsigned int pointer"
259
 
260
# We already tested whether long prints as long, so here we accept int
261
gdb_test "whatis v_long_pointer" \
262
    "type = (long|int|long int) \\*" \
263
    "whatis long pointer"
264
 
265
gdb_test "whatis v_signed_long_pointer" \
266
    "type = (signed |)(long|int|long int) \\*" \
267
    "whatis signed long pointer"
268
 
269
gdb_test "whatis v_unsigned_long_pointer" \
270
    "type = (unsigned (int|long|long int)|long unsigned int) \\*" \
271
    "whatis unsigned long pointer"
272
 
273
if ![target_info exists no_long_long] {
274
    gdb_test "whatis v_long_long_pointer" \
275
        "type = long long(| int) \\*" \
276
        "whatis long long pointer"
277
 
278
    gdb_test "whatis v_signed_long_long_pointer" \
279
        "type = (signed |)long long(| int) \\*" \
280
        "whatis signed long long pointer"
281
 
282
    gdb_test "whatis v_unsigned_long_long_pointer" \
283
        "type = (unsigned long long|long long unsigned int) \\*" \
284
        "whatis unsigned long long pointer"
285
}
286
 
287
gdb_test "whatis v_float_pointer" \
288
    "type = float \\*" \
289
    "whatis float pointer"
290
 
291
gdb_test "whatis v_double_pointer" \
292
    "type = double \\*" \
293
    "whatis double pointer"
294
 
295
 
296
if { $hp_aCC_compiler } {
297
    set unstruct "unnamed\.struct\..*"
298
    set ununion "unnamed\.union\..*"
299
} else {
300
    set unstruct "\.\.\."
301
    set ununion "\.\.\."
302
}
303
 
304
# test whatis command with structure types
305
gdb_test "whatis v_struct1" \
306
    "type = struct t_struct" \
307
    "whatis named structure"
308
 
309
gdb_test "whatis struct t_struct" \
310
    "type = struct t_struct" \
311
    "whatis named structure using type name"
312
 
313
gdb_test "whatis v_struct2" \
314
    "type = struct \{$unstruct\}" \
315
    "whatis unnamed structure"
316
 
317
 
318
# test whatis command with union types
319
gdb_test "whatis v_union" \
320
    "type = union t_union" \
321
    "whatis named union"
322
 
323
gdb_test "whatis union t_union" \
324
    "type = union t_union" \
325
    "whatis named union using type name"
326
 
327
gdb_test "whatis v_union2" \
328
    "type = union \{$ununion\}" \
329
    "whatis unnamed union"
330
 
331
 
332
# HP-UX: HP aCC compiler w/ +objdebug option detects language as
333
# c++, so we need the 'void' pattern here.
334
# Without +objdebug compilation option we still need to match ''.
335
# - guo
336
# Also, using stabs we will mark these functions as prototyped.  This
337
# is harmless but causes an extra VOID to be printed.
338
set void "(void|)"
339
 
340
# test whatis command with functions return type
341
gdb_test "whatis v_char_func" \
342
    "type = (signed |unsigned |)char \\($void\\)" \
343
    "whatis char function"
344
 
345
gdb_test "whatis v_signed_char_func" \
346
    "type = (signed |unsigned |)char \\($void\\)" \
347
    "whatis signed char function"
348
 
349
gdb_test "whatis v_unsigned_char_func" \
350
    "type = unsigned char \\($void\\)"  \
351
    "whatis unsigned char function"
352
 
353
gdb_test "whatis v_short_func" \
354
    "type = short (int |)\\($void\\)" \
355
    "whatis short function"
356
 
357
gdb_test "whatis v_signed_short_func" \
358
    "type = (signed |)short (int |)\\($void\\)" \
359
    "whatis signed short function"
360
 
361
gdb_test "whatis v_unsigned_short_func" \
362
    "type = (unsigned short|short unsigned int) \\($void\\)" \
363
    "whatis unsigned short function"
364
 
365
gdb_test "whatis v_int_func" \
366
    "type = int \\($void\\)" \
367
    "whatis int function"
368
 
369
gdb_test "whatis v_signed_int_func" \
370
    "type = (signed |)int \\($void\\)" \
371
    "whatis signed int function"
372
 
373
gdb_test "whatis v_unsigned_int_func" \
374
    "type = unsigned int \\($void\\)" \
375
    "whatis unsigned int function"
376
 
377
gdb_test "whatis v_long_func" \
378
    "type = (long|int|long int) \\($void\\)" \
379
    "whatis long function"
380
 
381
gdb_test "whatis v_signed_long_func" \
382
    "type = (signed |)(int|long|long int) \\($void\\)" \
383
    "whatis signed long function"
384
 
385
gdb_test "whatis v_unsigned_long_func" \
386
    "type = (unsigned (int|long|long int)|long unsigned int) \\($void\\)" \
387
    "whatis unsigned long function"
388
 
389
if ![target_info exists no_long_long] {
390
    gdb_test "whatis v_long_long_func" \
391
        "type = long long(| int) \\($void\\)" \
392
        "whatis long long function"
393
 
394
    gdb_test "whatis v_signed_long_long_func" \
395
        "type = (signed |)long long(| int) \\($void\\)" \
396
        "whatis signed long long function"
397
 
398
    gdb_test "whatis v_unsigned_long_long_func" \
399
        "type = (unsigned long long(| int)|long long unsigned int) \\($void\\)" \
400
        "whatis unsigned long long function"
401
}
402
 
403
# Sun /bin/cc calls this a function returning double.
404
if {!$gcc_compiled} then {setup_xfail "*-sun-sunos4*"}
405
gdb_test "whatis v_float_func" \
406
    "type = float \\($void\\)" \
407
    "whatis float function"
408
 
409
gdb_test "whatis v_double_func" \
410
    "type = double \\($void\\)" \
411
    "whatis double function" \
412
 
413
 
414
# test whatis command with some misc complicated types
415
gdb_test "whatis s_link" \
416
    "type = struct link \\*" \
417
    "whatis complicated structure"
418
 
419
gdb_test "whatis u_link" \
420
    "type = union tu_link" \
421
    "whatis complicated union"
422
 
423
 
424
# test whatis command with enumerations
425
gdb_test "whatis clunker" \
426
    "type = enum cars" \
427
    "whatis enumeration"
428
 
429
gdb_test "whatis enum cars" \
430
    "type = enum cars" \
431
    "whatis enumeration using type name"
432
 
433
 
434
# test whatis command with nested struct and union
435
gdb_test "whatis nested_su" \
436
    "type = struct outer_struct" \
437
    "whatis outer structure"
438
 
439
gdb_test "whatis nested_su.outer_int" \
440
    "type = int" \
441
    "whatis outer structure member"
442
 
443
if {$hp_aCC_compiler} {
444
    set outer "outer_struct::"
445
} else {
446
    set outer ""
447
}
448
 
449
gdb_test "whatis nested_su.inner_struct_instance" \
450
    "type = struct ${outer}inner_struct" \
451
    "whatis inner structure"
452
 
453
gdb_test "whatis nested_su.inner_struct_instance.inner_int" \
454
    "type = int" \
455
    "whatis inner structure member"
456
 
457
gdb_test "whatis nested_su.inner_union_instance" \
458
    "type = union ${outer}inner_union" \
459
    "whatis inner union"
460
 
461
gdb_test "whatis nested_su.inner_union_instance.inner_union_int" \
462
    "type = int" \
463
    "whatis inner union member"
464
 
465
# test whatis command with typedefs
466
 
467
gdb_test "whatis char_addr" \
468
    "type = char \\*" \
469
    "whatis using typedef type name"
470
 
471
gdb_test "whatis a_char_addr" \
472
    "type = char_addr" \
473
    "whatis applied to variable defined by typedef"

powered by: WebSVN 2.1.0

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