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/] [whatis.exp] - Blame information for rev 394

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

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