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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [whatis.exp] - Blame information for rev 107

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

Line No. Rev Author Line
1 106 markom
#   Copyright (C) 1988, 1990, 1991, 1992, 1995, 1997 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 2 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, write to the Free Software
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
# This file was written by Rob Savoye. (rob@cygnus.com)
21
 
22
if $tracelevel {
23
    strace $tracelevel
24
}
25
 
26
#
27
# test running programs
28
#
29
set prms_id 0
30
set bug_id 0
31
 
32
set testfile whatis
33
set srcfile ${testfile}.c
34
set binfile ${objdir}/${subdir}/${testfile}
35
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
36
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
37
}
38
 
39
# Create and source the file that provides information about the compiler
40
# used to compile the test case.
41
if [get_compiler_info ${binfile}] {
42
    return -1;
43
}
44
 
45
# Start with a fresh gdb.
46
 
47
gdb_exit
48
gdb_start
49
gdb_reinitialize_dir $srcdir/$subdir
50
gdb_load $binfile
51
 
52
# Define a procedure to set up an xfail for all targets that put out a
53
# `long' type as an `int' type.
54
# Sun/Ultrix cc have this problem.
55
# It was said that COFF targets can not distinguish int from long either.
56
 
57
proc setup_xfail_on_long_vs_int {} {
58
    global gcc_compiled
59
 
60
    if {!$gcc_compiled} {
61
        setup_xfail "*-sun-sunos4*" "*-*-ultrix*" "i*86-sequent-bsd*"
62
    }
63
}
64
 
65
#
66
# Test whatis command with basic C types
67
#
68
# The name printed now (as of 23 May 1993) is whatever name the compiler
69
# uses in the stabs.  So we need to deal with names both from gcc and
70
# native compilers.
71
#
72
 
73
gdb_test "whatis v_char" \
74
    "type = (unsigned char|char)" \
75
    "whatis char"
76
 
77
# If we did not use the signed keyword when compiling the file, don't
78
# expect GDB to know that char is signed.
79
if { $hp_cc_compiler || $hp_aCC_compiler } {
80
    set signed_keyword_not_used 1
81
}
82
if $signed_keyword_not_used then {
83
    set signed_char "char"
84
} else {
85
    set signed_char "signed char"
86
}
87
setup_xfail "a29k-*-*"
88
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
89
gdb_test "whatis v_signed_char" \
90
    "type = $signed_char" \
91
    "whatis signed char"
92
 
93
gdb_test "whatis v_unsigned_char" \
94
    "type = unsigned char" \
95
    "whatis unsigned char"
96
 
97
gdb_test "whatis v_short" \
98
    "type = (short|short int)" \
99
    "whatis short"
100
 
101
gdb_test "whatis v_signed_short" \
102
    "type = (short|short int|signed short|signed short int)" \
103
    "whatis signed short"
104
 
105
gdb_test "whatis v_unsigned_short" \
106
    "type = (unsigned short|short unsigned int)" \
107
    "whatis unsigned short"
108
 
109
gdb_test "whatis v_int" \
110
    "type = int" \
111
    "whatis int"
112
 
113
gdb_test "whatis v_signed_int" \
114
    "type = (signed |)int" \
115
    "whatis signed int"
116
 
117
gdb_test "whatis v_unsigned_int" \
118
    "type = unsigned int" \
119
    "whatis unsigned int"
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_long" \
125
    "type = (long|long int)" \
126
    "whatis long"
127
 
128
setup_xfail_on_long_vs_int
129
# AIX xlc gets this wrong and unsigned long right.  Go figure.
130
if {!$gcc_compiled} then {setup_xfail "rs6000-*-aix*"}
131
gdb_test "whatis v_signed_long" \
132
    "type = (signed |)(long|long int)" \
133
    "whatis signed long"
134
 
135
setup_xfail_on_long_vs_int
136
gdb_test "whatis v_unsigned_long" \
137
    "type = (unsigned long|long unsigned int)" \
138
    "whatis unsigned long"
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
gdb_test "whatis v_float_array" \
205
    "type = float \\\[2\\\]" \
206
    "whatis float array"
207
 
208
gdb_test "whatis v_double_array" \
209
    "type = double \\\[2\\\]" \
210
    "whatis double array"
211
 
212
 
213
# test whatis command with pointers
214
#
215
# We already tested whether char prints as char, so accept various perversions
216
# here.  We especially want to make sure we test that it doesn't print as
217
# caddr_t.
218
gdb_test "whatis v_char_pointer" \
219
    "type = (unsigned |signed |)char \\*" \
220
    "whatis char pointer"
221
 
222
gdb_test "whatis v_signed_char_pointer" \
223
    "type = (unsigned |signed |)char \\*" \
224
    "whatis signed char pointer"
225
 
226
gdb_test "whatis v_unsigned_char_pointer" \
227
    "type = unsigned char \\*" \
228
    "whatis unsigned char pointer"
229
 
230
gdb_test "whatis v_short_pointer" \
231
    "type = (short|short int) \\*" \
232
    "whatis short pointer"
233
 
234
gdb_test "whatis v_signed_short_pointer" \
235
    "type = (signed |)(short|short int) \\*" \
236
    "whatis signed short pointer"
237
 
238
gdb_test "whatis v_unsigned_short_pointer" \
239
    "type = (unsigned short|short unsigned int) \\*" \
240
    "whatis unsigned short pointer"
241
 
242
gdb_test "whatis v_int_pointer" \
243
    "type = int \\*" \
244
    "whatis int pointer"
245
 
246
gdb_test "whatis v_signed_int_pointer" \
247
    "type = (signed |)int \\*" \
248
    "whatis signed int pointer"
249
 
250
gdb_test "whatis v_unsigned_int_pointer" \
251
    "type = unsigned int \\*" \
252
    "whatis unsigned int pointer"
253
 
254
# We already tested whether long prints as long, so here we accept int
255
gdb_test "whatis v_long_pointer" \
256
    "type = (long|int|long int) \\*" \
257
    "whatis long pointer"
258
 
259
gdb_test "whatis v_signed_long_pointer" \
260
    "type = (signed |)(long|int|long int) \\*" \
261
    "whatis signed long pointer"
262
 
263
gdb_test "whatis v_unsigned_long_pointer" \
264
    "type = (unsigned (int|long|long int)|long unsigned int) \\*" \
265
    "whatis unsigned long pointer"
266
 
267
gdb_test "whatis v_float_pointer" \
268
    "type = float \\*" \
269
    "whatis float pointer"
270
 
271
gdb_test "whatis v_double_pointer" \
272
    "type = double \\*" \
273
    "whatis double pointer"
274
 
275
 
276
if { $hp_aCC_compiler } {
277
    set unstruct "unnamed\.struct\..*"
278
    set ununion "unnamed\.union\..*"
279
} else {
280
    set unstruct "\.\.\."
281
    set ununion "\.\.\."
282
}
283
 
284
# test whatis command with structure types
285
gdb_test "whatis v_struct1" \
286
    "type = struct t_struct" \
287
    "whatis named structure"
288
 
289
gdb_test "whatis v_struct2" \
290
    "type = struct \{$unstruct\}" \
291
    "whatis unnamed structure"
292
 
293
 
294
# test whatis command with union types
295
gdb_test "whatis v_union" \
296
    "type = union t_union" \
297
    "whatis named union"
298
 
299
gdb_test "whatis v_union2" \
300
    "type = union \{$ununion\}" \
301
    "whatis unnamed union"
302
 
303
 
304
if { [istarget "hppa*-hp-hpux*"] && $hp_aCC_compiler } {
305
    # HP-UX: HP aCC compiler w/ +objdebug option detects language as
306
    # c++, so we need the 'void' pattern here.
307
    # Without +objdebug compilation option we still need to match ''.
308
    # - guo
309
    set void "(void|)"
310
} else {
311
    set void ""
312
}
313
 
314
# test whatis command with functions return type
315
gdb_test "whatis v_char_func" \
316
    "type = (signed |unsigned |)char \\($void\\)" \
317
    "whatis char function"
318
 
319
gdb_test "whatis v_signed_char_func" \
320
    "type = (signed |unsigned |)char \\($void\\)" \
321
    "whatis signed char function"
322
 
323
gdb_test "whatis v_unsigned_char_func" \
324
    "type = unsigned char \\($void\\)"  \
325
    "whatis unsigned char function"
326
 
327
gdb_test "whatis v_short_func" \
328
    "type = short (int |)\\($void\\)" \
329
    "whatis short function"
330
 
331
gdb_test "whatis v_signed_short_func" \
332
    "type = (signed |)short (int |)\\($void\\)" \
333
    "whatis signed short function"
334
 
335
gdb_test "whatis v_unsigned_short_func" \
336
    "type = (unsigned short|short unsigned int) \\($void\\)" \
337
    "whatis unsigned short function"
338
 
339
gdb_test "whatis v_int_func" \
340
    "type = int \\($void\\)" \
341
    "whatis int function"
342
 
343
gdb_test "whatis v_signed_int_func" \
344
    "type = (signed |)int \\($void\\)" \
345
    "whatis signed int function"
346
 
347
gdb_test "whatis v_unsigned_int_func" \
348
    "type = unsigned int \\($void\\)" \
349
    "whatis unsigned int function"
350
 
351
gdb_test "whatis v_long_func" \
352
    "type = (long|int|long int) \\($void\\)" \
353
    "whatis long function"
354
 
355
gdb_test "whatis v_signed_long_func" \
356
    "type = (signed |)(int|long|long int) \\($void\\)" \
357
    "whatis signed long function"
358
 
359
gdb_test "whatis v_unsigned_long_func" \
360
    "type = (unsigned (int|long|long int)|long unsigned int) \\($void\\)" \
361
    "whatis unsigned long function"
362
 
363
# Sun /bin/cc calls this a function returning double.
364
if {!$gcc_compiled} then {setup_xfail "*-sun-sunos4*"}
365
gdb_test "whatis v_float_func" \
366
    "type = float \\($void\\)" \
367
    "whatis float function"
368
 
369
gdb_test "whatis v_double_func" \
370
    "type = double \\($void\\)" \
371
    "whatis double function" \
372
 
373
 
374
# test whatis command with some misc complicated types
375
gdb_test "whatis s_link" \
376
    "type = struct link \\*" \
377
    "whatis complicated structure"
378
 
379
gdb_test "whatis u_link" \
380
    "type = union tu_link" \
381
    "whatis complicated union"
382
 
383
 
384
# test whatis command with enumerations
385
gdb_test "whatis clunker" \
386
    "type = enum cars" \
387
    "whatis enumeration"
388
 
389
 
390
# test whatis command with nested struct and union
391
gdb_test "whatis nested_su" \
392
    "type = struct outer_struct" \
393
    "whatis outer structure"
394
 
395
gdb_test "whatis nested_su.outer_int" \
396
    "type = int" \
397
    "whatis outer structure member"
398
 
399
if {$hp_aCC_compiler} {
400
    set outer "outer_struct::"
401
} else {
402
    set outer ""
403
}
404
 
405
gdb_test "whatis nested_su.inner_struct_instance" \
406
    "type = struct ${outer}inner_struct" \
407
    "whatis inner structure"
408
 
409
gdb_test "whatis nested_su.inner_struct_instance.inner_int" \
410
    "type = int" \
411
    "whatis inner structure member"
412
 
413
gdb_test "whatis nested_su.inner_union_instance" \
414
    "type = union ${outer}inner_union" \
415
    "whatis inner union"
416
 
417
gdb_test "whatis nested_su.inner_union_instance.inner_union_int" \
418
    "type = int" \
419
    "whatis inner union member"

powered by: WebSVN 2.1.0

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