]>
Commit | Line | Data |
---|---|---|
1ab3bf1b | 1 | /* Support routines for manipulating internal types for GDB. |
a46d92a7 | 2 | Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. |
1ab3bf1b JG |
3 | Contributed by Cygnus Support, using pieces from other GDB modules. |
4 | ||
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
6c9638b4 | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
1ab3bf1b | 20 | |
1ab3bf1b | 21 | #include "defs.h" |
2b576293 | 22 | #include "gdb_string.h" |
1ab3bf1b JG |
23 | #include "bfd.h" |
24 | #include "symtab.h" | |
25 | #include "symfile.h" | |
5e2e79f8 | 26 | #include "objfiles.h" |
1ab3bf1b JG |
27 | #include "gdbtypes.h" |
28 | #include "expression.h" | |
29 | #include "language.h" | |
30 | #include "target.h" | |
31 | #include "value.h" | |
8f793aa5 | 32 | #include "demangle.h" |
51b80b00 | 33 | #include "complaints.h" |
1ab3bf1b | 34 | |
c4413e2c FF |
35 | /* These variables point to the objects |
36 | representing the predefined C data types. */ | |
37 | ||
38 | struct type *builtin_type_void; | |
39 | struct type *builtin_type_char; | |
40 | struct type *builtin_type_short; | |
41 | struct type *builtin_type_int; | |
42 | struct type *builtin_type_long; | |
43 | struct type *builtin_type_long_long; | |
44 | struct type *builtin_type_signed_char; | |
45 | struct type *builtin_type_unsigned_char; | |
46 | struct type *builtin_type_unsigned_short; | |
47 | struct type *builtin_type_unsigned_int; | |
48 | struct type *builtin_type_unsigned_long; | |
49 | struct type *builtin_type_unsigned_long_long; | |
50 | struct type *builtin_type_float; | |
51 | struct type *builtin_type_double; | |
52 | struct type *builtin_type_long_double; | |
53 | struct type *builtin_type_complex; | |
54 | struct type *builtin_type_double_complex; | |
55 | struct type *builtin_type_string; | |
980714f9 AC |
56 | struct type *builtin_type_int8; |
57 | struct type *builtin_type_uint8; | |
58 | struct type *builtin_type_int16; | |
59 | struct type *builtin_type_uint16; | |
60 | struct type *builtin_type_int32; | |
61 | struct type *builtin_type_uint32; | |
62 | struct type *builtin_type_int64; | |
63 | struct type *builtin_type_uint64; | |
64 | /* start-sanitize-r5900 */ | |
65 | struct type *builtin_type_int128; | |
66 | struct type *builtin_type_uint128; | |
67 | /* end-sanitize-r5900 */ | |
c4413e2c | 68 | |
b607efe7 FF |
69 | struct extra { char str[128]; int len; }; /* maximum extention is 128! FIXME */ |
70 | ||
71 | static void add_name PARAMS ((struct extra *, char *)); | |
72 | static void add_mangled_type PARAMS ((struct extra *, struct type *)); | |
73 | #if 0 | |
74 | static void cfront_mangle_name PARAMS ((struct type *, int, int)); | |
75 | #endif | |
76 | static void print_bit_vector PARAMS ((B_TYPE *, int)); | |
77 | static void print_arg_types PARAMS ((struct type **, int)); | |
78 | static void dump_fn_fieldlists PARAMS ((struct type *, int)); | |
79 | static void print_cplus_stuff PARAMS ((struct type *, int)); | |
80 | ||
1ab3bf1b JG |
81 | /* Alloc a new type structure and fill it with some defaults. If |
82 | OBJFILE is non-NULL, then allocate the space for the type structure | |
83 | in that objfile's type_obstack. */ | |
84 | ||
85 | struct type * | |
86 | alloc_type (objfile) | |
87 | struct objfile *objfile; | |
88 | { | |
89 | register struct type *type; | |
90 | ||
91 | /* Alloc the structure and start off with all fields zeroed. */ | |
92 | ||
93 | if (objfile == NULL) | |
94 | { | |
95 | type = (struct type *) xmalloc (sizeof (struct type)); | |
96 | } | |
97 | else | |
98 | { | |
99 | type = (struct type *) obstack_alloc (&objfile -> type_obstack, | |
100 | sizeof (struct type)); | |
2dd30c72 | 101 | OBJSTAT (objfile, n_types++); |
1ab3bf1b | 102 | } |
dac9734e | 103 | memset ((char *) type, 0, sizeof (struct type)); |
1ab3bf1b JG |
104 | |
105 | /* Initialize the fields that might not be zero. */ | |
106 | ||
107 | TYPE_CODE (type) = TYPE_CODE_UNDEF; | |
108 | TYPE_OBJFILE (type) = objfile; | |
109 | TYPE_VPTR_FIELDNO (type) = -1; | |
110 | ||
111 | return (type); | |
112 | } | |
113 | ||
ea1549b3 JG |
114 | /* Lookup a pointer to a type TYPE. TYPEPTR, if nonzero, points |
115 | to a pointer to memory where the pointer type should be stored. | |
116 | If *TYPEPTR is zero, update it to point to the pointer type we return. | |
117 | We allocate new memory if needed. */ | |
118 | ||
119 | struct type * | |
120 | make_pointer_type (type, typeptr) | |
121 | struct type *type; | |
122 | struct type **typeptr; | |
123 | { | |
124 | register struct type *ntype; /* New type */ | |
125 | struct objfile *objfile; | |
126 | ||
127 | ntype = TYPE_POINTER_TYPE (type); | |
128 | ||
129 | if (ntype) | |
130 | if (typeptr == 0) | |
131 | return ntype; /* Don't care about alloc, and have new type. */ | |
132 | else if (*typeptr == 0) | |
133 | { | |
134 | *typeptr = ntype; /* Tracking alloc, and we have new type. */ | |
135 | return ntype; | |
136 | } | |
137 | ||
138 | if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ | |
139 | { | |
140 | ntype = alloc_type (TYPE_OBJFILE (type)); | |
141 | if (typeptr) | |
142 | *typeptr = ntype; | |
143 | } | |
144 | else /* We have storage, but need to reset it. */ | |
145 | { | |
146 | ntype = *typeptr; | |
147 | objfile = TYPE_OBJFILE (ntype); | |
dac9734e | 148 | memset ((char *) ntype, 0, sizeof (struct type)); |
ea1549b3 JG |
149 | TYPE_OBJFILE (ntype) = objfile; |
150 | } | |
151 | ||
152 | TYPE_TARGET_TYPE (ntype) = type; | |
153 | TYPE_POINTER_TYPE (type) = ntype; | |
154 | ||
155 | /* FIXME! Assume the machine has only one representation for pointers! */ | |
156 | ||
157 | TYPE_LENGTH (ntype) = TARGET_PTR_BIT / TARGET_CHAR_BIT; | |
158 | TYPE_CODE (ntype) = TYPE_CODE_PTR; | |
159 | ||
160 | /* pointers are unsigned */ | |
161 | TYPE_FLAGS (ntype) |= TYPE_FLAG_UNSIGNED; | |
162 | ||
163 | if (!TYPE_POINTER_TYPE (type)) /* Remember it, if don't have one. */ | |
164 | TYPE_POINTER_TYPE (type) = ntype; | |
165 | ||
166 | return ntype; | |
167 | } | |
168 | ||
1ab3bf1b JG |
169 | /* Given a type TYPE, return a type of pointers to that type. |
170 | May need to construct such a type if this is the first use. */ | |
171 | ||
172 | struct type * | |
173 | lookup_pointer_type (type) | |
174 | struct type *type; | |
175 | { | |
ea1549b3 JG |
176 | return make_pointer_type (type, (struct type **)0); |
177 | } | |
178 | ||
179 | /* Lookup a C++ `reference' to a type TYPE. TYPEPTR, if nonzero, points | |
180 | to a pointer to memory where the reference type should be stored. | |
181 | If *TYPEPTR is zero, update it to point to the reference type we return. | |
182 | We allocate new memory if needed. */ | |
183 | ||
184 | struct type * | |
185 | make_reference_type (type, typeptr) | |
186 | struct type *type; | |
187 | struct type **typeptr; | |
188 | { | |
189 | register struct type *ntype; /* New type */ | |
190 | struct objfile *objfile; | |
191 | ||
192 | ntype = TYPE_REFERENCE_TYPE (type); | |
1ab3bf1b | 193 | |
ea1549b3 JG |
194 | if (ntype) |
195 | if (typeptr == 0) | |
196 | return ntype; /* Don't care about alloc, and have new type. */ | |
197 | else if (*typeptr == 0) | |
198 | { | |
199 | *typeptr = ntype; /* Tracking alloc, and we have new type. */ | |
200 | return ntype; | |
201 | } | |
202 | ||
203 | if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ | |
204 | { | |
205 | ntype = alloc_type (TYPE_OBJFILE (type)); | |
206 | if (typeptr) | |
207 | *typeptr = ntype; | |
208 | } | |
209 | else /* We have storage, but need to reset it. */ | |
1ab3bf1b | 210 | { |
ea1549b3 JG |
211 | ntype = *typeptr; |
212 | objfile = TYPE_OBJFILE (ntype); | |
dac9734e | 213 | memset ((char *) ntype, 0, sizeof (struct type)); |
ea1549b3 | 214 | TYPE_OBJFILE (ntype) = objfile; |
1ab3bf1b | 215 | } |
ea1549b3 JG |
216 | |
217 | TYPE_TARGET_TYPE (ntype) = type; | |
218 | TYPE_REFERENCE_TYPE (type) = ntype; | |
219 | ||
220 | /* FIXME! Assume the machine has only one representation for references, | |
221 | and that it matches the (only) representation for pointers! */ | |
222 | ||
223 | TYPE_LENGTH (ntype) = TARGET_PTR_BIT / TARGET_CHAR_BIT; | |
224 | TYPE_CODE (ntype) = TYPE_CODE_REF; | |
225 | ||
226 | if (!TYPE_REFERENCE_TYPE (type)) /* Remember it, if don't have one. */ | |
227 | TYPE_REFERENCE_TYPE (type) = ntype; | |
228 | ||
229 | return ntype; | |
1ab3bf1b JG |
230 | } |
231 | ||
ea1549b3 JG |
232 | /* Same as above, but caller doesn't care about memory allocation details. */ |
233 | ||
1ab3bf1b JG |
234 | struct type * |
235 | lookup_reference_type (type) | |
236 | struct type *type; | |
237 | { | |
ea1549b3 JG |
238 | return make_reference_type (type, (struct type **)0); |
239 | } | |
240 | ||
241 | /* Lookup a function type that returns type TYPE. TYPEPTR, if nonzero, points | |
242 | to a pointer to memory where the function type should be stored. | |
243 | If *TYPEPTR is zero, update it to point to the function type we return. | |
244 | We allocate new memory if needed. */ | |
1ab3bf1b | 245 | |
ea1549b3 JG |
246 | struct type * |
247 | make_function_type (type, typeptr) | |
248 | struct type *type; | |
249 | struct type **typeptr; | |
250 | { | |
251 | register struct type *ntype; /* New type */ | |
252 | struct objfile *objfile; | |
253 | ||
ea1549b3 | 254 | if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ |
1ab3bf1b | 255 | { |
ea1549b3 JG |
256 | ntype = alloc_type (TYPE_OBJFILE (type)); |
257 | if (typeptr) | |
258 | *typeptr = ntype; | |
1ab3bf1b | 259 | } |
ea1549b3 JG |
260 | else /* We have storage, but need to reset it. */ |
261 | { | |
262 | ntype = *typeptr; | |
263 | objfile = TYPE_OBJFILE (ntype); | |
dac9734e | 264 | memset ((char *) ntype, 0, sizeof (struct type)); |
ea1549b3 JG |
265 | TYPE_OBJFILE (ntype) = objfile; |
266 | } | |
267 | ||
268 | TYPE_TARGET_TYPE (ntype) = type; | |
ea1549b3 JG |
269 | |
270 | TYPE_LENGTH (ntype) = 1; | |
271 | TYPE_CODE (ntype) = TYPE_CODE_FUNC; | |
272 | ||
ea1549b3 | 273 | return ntype; |
1ab3bf1b JG |
274 | } |
275 | ||
ea1549b3 | 276 | |
1ab3bf1b JG |
277 | /* Given a type TYPE, return a type of functions that return that type. |
278 | May need to construct such a type if this is the first use. */ | |
279 | ||
280 | struct type * | |
281 | lookup_function_type (type) | |
282 | struct type *type; | |
283 | { | |
ea1549b3 | 284 | return make_function_type (type, (struct type **)0); |
1ab3bf1b JG |
285 | } |
286 | ||
287 | /* Implement direct support for MEMBER_TYPE in GNU C++. | |
288 | May need to construct such a type if this is the first use. | |
289 | The TYPE is the type of the member. The DOMAIN is the type | |
290 | of the aggregate that the member belongs to. */ | |
291 | ||
292 | struct type * | |
293 | lookup_member_type (type, domain) | |
294 | struct type *type; | |
295 | struct type *domain; | |
296 | { | |
297 | register struct type *mtype; | |
298 | ||
299 | mtype = alloc_type (TYPE_OBJFILE (type)); | |
300 | smash_to_member_type (mtype, domain, type); | |
301 | return (mtype); | |
302 | } | |
303 | ||
304 | /* Allocate a stub method whose return type is TYPE. | |
305 | This apparently happens for speed of symbol reading, since parsing | |
306 | out the arguments to the method is cpu-intensive, the way we are doing | |
307 | it. So, we will fill in arguments later. | |
308 | This always returns a fresh type. */ | |
309 | ||
310 | struct type * | |
311 | allocate_stub_method (type) | |
312 | struct type *type; | |
313 | { | |
314 | struct type *mtype; | |
315 | ||
316 | mtype = alloc_type (TYPE_OBJFILE (type)); | |
317 | TYPE_TARGET_TYPE (mtype) = type; | |
318 | /* _DOMAIN_TYPE (mtype) = unknown yet */ | |
319 | /* _ARG_TYPES (mtype) = unknown yet */ | |
320 | TYPE_FLAGS (mtype) = TYPE_FLAG_STUB; | |
321 | TYPE_CODE (mtype) = TYPE_CODE_METHOD; | |
322 | TYPE_LENGTH (mtype) = 1; | |
323 | return (mtype); | |
324 | } | |
325 | ||
a8a69e63 | 326 | /* Create a range type using either a blank type supplied in RESULT_TYPE, |
ec16f701 FF |
327 | or creating a new type, inheriting the objfile from INDEX_TYPE. |
328 | ||
329 | Indices will be of type INDEX_TYPE, and will range from LOW_BOUND to | |
330 | HIGH_BOUND, inclusive. | |
a8a69e63 FF |
331 | |
332 | FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make | |
333 | sure it is TYPE_CODE_UNDEF before we bash it into a range type? */ | |
334 | ||
335 | struct type * | |
336 | create_range_type (result_type, index_type, low_bound, high_bound) | |
337 | struct type *result_type; | |
338 | struct type *index_type; | |
339 | int low_bound; | |
340 | int high_bound; | |
341 | { | |
342 | if (result_type == NULL) | |
343 | { | |
344 | result_type = alloc_type (TYPE_OBJFILE (index_type)); | |
345 | } | |
346 | TYPE_CODE (result_type) = TYPE_CODE_RANGE; | |
347 | TYPE_TARGET_TYPE (result_type) = index_type; | |
e55a5796 PB |
348 | if (TYPE_FLAGS (index_type) & TYPE_FLAG_STUB) |
349 | TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB; | |
350 | else | |
d1f4065e | 351 | TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type)); |
a8a69e63 FF |
352 | TYPE_NFIELDS (result_type) = 2; |
353 | TYPE_FIELDS (result_type) = (struct field *) | |
354 | TYPE_ALLOC (result_type, 2 * sizeof (struct field)); | |
355 | memset (TYPE_FIELDS (result_type), 0, 2 * sizeof (struct field)); | |
356 | TYPE_FIELD_BITPOS (result_type, 0) = low_bound; | |
357 | TYPE_FIELD_BITPOS (result_type, 1) = high_bound; | |
358 | TYPE_FIELD_TYPE (result_type, 0) = builtin_type_int; /* FIXME */ | |
359 | TYPE_FIELD_TYPE (result_type, 1) = builtin_type_int; /* FIXME */ | |
360 | ||
361 | return (result_type); | |
362 | } | |
363 | ||
706bfe5a PB |
364 | /* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type TYPE. |
365 | Return 1 of type is a range type, 0 if it is discrete (and bounds | |
366 | will fit in LONGEST), or -1 otherwise. */ | |
367 | ||
368 | int | |
369 | get_discrete_bounds (type, lowp, highp) | |
370 | struct type *type; | |
371 | LONGEST *lowp, *highp; | |
372 | { | |
d1f4065e | 373 | CHECK_TYPEDEF (type); |
706bfe5a PB |
374 | switch (TYPE_CODE (type)) |
375 | { | |
4dda8ef3 | 376 | case TYPE_CODE_RANGE: |
706bfe5a PB |
377 | *lowp = TYPE_LOW_BOUND (type); |
378 | *highp = TYPE_HIGH_BOUND (type); | |
379 | return 1; | |
380 | case TYPE_CODE_ENUM: | |
d1f4065e PB |
381 | if (TYPE_NFIELDS (type) > 0) |
382 | { | |
d221b17e WM |
383 | /* The enums may not be sorted by value, so search all |
384 | entries */ | |
385 | int i; | |
386 | ||
387 | *lowp = *highp = TYPE_FIELD_BITPOS (type, 0); | |
388 | for (i = 0; i < TYPE_NFIELDS (type); i++) | |
389 | { | |
390 | if (TYPE_FIELD_BITPOS (type, i) < *lowp) | |
391 | *lowp = TYPE_FIELD_BITPOS (type, i); | |
392 | if (TYPE_FIELD_BITPOS (type, i) > *highp) | |
393 | *highp = TYPE_FIELD_BITPOS (type, i); | |
394 | } | |
d1f4065e PB |
395 | } |
396 | else | |
397 | { | |
398 | *lowp = 0; | |
399 | *highp = -1; | |
400 | } | |
706bfe5a PB |
401 | return 0; |
402 | case TYPE_CODE_BOOL: | |
403 | *lowp = 0; | |
404 | *highp = 1; | |
405 | return 0; | |
406 | case TYPE_CODE_INT: | |
f6d16585 | 407 | if (TYPE_LENGTH (type) > sizeof (LONGEST)) /* Too big */ |
706bfe5a PB |
408 | return -1; |
409 | if (!TYPE_UNSIGNED (type)) | |
410 | { | |
411 | *lowp = - (1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1)); | |
412 | *highp = -*lowp - 1; | |
413 | return 0; | |
414 | } | |
415 | /* ... fall through for unsigned ints ... */ | |
416 | case TYPE_CODE_CHAR: | |
417 | *lowp = 0; | |
f6d16585 PB |
418 | /* This round-about calculation is to avoid shifting by |
419 | TYPE_LENGTH (type) * TARGET_CHAR_BIT, which will not work | |
420 | if TYPE_LENGTH (type) == sizeof (LONGEST). */ | |
421 | *highp = 1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1); | |
422 | *highp = (*highp - 1) | *highp; | |
706bfe5a PB |
423 | return 0; |
424 | default: | |
425 | return -1; | |
426 | } | |
427 | } | |
428 | ||
85f0a848 | 429 | /* Create an array type using either a blank type supplied in RESULT_TYPE, |
ec16f701 FF |
430 | or creating a new type, inheriting the objfile from RANGE_TYPE. |
431 | ||
432 | Elements will be of type ELEMENT_TYPE, the indices will be of type | |
433 | RANGE_TYPE. | |
1ab3bf1b | 434 | |
85f0a848 FF |
435 | FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make |
436 | sure it is TYPE_CODE_UNDEF before we bash it into an array type? */ | |
1ab3bf1b JG |
437 | |
438 | struct type * | |
a8a69e63 | 439 | create_array_type (result_type, element_type, range_type) |
85f0a848 | 440 | struct type *result_type; |
1ab3bf1b | 441 | struct type *element_type; |
a8a69e63 | 442 | struct type *range_type; |
1ab3bf1b | 443 | { |
d1f4065e | 444 | LONGEST low_bound, high_bound; |
1ab3bf1b | 445 | |
85f0a848 FF |
446 | if (result_type == NULL) |
447 | { | |
ec16f701 | 448 | result_type = alloc_type (TYPE_OBJFILE (range_type)); |
85f0a848 | 449 | } |
1ab3bf1b JG |
450 | TYPE_CODE (result_type) = TYPE_CODE_ARRAY; |
451 | TYPE_TARGET_TYPE (result_type) = element_type; | |
d1f4065e PB |
452 | if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) |
453 | low_bound = high_bound = 0; | |
454 | CHECK_TYPEDEF (element_type); | |
85f0a848 FF |
455 | TYPE_LENGTH (result_type) = |
456 | TYPE_LENGTH (element_type) * (high_bound - low_bound + 1); | |
1ab3bf1b | 457 | TYPE_NFIELDS (result_type) = 1; |
a8a69e63 FF |
458 | TYPE_FIELDS (result_type) = |
459 | (struct field *) TYPE_ALLOC (result_type, sizeof (struct field)); | |
85f0a848 | 460 | memset (TYPE_FIELDS (result_type), 0, sizeof (struct field)); |
8050a57b | 461 | TYPE_FIELD_TYPE (result_type, 0) = range_type; |
1ab3bf1b JG |
462 | TYPE_VPTR_FIELDNO (result_type) = -1; |
463 | ||
81508b27 WM |
464 | /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays */ |
465 | if (TYPE_LENGTH (result_type) == 0) | |
466 | TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB; | |
467 | ||
1ab3bf1b JG |
468 | return (result_type); |
469 | } | |
470 | ||
c4413e2c FF |
471 | /* Create a string type using either a blank type supplied in RESULT_TYPE, |
472 | or creating a new type. String types are similar enough to array of | |
473 | char types that we can use create_array_type to build the basic type | |
474 | and then bash it into a string type. | |
475 | ||
476 | For fixed length strings, the range type contains 0 as the lower | |
477 | bound and the length of the string minus one as the upper bound. | |
478 | ||
479 | FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make | |
480 | sure it is TYPE_CODE_UNDEF before we bash it into a string type? */ | |
481 | ||
482 | struct type * | |
483 | create_string_type (result_type, range_type) | |
484 | struct type *result_type; | |
485 | struct type *range_type; | |
486 | { | |
ead95f8a PB |
487 | result_type = create_array_type (result_type, |
488 | *current_language->string_char_type, | |
489 | range_type); | |
c4413e2c FF |
490 | TYPE_CODE (result_type) = TYPE_CODE_STRING; |
491 | return (result_type); | |
492 | } | |
1ab3bf1b | 493 | |
e909f287 PB |
494 | struct type * |
495 | create_set_type (result_type, domain_type) | |
496 | struct type *result_type; | |
497 | struct type *domain_type; | |
498 | { | |
d1f4065e | 499 | LONGEST low_bound, high_bound, bit_length; |
e909f287 PB |
500 | if (result_type == NULL) |
501 | { | |
502 | result_type = alloc_type (TYPE_OBJFILE (domain_type)); | |
503 | } | |
504 | TYPE_CODE (result_type) = TYPE_CODE_SET; | |
505 | TYPE_NFIELDS (result_type) = 1; | |
506 | TYPE_FIELDS (result_type) = (struct field *) | |
507 | TYPE_ALLOC (result_type, 1 * sizeof (struct field)); | |
508 | memset (TYPE_FIELDS (result_type), 0, sizeof (struct field)); | |
576f9770 PB |
509 | |
510 | if (! (TYPE_FLAGS (domain_type) & TYPE_FLAG_STUB)) | |
511 | { | |
d1f4065e PB |
512 | if (get_discrete_bounds (domain_type, &low_bound, &high_bound) < 0) |
513 | low_bound = high_bound = 0; | |
576f9770 PB |
514 | bit_length = high_bound - low_bound + 1; |
515 | TYPE_LENGTH (result_type) | |
b4680522 | 516 | = (bit_length + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT; |
576f9770 | 517 | } |
e909f287 | 518 | TYPE_FIELD_TYPE (result_type, 0) = domain_type; |
e909f287 PB |
519 | return (result_type); |
520 | } | |
521 | ||
1ab3bf1b JG |
522 | /* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE. |
523 | A MEMBER is a wierd thing -- it amounts to a typed offset into | |
524 | a struct, e.g. "an int at offset 8". A MEMBER TYPE doesn't | |
525 | include the offset (that's the value of the MEMBER itself), but does | |
526 | include the structure type into which it points (for some reason). | |
527 | ||
c2e4669f | 528 | When "smashing" the type, we preserve the objfile that the |
1ab3bf1b | 529 | old type pointed to, since we aren't changing where the type is actually |
c2e4669f | 530 | allocated. */ |
1ab3bf1b JG |
531 | |
532 | void | |
533 | smash_to_member_type (type, domain, to_type) | |
534 | struct type *type; | |
535 | struct type *domain; | |
536 | struct type *to_type; | |
537 | { | |
538 | struct objfile *objfile; | |
539 | ||
540 | objfile = TYPE_OBJFILE (type); | |
541 | ||
dac9734e | 542 | memset ((char *) type, 0, sizeof (struct type)); |
1ab3bf1b JG |
543 | TYPE_OBJFILE (type) = objfile; |
544 | TYPE_TARGET_TYPE (type) = to_type; | |
545 | TYPE_DOMAIN_TYPE (type) = domain; | |
546 | TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */ | |
547 | TYPE_CODE (type) = TYPE_CODE_MEMBER; | |
548 | } | |
549 | ||
550 | /* Smash TYPE to be a type of method of DOMAIN with type TO_TYPE. | |
551 | METHOD just means `function that gets an extra "this" argument'. | |
552 | ||
c2e4669f | 553 | When "smashing" the type, we preserve the objfile that the |
1ab3bf1b | 554 | old type pointed to, since we aren't changing where the type is actually |
c2e4669f | 555 | allocated. */ |
1ab3bf1b JG |
556 | |
557 | void | |
558 | smash_to_method_type (type, domain, to_type, args) | |
559 | struct type *type; | |
560 | struct type *domain; | |
561 | struct type *to_type; | |
562 | struct type **args; | |
563 | { | |
564 | struct objfile *objfile; | |
565 | ||
566 | objfile = TYPE_OBJFILE (type); | |
567 | ||
dac9734e | 568 | memset ((char *) type, 0, sizeof (struct type)); |
1ab3bf1b JG |
569 | TYPE_OBJFILE (type) = objfile; |
570 | TYPE_TARGET_TYPE (type) = to_type; | |
571 | TYPE_DOMAIN_TYPE (type) = domain; | |
572 | TYPE_ARG_TYPES (type) = args; | |
573 | TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */ | |
574 | TYPE_CODE (type) = TYPE_CODE_METHOD; | |
575 | } | |
576 | ||
b2bebdb0 JK |
577 | /* Return a typename for a struct/union/enum type without "struct ", |
578 | "union ", or "enum ". If the type has a NULL name, return NULL. */ | |
1ab3bf1b JG |
579 | |
580 | char * | |
581 | type_name_no_tag (type) | |
582 | register const struct type *type; | |
583 | { | |
b2bebdb0 JK |
584 | if (TYPE_TAG_NAME (type) != NULL) |
585 | return TYPE_TAG_NAME (type); | |
1ab3bf1b | 586 | |
b2bebdb0 JK |
587 | /* Is there code which expects this to return the name if there is no |
588 | tag name? My guess is that this is mainly used for C++ in cases where | |
589 | the two will always be the same. */ | |
590 | return TYPE_NAME (type); | |
1ab3bf1b JG |
591 | } |
592 | ||
593 | /* Lookup a primitive type named NAME. | |
594 | Return zero if NAME is not a primitive type.*/ | |
595 | ||
596 | struct type * | |
597 | lookup_primitive_typename (name) | |
598 | char *name; | |
599 | { | |
600 | struct type ** const *p; | |
601 | ||
602 | for (p = current_language -> la_builtin_type_vector; *p != NULL; p++) | |
603 | { | |
2e4964ad | 604 | if (STREQ ((**p) -> name, name)) |
1ab3bf1b JG |
605 | { |
606 | return (**p); | |
607 | } | |
608 | } | |
609 | return (NULL); | |
610 | } | |
611 | ||
612 | /* Lookup a typedef or primitive type named NAME, | |
613 | visible in lexical block BLOCK. | |
614 | If NOERR is nonzero, return zero if NAME is not suitably defined. */ | |
615 | ||
616 | struct type * | |
617 | lookup_typename (name, block, noerr) | |
618 | char *name; | |
619 | struct block *block; | |
620 | int noerr; | |
621 | { | |
622 | register struct symbol *sym; | |
623 | register struct type *tmp; | |
624 | ||
625 | sym = lookup_symbol (name, block, VAR_NAMESPACE, 0, (struct symtab **) NULL); | |
626 | if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF) | |
627 | { | |
628 | tmp = lookup_primitive_typename (name); | |
629 | if (tmp) | |
630 | { | |
631 | return (tmp); | |
632 | } | |
633 | else if (!tmp && noerr) | |
634 | { | |
635 | return (NULL); | |
636 | } | |
637 | else | |
638 | { | |
639 | error ("No type named %s.", name); | |
640 | } | |
641 | } | |
642 | return (SYMBOL_TYPE (sym)); | |
643 | } | |
644 | ||
645 | struct type * | |
646 | lookup_unsigned_typename (name) | |
647 | char *name; | |
648 | { | |
649 | char *uns = alloca (strlen (name) + 10); | |
650 | ||
651 | strcpy (uns, "unsigned "); | |
652 | strcpy (uns + 9, name); | |
653 | return (lookup_typename (uns, (struct block *) NULL, 0)); | |
654 | } | |
655 | ||
a252e715 PB |
656 | struct type * |
657 | lookup_signed_typename (name) | |
658 | char *name; | |
659 | { | |
660 | struct type *t; | |
661 | char *uns = alloca (strlen (name) + 8); | |
662 | ||
663 | strcpy (uns, "signed "); | |
664 | strcpy (uns + 7, name); | |
665 | t = lookup_typename (uns, (struct block *) NULL, 1); | |
666 | /* If we don't find "signed FOO" just try again with plain "FOO". */ | |
667 | if (t != NULL) | |
668 | return t; | |
669 | return lookup_typename (name, (struct block *) NULL, 0); | |
670 | } | |
671 | ||
1ab3bf1b JG |
672 | /* Lookup a structure type named "struct NAME", |
673 | visible in lexical block BLOCK. */ | |
674 | ||
675 | struct type * | |
676 | lookup_struct (name, block) | |
677 | char *name; | |
678 | struct block *block; | |
679 | { | |
680 | register struct symbol *sym; | |
681 | ||
682 | sym = lookup_symbol (name, block, STRUCT_NAMESPACE, 0, | |
683 | (struct symtab **) NULL); | |
684 | ||
685 | if (sym == NULL) | |
686 | { | |
687 | error ("No struct type named %s.", name); | |
688 | } | |
2640f7e1 JG |
689 | if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT) |
690 | { | |
691 | error ("This context has class, union or enum %s, not a struct.", name); | |
692 | } | |
693 | return (SYMBOL_TYPE (sym)); | |
1ab3bf1b JG |
694 | } |
695 | ||
696 | /* Lookup a union type named "union NAME", | |
697 | visible in lexical block BLOCK. */ | |
698 | ||
699 | struct type * | |
700 | lookup_union (name, block) | |
701 | char *name; | |
702 | struct block *block; | |
703 | { | |
704 | register struct symbol *sym; | |
705 | ||
706 | sym = lookup_symbol (name, block, STRUCT_NAMESPACE, 0, | |
707 | (struct symtab **) NULL); | |
708 | ||
709 | if (sym == NULL) | |
710 | { | |
711 | error ("No union type named %s.", name); | |
712 | } | |
2640f7e1 JG |
713 | if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_UNION) |
714 | { | |
715 | error ("This context has class, struct or enum %s, not a union.", name); | |
716 | } | |
717 | return (SYMBOL_TYPE (sym)); | |
1ab3bf1b JG |
718 | } |
719 | ||
720 | /* Lookup an enum type named "enum NAME", | |
721 | visible in lexical block BLOCK. */ | |
722 | ||
723 | struct type * | |
724 | lookup_enum (name, block) | |
725 | char *name; | |
726 | struct block *block; | |
727 | { | |
728 | register struct symbol *sym; | |
729 | ||
730 | sym = lookup_symbol (name, block, STRUCT_NAMESPACE, 0, | |
731 | (struct symtab **) NULL); | |
732 | if (sym == NULL) | |
733 | { | |
734 | error ("No enum type named %s.", name); | |
735 | } | |
2640f7e1 JG |
736 | if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_ENUM) |
737 | { | |
738 | error ("This context has class, struct or union %s, not an enum.", name); | |
739 | } | |
740 | return (SYMBOL_TYPE (sym)); | |
1ab3bf1b JG |
741 | } |
742 | ||
743 | /* Lookup a template type named "template NAME<TYPE>", | |
744 | visible in lexical block BLOCK. */ | |
745 | ||
746 | struct type * | |
747 | lookup_template_type (name, type, block) | |
748 | char *name; | |
749 | struct type *type; | |
750 | struct block *block; | |
751 | { | |
752 | struct symbol *sym; | |
753 | char *nam = (char*) alloca(strlen(name) + strlen(type->name) + 4); | |
754 | strcpy (nam, name); | |
755 | strcat (nam, "<"); | |
756 | strcat (nam, type->name); | |
757 | strcat (nam, " >"); /* FIXME, extra space still introduced in gcc? */ | |
758 | ||
759 | sym = lookup_symbol (nam, block, VAR_NAMESPACE, 0, (struct symtab **)NULL); | |
760 | ||
761 | if (sym == NULL) | |
762 | { | |
763 | error ("No template type named %s.", name); | |
764 | } | |
765 | if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT) | |
766 | { | |
767 | error ("This context has class, union or enum %s, not a struct.", name); | |
768 | } | |
769 | return (SYMBOL_TYPE (sym)); | |
770 | } | |
771 | ||
edf67bd1 | 772 | /* Given a type TYPE, lookup the type of the component of type named NAME. |
45364c8a FF |
773 | |
774 | TYPE can be either a struct or union, or a pointer or reference to a struct or | |
775 | union. If it is a pointer or reference, its target type is automatically used. | |
776 | Thus '.' and '->' are interchangable, as specified for the definitions of the | |
777 | expression element types STRUCTOP_STRUCT and STRUCTOP_PTR. | |
778 | ||
edf67bd1 MT |
779 | If NOERR is nonzero, return zero if NAME is not suitably defined. |
780 | If NAME is the name of a baseclass type, return that type. */ | |
1ab3bf1b JG |
781 | |
782 | struct type * | |
783 | lookup_struct_elt_type (type, name, noerr) | |
784 | struct type *type; | |
785 | char *name; | |
786 | int noerr; | |
787 | { | |
788 | int i; | |
789 | ||
d1f4065e PB |
790 | for (;;) |
791 | { | |
792 | CHECK_TYPEDEF (type); | |
793 | if (TYPE_CODE (type) != TYPE_CODE_PTR | |
794 | && TYPE_CODE (type) != TYPE_CODE_REF) | |
795 | break; | |
5c5b5d4b | 796 | type = TYPE_TARGET_TYPE (type); |
d1f4065e | 797 | } |
5c5b5d4b | 798 | |
1ab3bf1b JG |
799 | if (TYPE_CODE (type) != TYPE_CODE_STRUCT && |
800 | TYPE_CODE (type) != TYPE_CODE_UNION) | |
801 | { | |
802 | target_terminal_ours (); | |
199b2450 TL |
803 | gdb_flush (gdb_stdout); |
804 | fprintf_unfiltered (gdb_stderr, "Type "); | |
805 | type_print (type, "", gdb_stderr, -1); | |
1ab3bf1b JG |
806 | error (" is not a structure or union type."); |
807 | } | |
808 | ||
45364c8a FF |
809 | #if 0 |
810 | /* FIXME: This change put in by Michael seems incorrect for the case where | |
811 | the structure tag name is the same as the member name. I.E. when doing | |
812 | "ptype bell->bar" for "struct foo { int bar; int foo; } bell;" | |
813 | Disabled by fnf. */ | |
e7bf1152 RP |
814 | { |
815 | char *typename; | |
816 | ||
817 | typename = type_name_no_tag (type); | |
818 | if (typename != NULL && STREQ (typename, name)) | |
819 | return type; | |
820 | } | |
45364c8a | 821 | #endif |
edf67bd1 | 822 | |
1ab3bf1b JG |
823 | for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--) |
824 | { | |
825 | char *t_field_name = TYPE_FIELD_NAME (type, i); | |
826 | ||
2e4964ad | 827 | if (t_field_name && STREQ (t_field_name, name)) |
1ab3bf1b JG |
828 | { |
829 | return TYPE_FIELD_TYPE (type, i); | |
830 | } | |
831 | } | |
832 | ||
833 | /* OK, it's not in this class. Recursively check the baseclasses. */ | |
834 | for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--) | |
835 | { | |
836 | struct type *t; | |
837 | ||
d112a0c6 | 838 | t = lookup_struct_elt_type (TYPE_BASECLASS (type, i), name, noerr); |
1ab3bf1b JG |
839 | if (t != NULL) |
840 | { | |
841 | return t; | |
842 | } | |
843 | } | |
844 | ||
845 | if (noerr) | |
846 | { | |
847 | return NULL; | |
848 | } | |
849 | ||
850 | target_terminal_ours (); | |
199b2450 TL |
851 | gdb_flush (gdb_stdout); |
852 | fprintf_unfiltered (gdb_stderr, "Type "); | |
853 | type_print (type, "", gdb_stderr, -1); | |
854 | fprintf_unfiltered (gdb_stderr, " has no component named "); | |
855 | fputs_filtered (name, gdb_stderr); | |
1ab3bf1b JG |
856 | error ("."); |
857 | return (struct type *)-1; /* For lint */ | |
858 | } | |
859 | ||
ac88287f JK |
860 | /* If possible, make the vptr_fieldno and vptr_basetype fields of TYPE |
861 | valid. Callers should be aware that in some cases (for example, | |
862 | the type or one of its baseclasses is a stub type and we are | |
863 | debugging a .o file), this function will not be able to find the virtual | |
864 | function table pointer, and vptr_fieldno will remain -1 and vptr_basetype | |
865 | will remain NULL. */ | |
1ab3bf1b JG |
866 | |
867 | void | |
868 | fill_in_vptr_fieldno (type) | |
869 | struct type *type; | |
870 | { | |
d1f4065e | 871 | CHECK_TYPEDEF (type); |
ac88287f | 872 | |
1ab3bf1b JG |
873 | if (TYPE_VPTR_FIELDNO (type) < 0) |
874 | { | |
875 | int i; | |
edf67bd1 MT |
876 | |
877 | /* We must start at zero in case the first (and only) baseclass is | |
878 | virtual (and hence we cannot share the table pointer). */ | |
879 | for (i = 0; i < TYPE_N_BASECLASSES (type); i++) | |
1ab3bf1b JG |
880 | { |
881 | fill_in_vptr_fieldno (TYPE_BASECLASS (type, i)); | |
882 | if (TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type, i)) >= 0) | |
883 | { | |
884 | TYPE_VPTR_FIELDNO (type) | |
885 | = TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type, i)); | |
886 | TYPE_VPTR_BASETYPE (type) | |
887 | = TYPE_VPTR_BASETYPE (TYPE_BASECLASS (type, i)); | |
888 | break; | |
889 | } | |
890 | } | |
891 | } | |
892 | } | |
893 | ||
a46d92a7 PS |
894 | /* Find the method and field indices for the destructor in class type T. |
895 | Return 1 if the destructor was found, otherwise, return 0. */ | |
896 | ||
897 | int | |
898 | get_destructor_fn_field (t, method_indexp, field_indexp) | |
899 | struct type *t; | |
900 | int *method_indexp; | |
901 | int *field_indexp; | |
902 | { | |
903 | int i; | |
904 | ||
905 | for (i = 0; i < TYPE_NFN_FIELDS (t); i++) | |
906 | { | |
907 | int j; | |
908 | struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i); | |
909 | ||
910 | for (j = 0; j < TYPE_FN_FIELDLIST_LENGTH (t, i); j++) | |
911 | { | |
912 | if (DESTRUCTOR_PREFIX_P (TYPE_FN_FIELD_PHYSNAME (f, j))) | |
913 | { | |
914 | *method_indexp = i; | |
915 | *field_indexp = j; | |
916 | return 1; | |
917 | } | |
918 | } | |
919 | } | |
920 | return 0; | |
921 | } | |
922 | ||
1ab3bf1b JG |
923 | /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989. |
924 | ||
925 | If this is a stubbed struct (i.e. declared as struct foo *), see if | |
926 | we can find a full definition in some other file. If so, copy this | |
dda398c3 JK |
927 | definition, so we can use it in future. There used to be a comment (but |
928 | not any code) that if we don't find a full definition, we'd set a flag | |
929 | so we don't spend time in the future checking the same type. That would | |
930 | be a mistake, though--we might load in more symbols which contain a | |
931 | full definition for the type. | |
1ab3bf1b JG |
932 | |
933 | This used to be coded as a macro, but I don't think it is called | |
dda398c3 | 934 | often enough to merit such treatment. */ |
1ab3bf1b JG |
935 | |
936 | struct complaint stub_noname_complaint = | |
937 | {"stub type has NULL name", 0, 0}; | |
938 | ||
d1f4065e PB |
939 | struct type * |
940 | check_typedef (type) | |
941 | register struct type *type; | |
942 | { | |
943 | struct type *orig_type = type; | |
944 | while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) | |
945 | { | |
946 | if (!TYPE_TARGET_TYPE (type)) | |
947 | { | |
7ef89313 PB |
948 | char* name; |
949 | struct symbol *sym; | |
950 | ||
951 | /* It is dangerous to call lookup_symbol if we are currently | |
952 | reading a symtab. Infinite recursion is one danger. */ | |
953 | if (currently_reading_symtab) | |
954 | return type; | |
955 | ||
956 | name = type_name_no_tag (type); | |
d1f4065e PB |
957 | /* FIXME: shouldn't we separately check the TYPE_NAME and the |
958 | TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE | |
959 | as appropriate? (this code was written before TYPE_NAME and | |
960 | TYPE_TAG_NAME were separate). */ | |
d1f4065e PB |
961 | if (name == NULL) |
962 | { | |
963 | complain (&stub_noname_complaint); | |
964 | return type; | |
965 | } | |
966 | sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0, | |
967 | (struct symtab **) NULL); | |
968 | if (sym) | |
969 | TYPE_TARGET_TYPE (type) = SYMBOL_TYPE (sym); | |
970 | else | |
971 | TYPE_TARGET_TYPE (type) = alloc_type (NULL); /* TYPE_CODE_UNDEF */ | |
972 | } | |
973 | type = TYPE_TARGET_TYPE (type); | |
974 | } | |
975 | ||
7ef89313 | 976 | if ((TYPE_FLAGS(type) & TYPE_FLAG_STUB) && ! currently_reading_symtab) |
1ab3bf1b JG |
977 | { |
978 | char* name = type_name_no_tag (type); | |
065525e3 JK |
979 | /* FIXME: shouldn't we separately check the TYPE_NAME and the |
980 | TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE | |
981 | as appropriate? (this code was written before TYPE_NAME and | |
982 | TYPE_TAG_NAME were separate). */ | |
1ab3bf1b JG |
983 | struct symbol *sym; |
984 | if (name == NULL) | |
985 | { | |
51b80b00 | 986 | complain (&stub_noname_complaint); |
d1f4065e | 987 | return type; |
1ab3bf1b JG |
988 | } |
989 | sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0, | |
990 | (struct symtab **) NULL); | |
991 | if (sym) | |
992 | { | |
dda398c3 JK |
993 | memcpy ((char *)type, |
994 | (char *)SYMBOL_TYPE(sym), | |
995 | sizeof (struct type)); | |
996 | } | |
997 | } | |
998 | ||
999 | if (TYPE_FLAGS (type) & TYPE_FLAG_TARGET_STUB) | |
1000 | { | |
1001 | struct type *range_type; | |
d1f4065e | 1002 | struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); |
dda398c3 | 1003 | |
dd600735 | 1004 | if (TYPE_FLAGS (target_type) & (TYPE_FLAG_STUB | TYPE_FLAG_TARGET_STUB)) |
e55a5796 PB |
1005 | { } |
1006 | else if (TYPE_CODE (type) == TYPE_CODE_ARRAY | |
1007 | && TYPE_NFIELDS (type) == 1 | |
1008 | && (TYPE_CODE (range_type = TYPE_FIELD_TYPE (type, 0)) | |
1009 | == TYPE_CODE_RANGE)) | |
dda398c3 JK |
1010 | { |
1011 | /* Now recompute the length of the array type, based on its | |
1012 | number of elements and the target type's length. */ | |
1013 | TYPE_LENGTH (type) = | |
1014 | ((TYPE_FIELD_BITPOS (range_type, 1) | |
1015 | - TYPE_FIELD_BITPOS (range_type, 0) | |
1016 | + 1) | |
d1f4065e | 1017 | * TYPE_LENGTH (target_type)); |
dda398c3 | 1018 | TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB; |
1ab3bf1b | 1019 | } |
e55a5796 PB |
1020 | else if (TYPE_CODE (type) == TYPE_CODE_RANGE) |
1021 | { | |
d1f4065e | 1022 | TYPE_LENGTH (type) = TYPE_LENGTH (target_type); |
e55a5796 PB |
1023 | TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB; |
1024 | } | |
1ab3bf1b | 1025 | } |
d1f4065e PB |
1026 | /* Cache TYPE_LENGTH for future use. */ |
1027 | TYPE_LENGTH (orig_type) = TYPE_LENGTH (type); | |
1028 | return type; | |
1ab3bf1b JG |
1029 | } |
1030 | ||
94f5a25f DP |
1031 | /* New code added to support parsing of Cfront stabs strings */ |
1032 | #include <ctype.h> | |
1033 | #define INIT_EXTRA { pextras->len=0; pextras->str[0]='\0'; } | |
1034 | #define ADD_EXTRA(c) { pextras->str[pextras->len++]=c; } | |
b607efe7 FF |
1035 | |
1036 | static void | |
94f5a25f DP |
1037 | add_name(pextras,n) |
1038 | struct extra * pextras; | |
1039 | char * n; | |
1040 | { | |
b607efe7 FF |
1041 | int nlen; |
1042 | ||
94f5a25f DP |
1043 | if ((nlen = (n ? strlen(n) : 0))==0) |
1044 | return; | |
1045 | sprintf(pextras->str+pextras->len,"%d%s",nlen,n); | |
1046 | pextras->len=strlen(pextras->str); | |
1047 | } | |
1048 | ||
b607efe7 | 1049 | static void |
94f5a25f DP |
1050 | add_mangled_type(pextras,t) |
1051 | struct extra * pextras; | |
1052 | struct type * t; | |
1053 | { | |
1054 | enum type_code tcode; | |
1055 | int tlen, tflags; | |
1056 | char * tname; | |
1057 | ||
1058 | tcode = TYPE_CODE(t); | |
1059 | tlen = TYPE_LENGTH(t); | |
1060 | tflags = TYPE_FLAGS(t); | |
1061 | tname = TYPE_NAME(t); | |
1062 | /* args of "..." seem to get mangled as "e" */ | |
1063 | ||
1064 | switch (tcode) | |
1065 | { | |
1066 | case TYPE_CODE_INT: | |
1067 | if (tflags==1) | |
1068 | ADD_EXTRA('U'); | |
1069 | switch (tlen) | |
1070 | { | |
1071 | case 1: | |
1072 | ADD_EXTRA('c'); | |
1073 | break; | |
1074 | case 2: | |
1075 | ADD_EXTRA('s'); | |
1076 | break; | |
1077 | case 4: | |
1078 | { | |
1079 | char* pname; | |
1080 | if ((pname=strrchr(tname,'l'),pname) && !strcmp(pname,"long")) | |
1081 | ADD_EXTRA('l') | |
1082 | else | |
1083 | ADD_EXTRA('i') | |
1084 | } | |
1085 | break; | |
1086 | default: | |
1087 | { | |
1088 | ||
1089 | static struct complaint msg = {"Bad int type code length x%x\n",0,0}; | |
1090 | ||
1091 | complain (&msg, tlen); | |
1092 | ||
1093 | } | |
1094 | } | |
1095 | break; | |
1096 | case TYPE_CODE_FLT: | |
1097 | switch (tlen) | |
1098 | { | |
1099 | case 4: | |
1100 | ADD_EXTRA('f'); | |
1101 | break; | |
1102 | case 8: | |
1103 | ADD_EXTRA('d'); | |
1104 | break; | |
1105 | case 16: | |
1106 | ADD_EXTRA('r'); | |
1107 | break; | |
1108 | default: | |
1109 | { | |
1110 | static struct complaint msg = {"Bad float type code length x%x\n",0,0}; | |
1111 | complain (&msg, tlen); | |
1112 | } | |
1113 | } | |
1114 | break; | |
1115 | case TYPE_CODE_REF: | |
1116 | ADD_EXTRA('R'); | |
1117 | /* followed by what it's a ref to */ | |
1118 | break; | |
1119 | case TYPE_CODE_PTR: | |
1120 | ADD_EXTRA('P'); | |
1121 | /* followed by what it's a ptr to */ | |
1122 | break; | |
1123 | case TYPE_CODE_TYPEDEF: | |
1124 | { | |
1125 | static struct complaint msg = {"Typedefs in overloaded functions not yet supported\n",0,0}; | |
1126 | complain (&msg); | |
1127 | } | |
1128 | /* followed by type bytes & name */ | |
1129 | break; | |
1130 | case TYPE_CODE_FUNC: | |
1131 | ADD_EXTRA('F'); | |
1132 | /* followed by func's arg '_' & ret types */ | |
1133 | break; | |
1134 | case TYPE_CODE_VOID: | |
1135 | ADD_EXTRA('v'); | |
1136 | break; | |
1137 | case TYPE_CODE_METHOD: | |
1138 | ADD_EXTRA('M'); | |
1139 | /* followed by name of class and func's arg '_' & ret types */ | |
1140 | add_name(pextras,tname); | |
1141 | ADD_EXTRA('F'); /* then mangle function */ | |
1142 | break; | |
1143 | case TYPE_CODE_STRUCT: /* C struct */ | |
1144 | case TYPE_CODE_UNION: /* C union */ | |
1145 | case TYPE_CODE_ENUM: /* Enumeration type */ | |
1146 | /* followed by name of type */ | |
1147 | add_name(pextras,tname); | |
1148 | break; | |
1149 | ||
1150 | /* errors possible types/not supported */ | |
1151 | case TYPE_CODE_CHAR: | |
1152 | case TYPE_CODE_ARRAY: /* Array type */ | |
1153 | case TYPE_CODE_MEMBER: /* Member type */ | |
1154 | case TYPE_CODE_BOOL: | |
1155 | case TYPE_CODE_COMPLEX: /* Complex float */ | |
1156 | case TYPE_CODE_UNDEF: | |
1157 | case TYPE_CODE_SET: /* Pascal sets */ | |
1158 | case TYPE_CODE_RANGE: | |
1159 | case TYPE_CODE_STRING: | |
1160 | case TYPE_CODE_BITSTRING: | |
1161 | case TYPE_CODE_ERROR: | |
1162 | default: | |
1163 | { | |
1164 | static struct complaint msg = {"Unknown type code x%x\n",0,0}; | |
1165 | complain (&msg, tcode); | |
1166 | } | |
1167 | } | |
1168 | if (t->target_type) | |
1169 | add_mangled_type(pextras,t->target_type); | |
1170 | } | |
1171 | ||
b607efe7 FF |
1172 | #if 0 |
1173 | void | |
94f5a25f DP |
1174 | cfront_mangle_name(type, i, j) |
1175 | struct type *type; | |
1176 | int i; | |
1177 | int j; | |
1178 | { | |
1179 | struct fn_field *f; | |
1180 | char *mangled_name = gdb_mangle_name (type, i, j); | |
1181 | ||
1182 | f = TYPE_FN_FIELDLIST1 (type, i); /* moved from below */ | |
1183 | ||
1184 | /* kludge to support cfront methods - gdb expects to find "F" for | |
1185 | ARM_mangled names, so when we mangle, we have to add it here */ | |
1186 | if (ARM_DEMANGLING) | |
1187 | { | |
1188 | int k; | |
1189 | char * arm_mangled_name; | |
1190 | struct fn_field *method = &f[j]; | |
1191 | char *field_name = TYPE_FN_FIELDLIST_NAME (type, i); | |
1192 | char *physname = TYPE_FN_FIELD_PHYSNAME (f, j); | |
1193 | char *newname = type_name_no_tag (type); | |
1194 | ||
1195 | struct type *ftype = TYPE_FN_FIELD_TYPE (f, j); | |
1196 | int nargs = TYPE_NFIELDS(ftype); /* number of args */ | |
1197 | struct extra extras, * pextras = &extras; | |
1198 | INIT_EXTRA | |
1199 | ||
1200 | if (TYPE_FN_FIELD_STATIC_P (f, j)) /* j for sublist within this list */ | |
1201 | ADD_EXTRA('S') | |
1202 | ADD_EXTRA('F') | |
1203 | /* add args here! */ | |
1204 | if (nargs <= 1) /* no args besides this */ | |
1205 | ADD_EXTRA('v') | |
1206 | else { | |
1207 | for (k=1; k<nargs; k++) | |
1208 | { | |
1209 | struct type * t; | |
1210 | t = TYPE_FIELD_TYPE(ftype,k); | |
1211 | add_mangled_type(pextras,t); | |
1212 | } | |
1213 | } | |
1214 | ADD_EXTRA('\0') | |
1215 | printf("add_mangled_type: %s\n",extras.str); /* FIXME */ | |
1216 | arm_mangled_name = malloc(strlen(mangled_name)+extras.len); | |
1217 | sprintf(arm_mangled_name,"%s%s",mangled_name,extras.str); | |
1218 | free(mangled_name); | |
1219 | mangled_name = arm_mangled_name; | |
1220 | } | |
1221 | } | |
b607efe7 FF |
1222 | #endif /* 0 */ |
1223 | ||
94f5a25f DP |
1224 | #undef ADD_EXTRA |
1225 | /* End of new code added to support parsing of Cfront stabs strings */ | |
1226 | ||
1ab3bf1b JG |
1227 | /* Ugly hack to convert method stubs into method types. |
1228 | ||
1229 | He ain't kiddin'. This demangles the name of the method into a string | |
1230 | including argument types, parses out each argument type, generates | |
1231 | a string casting a zero to that type, evaluates the string, and stuffs | |
1232 | the resulting type into an argtype vector!!! Then it knows the type | |
1233 | of the whole function (including argument types for overloading), | |
1234 | which info used to be in the stab's but was removed to hack back | |
1235 | the space required for them. */ | |
1236 | ||
1237 | void | |
1238 | check_stub_method (type, i, j) | |
1239 | struct type *type; | |
1240 | int i; | |
1241 | int j; | |
1242 | { | |
1243 | struct fn_field *f; | |
1244 | char *mangled_name = gdb_mangle_name (type, i, j); | |
8050a57b FF |
1245 | char *demangled_name = cplus_demangle (mangled_name, |
1246 | DMGL_PARAMS | DMGL_ANSI); | |
1ab3bf1b JG |
1247 | char *argtypetext, *p; |
1248 | int depth = 0, argcount = 1; | |
1249 | struct type **argtypes; | |
1250 | struct type *mtype; | |
1251 | ||
e045712f BK |
1252 | /* Make sure we got back a function string that we can use. */ |
1253 | if (demangled_name) | |
1254 | p = strchr (demangled_name, '('); | |
1255 | ||
1256 | if (demangled_name == NULL || p == NULL) | |
1257 | error ("Internal: Cannot demangle mangled name `%s'.", mangled_name); | |
1ab3bf1b JG |
1258 | |
1259 | /* Now, read in the parameters that define this type. */ | |
e045712f BK |
1260 | p += 1; |
1261 | argtypetext = p; | |
1ab3bf1b JG |
1262 | while (*p) |
1263 | { | |
1264 | if (*p == '(') | |
1265 | { | |
1266 | depth += 1; | |
1267 | } | |
1268 | else if (*p == ')') | |
1269 | { | |
1270 | depth -= 1; | |
1271 | } | |
1272 | else if (*p == ',' && depth == 0) | |
1273 | { | |
1274 | argcount += 1; | |
1275 | } | |
1276 | ||
1277 | p += 1; | |
1278 | } | |
1279 | ||
1280 | /* We need two more slots: one for the THIS pointer, and one for the | |
1281 | NULL [...] or void [end of arglist]. */ | |
1282 | ||
1283 | argtypes = (struct type **) | |
dac9734e | 1284 | TYPE_ALLOC (type, (argcount + 2) * sizeof (struct type *)); |
1ab3bf1b | 1285 | p = argtypetext; |
e552788b | 1286 | /* FIXME: This is wrong for static member functions. */ |
1ab3bf1b JG |
1287 | argtypes[0] = lookup_pointer_type (type); |
1288 | argcount = 1; | |
1289 | ||
1290 | if (*p != ')') /* () means no args, skip while */ | |
1291 | { | |
1292 | depth = 0; | |
1293 | while (*p) | |
1294 | { | |
1295 | if (depth <= 0 && (*p == ',' || *p == ')')) | |
1296 | { | |
393e55ba JK |
1297 | /* Avoid parsing of ellipsis, they will be handled below. */ |
1298 | if (strncmp (argtypetext, "...", p - argtypetext) != 0) | |
1299 | { | |
1300 | argtypes[argcount] = | |
1301 | parse_and_eval_type (argtypetext, p - argtypetext); | |
1302 | argcount += 1; | |
1303 | } | |
1ab3bf1b JG |
1304 | argtypetext = p + 1; |
1305 | } | |
1306 | ||
1307 | if (*p == '(') | |
1308 | { | |
1309 | depth += 1; | |
1310 | } | |
1311 | else if (*p == ')') | |
1312 | { | |
1313 | depth -= 1; | |
1314 | } | |
1315 | ||
1316 | p += 1; | |
1317 | } | |
1318 | } | |
1319 | ||
c0f1085b | 1320 | if (p[-2] != '.') /* Not '...' */ |
1ab3bf1b | 1321 | { |
c0f1085b | 1322 | argtypes[argcount] = builtin_type_void; /* List terminator */ |
1ab3bf1b JG |
1323 | } |
1324 | else | |
1325 | { | |
c0f1085b | 1326 | argtypes[argcount] = NULL; /* Ellist terminator */ |
1ab3bf1b JG |
1327 | } |
1328 | ||
1329 | free (demangled_name); | |
1330 | ||
94f5a25f DP |
1331 | f = TYPE_FN_FIELDLIST1 (type, i); |
1332 | ||
1ab3bf1b JG |
1333 | TYPE_FN_FIELD_PHYSNAME (f, j) = mangled_name; |
1334 | ||
1335 | /* Now update the old "stub" type into a real type. */ | |
1336 | mtype = TYPE_FN_FIELD_TYPE (f, j); | |
1337 | TYPE_DOMAIN_TYPE (mtype) = type; | |
1338 | TYPE_ARG_TYPES (mtype) = argtypes; | |
1339 | TYPE_FLAGS (mtype) &= ~TYPE_FLAG_STUB; | |
1340 | TYPE_FN_FIELD_STUB (f, j) = 0; | |
1341 | } | |
1342 | ||
0213d96f | 1343 | const struct cplus_struct_type cplus_struct_default; |
1ab3bf1b JG |
1344 | |
1345 | void | |
1346 | allocate_cplus_struct_type (type) | |
1347 | struct type *type; | |
1348 | { | |
1349 | if (!HAVE_CPLUS_STRUCT (type)) | |
1350 | { | |
1351 | TYPE_CPLUS_SPECIFIC (type) = (struct cplus_struct_type *) | |
dac9734e | 1352 | TYPE_ALLOC (type, sizeof (struct cplus_struct_type)); |
1ab3bf1b JG |
1353 | *(TYPE_CPLUS_SPECIFIC(type)) = cplus_struct_default; |
1354 | } | |
1355 | } | |
1356 | ||
50e0dc41 FF |
1357 | /* Helper function to initialize the standard scalar types. |
1358 | ||
1359 | If NAME is non-NULL and OBJFILE is non-NULL, then we make a copy | |
1360 | of the string pointed to by name in the type_obstack for that objfile, | |
1361 | and initialize the type name to that copy. There are places (mipsread.c | |
1362 | in particular, where init_type is called with a NULL value for NAME). */ | |
1ab3bf1b JG |
1363 | |
1364 | struct type * | |
1365 | init_type (code, length, flags, name, objfile) | |
1366 | enum type_code code; | |
1367 | int length; | |
1368 | int flags; | |
1369 | char *name; | |
1370 | struct objfile *objfile; | |
1371 | { | |
1372 | register struct type *type; | |
1373 | ||
1374 | type = alloc_type (objfile); | |
1375 | TYPE_CODE (type) = code; | |
1376 | TYPE_LENGTH (type) = length; | |
1377 | TYPE_FLAGS (type) |= flags; | |
50e0dc41 FF |
1378 | if ((name != NULL) && (objfile != NULL)) |
1379 | { | |
1380 | TYPE_NAME (type) = | |
1381 | obsavestring (name, strlen (name), &objfile -> type_obstack); | |
1382 | } | |
1383 | else | |
1384 | { | |
1385 | TYPE_NAME (type) = name; | |
1386 | } | |
1ab3bf1b JG |
1387 | |
1388 | /* C++ fancies. */ | |
1389 | ||
1390 | if (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION) | |
1391 | { | |
1392 | INIT_CPLUS_SPECIFIC (type); | |
1393 | } | |
1394 | return (type); | |
1395 | } | |
1396 | ||
1397 | /* Look up a fundamental type for the specified objfile. | |
1398 | May need to construct such a type if this is the first use. | |
1399 | ||
1400 | Some object file formats (ELF, COFF, etc) do not define fundamental | |
1401 | types such as "int" or "double". Others (stabs for example), do | |
1402 | define fundamental types. | |
1403 | ||
1404 | For the formats which don't provide fundamental types, gdb can create | |
bf229b4e FF |
1405 | such types, using defaults reasonable for the current language and |
1406 | the current target machine. | |
1407 | ||
1408 | NOTE: This routine is obsolescent. Each debugging format reader | |
1409 | should manage it's own fundamental types, either creating them from | |
1410 | suitable defaults or reading them from the debugging information, | |
1411 | whichever is appropriate. The DWARF reader has already been | |
1412 | fixed to do this. Once the other readers are fixed, this routine | |
1413 | will go away. Also note that fundamental types should be managed | |
1414 | on a compilation unit basis in a multi-language environment, not | |
1415 | on a linkage unit basis as is done here. */ | |
1416 | ||
1ab3bf1b JG |
1417 | |
1418 | struct type * | |
1419 | lookup_fundamental_type (objfile, typeid) | |
1420 | struct objfile *objfile; | |
1421 | int typeid; | |
1422 | { | |
1ab3bf1b JG |
1423 | register struct type **typep; |
1424 | register int nbytes; | |
1425 | ||
1426 | if (typeid < 0 || typeid >= FT_NUM_MEMBERS) | |
1427 | { | |
1428 | error ("internal error - invalid fundamental type id %d", typeid); | |
1429 | } | |
bf229b4e FF |
1430 | |
1431 | /* If this is the first time we need a fundamental type for this objfile | |
1432 | then we need to initialize the vector of type pointers. */ | |
1433 | ||
1434 | if (objfile -> fundamental_types == NULL) | |
1ab3bf1b | 1435 | { |
bf229b4e FF |
1436 | nbytes = FT_NUM_MEMBERS * sizeof (struct type *); |
1437 | objfile -> fundamental_types = (struct type **) | |
1438 | obstack_alloc (&objfile -> type_obstack, nbytes); | |
1439 | memset ((char *) objfile -> fundamental_types, 0, nbytes); | |
2dd30c72 | 1440 | OBJSTAT (objfile, n_types += FT_NUM_MEMBERS); |
1ab3bf1b | 1441 | } |
bf229b4e FF |
1442 | |
1443 | /* Look for this particular type in the fundamental type vector. If one is | |
1444 | not found, create and install one appropriate for the current language. */ | |
1445 | ||
1446 | typep = objfile -> fundamental_types + typeid; | |
1447 | if (*typep == NULL) | |
1448 | { | |
1449 | *typep = create_fundamental_type (objfile, typeid); | |
1450 | } | |
1451 | ||
1452 | return (*typep); | |
1ab3bf1b JG |
1453 | } |
1454 | ||
9c036bd8 JK |
1455 | int |
1456 | can_dereference (t) | |
1457 | struct type *t; | |
1458 | { | |
1459 | /* FIXME: Should we return true for references as well as pointers? */ | |
d1f4065e | 1460 | CHECK_TYPEDEF (t); |
9c036bd8 JK |
1461 | return |
1462 | (t != NULL | |
1463 | && TYPE_CODE (t) == TYPE_CODE_PTR | |
1464 | && TYPE_CODE (TYPE_TARGET_TYPE (t)) != TYPE_CODE_VOID); | |
1465 | } | |
1466 | ||
f91a9e05 PB |
1467 | /* Chill varying string and arrays are represented as follows: |
1468 | ||
1469 | struct { int __var_length; ELEMENT_TYPE[MAX_SIZE] __var_data}; | |
1470 | ||
1471 | Return true if TYPE is such a Chill varying type. */ | |
1472 | ||
1473 | int | |
1474 | chill_varying_type (type) | |
1475 | struct type *type; | |
1476 | { | |
1477 | if (TYPE_CODE (type) != TYPE_CODE_STRUCT | |
1478 | || TYPE_NFIELDS (type) != 2 | |
1479 | || strcmp (TYPE_FIELD_NAME (type, 0), "__var_length") != 0) | |
1480 | return 0; | |
1481 | return 1; | |
1482 | } | |
1483 | ||
0239d9b3 FF |
1484 | #if MAINTENANCE_CMDS |
1485 | ||
8050a57b FF |
1486 | static void |
1487 | print_bit_vector (bits, nbits) | |
1488 | B_TYPE *bits; | |
1489 | int nbits; | |
0239d9b3 | 1490 | { |
8050a57b FF |
1491 | int bitno; |
1492 | ||
1493 | for (bitno = 0; bitno < nbits; bitno++) | |
0239d9b3 | 1494 | { |
8050a57b FF |
1495 | if ((bitno % 8) == 0) |
1496 | { | |
1497 | puts_filtered (" "); | |
1498 | } | |
1499 | if (B_TST (bits, bitno)) | |
1500 | { | |
1501 | printf_filtered ("1"); | |
1502 | } | |
1503 | else | |
1504 | { | |
1505 | printf_filtered ("0"); | |
1506 | } | |
0239d9b3 | 1507 | } |
8050a57b FF |
1508 | } |
1509 | ||
c0f1085b FF |
1510 | /* The args list is a strange beast. It is either terminated by a NULL |
1511 | pointer for varargs functions, or by a pointer to a TYPE_CODE_VOID | |
1512 | type for normal fixed argcount functions. (FIXME someday) | |
1513 | Also note the first arg should be the "this" pointer, we may not want to | |
1514 | include it since we may get into a infinitely recursive situation. */ | |
1515 | ||
1516 | static void | |
1517 | print_arg_types (args, spaces) | |
1518 | struct type **args; | |
1519 | int spaces; | |
1520 | { | |
1521 | if (args != NULL) | |
1522 | { | |
1523 | while (*args != NULL) | |
1524 | { | |
1525 | recursive_dump_type (*args, spaces + 2); | |
1526 | if ((*args++) -> code == TYPE_CODE_VOID) | |
1527 | { | |
1528 | break; | |
1529 | } | |
1530 | } | |
1531 | } | |
1532 | } | |
1533 | ||
1534 | static void | |
1535 | dump_fn_fieldlists (type, spaces) | |
1536 | struct type *type; | |
1537 | int spaces; | |
1538 | { | |
1539 | int method_idx; | |
1540 | int overload_idx; | |
1541 | struct fn_field *f; | |
1542 | ||
833e0d94 JK |
1543 | printfi_filtered (spaces, "fn_fieldlists "); |
1544 | gdb_print_address (TYPE_FN_FIELDLISTS (type), gdb_stdout); | |
1545 | printf_filtered ("\n"); | |
c0f1085b FF |
1546 | for (method_idx = 0; method_idx < TYPE_NFN_FIELDS (type); method_idx++) |
1547 | { | |
1548 | f = TYPE_FN_FIELDLIST1 (type, method_idx); | |
833e0d94 | 1549 | printfi_filtered (spaces + 2, "[%d] name '%s' (", |
c0f1085b | 1550 | method_idx, |
833e0d94 JK |
1551 | TYPE_FN_FIELDLIST_NAME (type, method_idx)); |
1552 | gdb_print_address (TYPE_FN_FIELDLIST_NAME (type, method_idx), | |
1553 | gdb_stdout); | |
1554 | printf_filtered (") length %d\n", | |
1555 | TYPE_FN_FIELDLIST_LENGTH (type, method_idx)); | |
c0f1085b FF |
1556 | for (overload_idx = 0; |
1557 | overload_idx < TYPE_FN_FIELDLIST_LENGTH (type, method_idx); | |
1558 | overload_idx++) | |
1559 | { | |
833e0d94 | 1560 | printfi_filtered (spaces + 4, "[%d] physname '%s' (", |
c0f1085b | 1561 | overload_idx, |
833e0d94 | 1562 | TYPE_FN_FIELD_PHYSNAME (f, overload_idx)); |
5e678752 JK |
1563 | gdb_print_address (TYPE_FN_FIELD_PHYSNAME (f, overload_idx), |
1564 | gdb_stdout); | |
833e0d94 JK |
1565 | printf_filtered (")\n"); |
1566 | printfi_filtered (spaces + 8, "type "); | |
1567 | gdb_print_address (TYPE_FN_FIELD_TYPE (f, overload_idx), gdb_stdout); | |
1568 | printf_filtered ("\n"); | |
1569 | ||
c0f1085b FF |
1570 | recursive_dump_type (TYPE_FN_FIELD_TYPE (f, overload_idx), |
1571 | spaces + 8 + 2); | |
833e0d94 JK |
1572 | |
1573 | printfi_filtered (spaces + 8, "args "); | |
1574 | gdb_print_address (TYPE_FN_FIELD_ARGS (f, overload_idx), gdb_stdout); | |
1575 | printf_filtered ("\n"); | |
1576 | ||
c0f1085b | 1577 | print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx), spaces); |
833e0d94 JK |
1578 | printfi_filtered (spaces + 8, "fcontext "); |
1579 | gdb_print_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx), | |
1580 | gdb_stdout); | |
1581 | printf_filtered ("\n"); | |
1582 | ||
c0f1085b FF |
1583 | printfi_filtered (spaces + 8, "is_const %d\n", |
1584 | TYPE_FN_FIELD_CONST (f, overload_idx)); | |
1585 | printfi_filtered (spaces + 8, "is_volatile %d\n", | |
1586 | TYPE_FN_FIELD_VOLATILE (f, overload_idx)); | |
1587 | printfi_filtered (spaces + 8, "is_private %d\n", | |
1588 | TYPE_FN_FIELD_PRIVATE (f, overload_idx)); | |
1589 | printfi_filtered (spaces + 8, "is_protected %d\n", | |
1590 | TYPE_FN_FIELD_PROTECTED (f, overload_idx)); | |
1591 | printfi_filtered (spaces + 8, "is_stub %d\n", | |
1592 | TYPE_FN_FIELD_STUB (f, overload_idx)); | |
d07734e3 | 1593 | printfi_filtered (spaces + 8, "voffset %u\n", |
c0f1085b FF |
1594 | TYPE_FN_FIELD_VOFFSET (f, overload_idx)); |
1595 | } | |
1596 | } | |
1597 | } | |
1598 | ||
8050a57b FF |
1599 | static void |
1600 | print_cplus_stuff (type, spaces) | |
1601 | struct type *type; | |
1602 | int spaces; | |
1603 | { | |
c0f1085b | 1604 | printfi_filtered (spaces, "n_baseclasses %d\n", |
8050a57b | 1605 | TYPE_N_BASECLASSES (type)); |
c0f1085b FF |
1606 | printfi_filtered (spaces, "nfn_fields %d\n", |
1607 | TYPE_NFN_FIELDS (type)); | |
1608 | printfi_filtered (spaces, "nfn_fields_total %d\n", | |
1609 | TYPE_NFN_FIELDS_TOTAL (type)); | |
8050a57b | 1610 | if (TYPE_N_BASECLASSES (type) > 0) |
0239d9b3 | 1611 | { |
833e0d94 JK |
1612 | printfi_filtered (spaces, "virtual_field_bits (%d bits at *", |
1613 | TYPE_N_BASECLASSES (type)); | |
1614 | gdb_print_address (TYPE_FIELD_VIRTUAL_BITS (type), gdb_stdout); | |
1615 | printf_filtered (")"); | |
1616 | ||
8050a57b FF |
1617 | print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type), |
1618 | TYPE_N_BASECLASSES (type)); | |
1619 | puts_filtered ("\n"); | |
0239d9b3 | 1620 | } |
8050a57b | 1621 | if (TYPE_NFIELDS (type) > 0) |
0239d9b3 | 1622 | { |
8050a57b FF |
1623 | if (TYPE_FIELD_PRIVATE_BITS (type) != NULL) |
1624 | { | |
833e0d94 JK |
1625 | printfi_filtered (spaces, "private_field_bits (%d bits at *", |
1626 | TYPE_NFIELDS (type)); | |
1627 | gdb_print_address (TYPE_FIELD_PRIVATE_BITS (type), gdb_stdout); | |
1628 | printf_filtered (")"); | |
8050a57b FF |
1629 | print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type), |
1630 | TYPE_NFIELDS (type)); | |
1631 | puts_filtered ("\n"); | |
1632 | } | |
1633 | if (TYPE_FIELD_PROTECTED_BITS (type) != NULL) | |
0239d9b3 | 1634 | { |
833e0d94 JK |
1635 | printfi_filtered (spaces, "protected_field_bits (%d bits at *", |
1636 | TYPE_NFIELDS (type)); | |
1637 | gdb_print_address (TYPE_FIELD_PROTECTED_BITS (type), gdb_stdout); | |
1638 | printf_filtered (")"); | |
8050a57b FF |
1639 | print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type), |
1640 | TYPE_NFIELDS (type)); | |
1641 | puts_filtered ("\n"); | |
0239d9b3 FF |
1642 | } |
1643 | } | |
c0f1085b FF |
1644 | if (TYPE_NFN_FIELDS (type) > 0) |
1645 | { | |
1646 | dump_fn_fieldlists (type, spaces); | |
1647 | } | |
8050a57b FF |
1648 | } |
1649 | ||
2447e9af PS |
1650 | static struct obstack dont_print_type_obstack; |
1651 | ||
8050a57b FF |
1652 | void |
1653 | recursive_dump_type (type, spaces) | |
1654 | struct type *type; | |
1655 | int spaces; | |
1656 | { | |
1657 | int idx; | |
0239d9b3 | 1658 | |
2447e9af PS |
1659 | if (spaces == 0) |
1660 | obstack_begin (&dont_print_type_obstack, 0); | |
1661 | ||
1662 | if (TYPE_NFIELDS (type) > 0 | |
1663 | || (TYPE_CPLUS_SPECIFIC (type) && TYPE_NFN_FIELDS (type) > 0)) | |
1664 | { | |
1665 | struct type **first_dont_print | |
1666 | = (struct type **)obstack_base (&dont_print_type_obstack); | |
1667 | ||
1668 | int i = (struct type **)obstack_next_free (&dont_print_type_obstack) | |
1669 | - first_dont_print; | |
1670 | ||
1671 | while (--i >= 0) | |
1672 | { | |
1673 | if (type == first_dont_print[i]) | |
1674 | { | |
1675 | printfi_filtered (spaces, "type node "); | |
1676 | gdb_print_address (type, gdb_stdout); | |
1677 | printf_filtered (" <same as already seen type>\n"); | |
1678 | return; | |
1679 | } | |
1680 | } | |
1681 | ||
1682 | obstack_ptr_grow (&dont_print_type_obstack, type); | |
1683 | } | |
1684 | ||
833e0d94 JK |
1685 | printfi_filtered (spaces, "type node "); |
1686 | gdb_print_address (type, gdb_stdout); | |
1687 | printf_filtered ("\n"); | |
1688 | printfi_filtered (spaces, "name '%s' (", | |
1689 | TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>"); | |
1690 | gdb_print_address (TYPE_NAME (type), gdb_stdout); | |
1691 | printf_filtered (")\n"); | |
85999c05 | 1692 | if (TYPE_TAG_NAME (type) != NULL) |
833e0d94 JK |
1693 | { |
1694 | printfi_filtered (spaces, "tagname '%s' (", | |
1695 | TYPE_TAG_NAME (type)); | |
1696 | gdb_print_address (TYPE_TAG_NAME (type), gdb_stdout); | |
1697 | printf_filtered (")\n"); | |
1698 | } | |
c0f1085b | 1699 | printfi_filtered (spaces, "code 0x%x ", TYPE_CODE (type)); |
8050a57b | 1700 | switch (TYPE_CODE (type)) |
0239d9b3 | 1701 | { |
8050a57b | 1702 | case TYPE_CODE_UNDEF: |
c0f1085b | 1703 | printf_filtered ("(TYPE_CODE_UNDEF)"); |
8050a57b FF |
1704 | break; |
1705 | case TYPE_CODE_PTR: | |
c0f1085b | 1706 | printf_filtered ("(TYPE_CODE_PTR)"); |
8050a57b FF |
1707 | break; |
1708 | case TYPE_CODE_ARRAY: | |
c0f1085b | 1709 | printf_filtered ("(TYPE_CODE_ARRAY)"); |
8050a57b FF |
1710 | break; |
1711 | case TYPE_CODE_STRUCT: | |
c0f1085b | 1712 | printf_filtered ("(TYPE_CODE_STRUCT)"); |
8050a57b FF |
1713 | break; |
1714 | case TYPE_CODE_UNION: | |
c0f1085b | 1715 | printf_filtered ("(TYPE_CODE_UNION)"); |
8050a57b FF |
1716 | break; |
1717 | case TYPE_CODE_ENUM: | |
c0f1085b | 1718 | printf_filtered ("(TYPE_CODE_ENUM)"); |
8050a57b FF |
1719 | break; |
1720 | case TYPE_CODE_FUNC: | |
c0f1085b | 1721 | printf_filtered ("(TYPE_CODE_FUNC)"); |
8050a57b FF |
1722 | break; |
1723 | case TYPE_CODE_INT: | |
c0f1085b | 1724 | printf_filtered ("(TYPE_CODE_INT)"); |
8050a57b FF |
1725 | break; |
1726 | case TYPE_CODE_FLT: | |
c0f1085b | 1727 | printf_filtered ("(TYPE_CODE_FLT)"); |
8050a57b FF |
1728 | break; |
1729 | case TYPE_CODE_VOID: | |
c0f1085b | 1730 | printf_filtered ("(TYPE_CODE_VOID)"); |
8050a57b FF |
1731 | break; |
1732 | case TYPE_CODE_SET: | |
c0f1085b | 1733 | printf_filtered ("(TYPE_CODE_SET)"); |
8050a57b FF |
1734 | break; |
1735 | case TYPE_CODE_RANGE: | |
c0f1085b | 1736 | printf_filtered ("(TYPE_CODE_RANGE)"); |
8050a57b | 1737 | break; |
c4413e2c FF |
1738 | case TYPE_CODE_STRING: |
1739 | printf_filtered ("(TYPE_CODE_STRING)"); | |
8050a57b FF |
1740 | break; |
1741 | case TYPE_CODE_ERROR: | |
c0f1085b | 1742 | printf_filtered ("(TYPE_CODE_ERROR)"); |
8050a57b FF |
1743 | break; |
1744 | case TYPE_CODE_MEMBER: | |
c0f1085b | 1745 | printf_filtered ("(TYPE_CODE_MEMBER)"); |
8050a57b FF |
1746 | break; |
1747 | case TYPE_CODE_METHOD: | |
c0f1085b | 1748 | printf_filtered ("(TYPE_CODE_METHOD)"); |
8050a57b FF |
1749 | break; |
1750 | case TYPE_CODE_REF: | |
c0f1085b | 1751 | printf_filtered ("(TYPE_CODE_REF)"); |
8050a57b FF |
1752 | break; |
1753 | case TYPE_CODE_CHAR: | |
c0f1085b | 1754 | printf_filtered ("(TYPE_CODE_CHAR)"); |
8050a57b FF |
1755 | break; |
1756 | case TYPE_CODE_BOOL: | |
c0f1085b | 1757 | printf_filtered ("(TYPE_CODE_BOOL)"); |
8050a57b | 1758 | break; |
d1f4065e PB |
1759 | case TYPE_CODE_TYPEDEF: |
1760 | printf_filtered ("(TYPE_CODE_TYPEDEF)"); | |
1761 | break; | |
8050a57b | 1762 | default: |
c0f1085b | 1763 | printf_filtered ("(UNKNOWN TYPE CODE)"); |
8050a57b | 1764 | break; |
0239d9b3 | 1765 | } |
8050a57b | 1766 | puts_filtered ("\n"); |
c0f1085b | 1767 | printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type)); |
833e0d94 JK |
1768 | printfi_filtered (spaces, "objfile "); |
1769 | gdb_print_address (TYPE_OBJFILE (type), gdb_stdout); | |
1770 | printf_filtered ("\n"); | |
1771 | printfi_filtered (spaces, "target_type "); | |
1772 | gdb_print_address (TYPE_TARGET_TYPE (type), gdb_stdout); | |
1773 | printf_filtered ("\n"); | |
8050a57b FF |
1774 | if (TYPE_TARGET_TYPE (type) != NULL) |
1775 | { | |
1776 | recursive_dump_type (TYPE_TARGET_TYPE (type), spaces + 2); | |
1777 | } | |
833e0d94 JK |
1778 | printfi_filtered (spaces, "pointer_type "); |
1779 | gdb_print_address (TYPE_POINTER_TYPE (type), gdb_stdout); | |
1780 | printf_filtered ("\n"); | |
1781 | printfi_filtered (spaces, "reference_type "); | |
1782 | gdb_print_address (TYPE_REFERENCE_TYPE (type), gdb_stdout); | |
1783 | printf_filtered ("\n"); | |
c0f1085b | 1784 | printfi_filtered (spaces, "flags 0x%x", TYPE_FLAGS (type)); |
8050a57b FF |
1785 | if (TYPE_FLAGS (type) & TYPE_FLAG_UNSIGNED) |
1786 | { | |
1787 | puts_filtered (" TYPE_FLAG_UNSIGNED"); | |
1788 | } | |
8050a57b FF |
1789 | if (TYPE_FLAGS (type) & TYPE_FLAG_STUB) |
1790 | { | |
1791 | puts_filtered (" TYPE_FLAG_STUB"); | |
1792 | } | |
1793 | puts_filtered ("\n"); | |
833e0d94 | 1794 | printfi_filtered (spaces, "nfields %d ", TYPE_NFIELDS (type)); |
5e678752 | 1795 | gdb_print_address (TYPE_FIELDS (type), gdb_stdout); |
833e0d94 | 1796 | puts_filtered ("\n"); |
8050a57b FF |
1797 | for (idx = 0; idx < TYPE_NFIELDS (type); idx++) |
1798 | { | |
1799 | printfi_filtered (spaces + 2, | |
5e678752 | 1800 | "[%d] bitpos %d bitsize %d type ", |
8050a57b | 1801 | idx, TYPE_FIELD_BITPOS (type, idx), |
833e0d94 JK |
1802 | TYPE_FIELD_BITSIZE (type, idx)); |
1803 | gdb_print_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout); | |
1804 | printf_filtered (" name '%s' (", | |
1805 | TYPE_FIELD_NAME (type, idx) != NULL | |
1806 | ? TYPE_FIELD_NAME (type, idx) | |
1807 | : "<NULL>"); | |
5e678752 | 1808 | gdb_print_address (TYPE_FIELD_NAME (type, idx), gdb_stdout); |
833e0d94 | 1809 | printf_filtered (")\n"); |
8050a57b FF |
1810 | if (TYPE_FIELD_TYPE (type, idx) != NULL) |
1811 | { | |
1812 | recursive_dump_type (TYPE_FIELD_TYPE (type, idx), spaces + 4); | |
1813 | } | |
1814 | } | |
833e0d94 JK |
1815 | printfi_filtered (spaces, "vptr_basetype "); |
1816 | gdb_print_address (TYPE_VPTR_BASETYPE (type), gdb_stdout); | |
1817 | puts_filtered ("\n"); | |
8050a57b FF |
1818 | if (TYPE_VPTR_BASETYPE (type) != NULL) |
1819 | { | |
1820 | recursive_dump_type (TYPE_VPTR_BASETYPE (type), spaces + 2); | |
1821 | } | |
c0f1085b | 1822 | printfi_filtered (spaces, "vptr_fieldno %d\n", TYPE_VPTR_FIELDNO (type)); |
8050a57b | 1823 | switch (TYPE_CODE (type)) |
0239d9b3 FF |
1824 | { |
1825 | case TYPE_CODE_METHOD: | |
1826 | case TYPE_CODE_FUNC: | |
833e0d94 | 1827 | printfi_filtered (spaces, "arg_types "); |
5e678752 | 1828 | gdb_print_address (TYPE_ARG_TYPES (type), gdb_stdout); |
833e0d94 | 1829 | puts_filtered ("\n"); |
c0f1085b | 1830 | print_arg_types (TYPE_ARG_TYPES (type), spaces); |
0239d9b3 FF |
1831 | break; |
1832 | ||
1833 | case TYPE_CODE_STRUCT: | |
833e0d94 | 1834 | printfi_filtered (spaces, "cplus_stuff "); |
5e678752 | 1835 | gdb_print_address (TYPE_CPLUS_SPECIFIC (type), gdb_stdout); |
833e0d94 | 1836 | puts_filtered ("\n"); |
8050a57b | 1837 | print_cplus_stuff (type, spaces); |
0239d9b3 | 1838 | break; |
d07734e3 FF |
1839 | |
1840 | default: | |
1841 | /* We have to pick one of the union types to be able print and test | |
1842 | the value. Pick cplus_struct_type, even though we know it isn't | |
1843 | any particular one. */ | |
833e0d94 | 1844 | printfi_filtered (spaces, "type_specific "); |
5e678752 | 1845 | gdb_print_address (TYPE_CPLUS_SPECIFIC (type), gdb_stdout); |
d07734e3 FF |
1846 | if (TYPE_CPLUS_SPECIFIC (type) != NULL) |
1847 | { | |
1848 | printf_filtered (" (unknown data form)"); | |
1849 | } | |
1850 | printf_filtered ("\n"); | |
1851 | break; | |
1852 | ||
0239d9b3 | 1853 | } |
2447e9af PS |
1854 | if (spaces == 0) |
1855 | obstack_free (&dont_print_type_obstack, NULL); | |
0239d9b3 FF |
1856 | } |
1857 | ||
1858 | #endif /* MAINTENANCE_CMDS */ | |
c4413e2c FF |
1859 | |
1860 | void | |
1861 | _initialize_gdbtypes () | |
1862 | { | |
1863 | builtin_type_void = | |
1864 | init_type (TYPE_CODE_VOID, 1, | |
1865 | 0, | |
1866 | "void", (struct objfile *) NULL); | |
1867 | builtin_type_char = | |
1868 | init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, | |
1869 | 0, | |
1870 | "char", (struct objfile *) NULL); | |
1871 | builtin_type_signed_char = | |
1872 | init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, | |
dda398c3 | 1873 | 0, |
c4413e2c FF |
1874 | "signed char", (struct objfile *) NULL); |
1875 | builtin_type_unsigned_char = | |
1876 | init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, | |
1877 | TYPE_FLAG_UNSIGNED, | |
1878 | "unsigned char", (struct objfile *) NULL); | |
1879 | builtin_type_short = | |
1880 | init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT, | |
1881 | 0, | |
1882 | "short", (struct objfile *) NULL); | |
1883 | builtin_type_unsigned_short = | |
1884 | init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT, | |
1885 | TYPE_FLAG_UNSIGNED, | |
1886 | "unsigned short", (struct objfile *) NULL); | |
1887 | builtin_type_int = | |
1888 | init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, | |
1889 | 0, | |
1890 | "int", (struct objfile *) NULL); | |
1891 | builtin_type_unsigned_int = | |
1892 | init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, | |
1893 | TYPE_FLAG_UNSIGNED, | |
1894 | "unsigned int", (struct objfile *) NULL); | |
1895 | builtin_type_long = | |
1896 | init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT, | |
1897 | 0, | |
1898 | "long", (struct objfile *) NULL); | |
1899 | builtin_type_unsigned_long = | |
1900 | init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT, | |
1901 | TYPE_FLAG_UNSIGNED, | |
1902 | "unsigned long", (struct objfile *) NULL); | |
1903 | builtin_type_long_long = | |
1904 | init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, | |
1905 | 0, | |
1906 | "long long", (struct objfile *) NULL); | |
1907 | builtin_type_unsigned_long_long = | |
1908 | init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, | |
1909 | TYPE_FLAG_UNSIGNED, | |
1910 | "unsigned long long", (struct objfile *) NULL); | |
1911 | builtin_type_float = | |
1912 | init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT, | |
1913 | 0, | |
1914 | "float", (struct objfile *) NULL); | |
1915 | builtin_type_double = | |
1916 | init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, | |
1917 | 0, | |
1918 | "double", (struct objfile *) NULL); | |
1919 | builtin_type_long_double = | |
1920 | init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, | |
1921 | 0, | |
1922 | "long double", (struct objfile *) NULL); | |
1923 | builtin_type_complex = | |
ead95f8a | 1924 | init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT, |
c4413e2c FF |
1925 | 0, |
1926 | "complex", (struct objfile *) NULL); | |
ead95f8a | 1927 | TYPE_TARGET_TYPE (builtin_type_complex) = builtin_type_float; |
c4413e2c | 1928 | builtin_type_double_complex = |
ead95f8a | 1929 | init_type (TYPE_CODE_COMPLEX, 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, |
c4413e2c FF |
1930 | 0, |
1931 | "double complex", (struct objfile *) NULL); | |
ead95f8a | 1932 | TYPE_TARGET_TYPE (builtin_type_double_complex) = builtin_type_double; |
c4413e2c FF |
1933 | builtin_type_string = |
1934 | init_type (TYPE_CODE_STRING, TARGET_CHAR_BIT / TARGET_CHAR_BIT, | |
1935 | 0, | |
1936 | "string", (struct objfile *) NULL); | |
980714f9 AC |
1937 | builtin_type_int8 = |
1938 | init_type (TYPE_CODE_INT, 8 / 8, | |
1939 | 0, | |
1940 | "int8_t", (struct objfile *) NULL); | |
1941 | builtin_type_uint8 = | |
1942 | init_type (TYPE_CODE_INT, 8 / 8, | |
1943 | TYPE_FLAG_UNSIGNED, | |
1944 | "uint8_t", (struct objfile *) NULL); | |
1945 | builtin_type_int16 = | |
1946 | init_type (TYPE_CODE_INT, 16 / 8, | |
1947 | 0, | |
1948 | "int16_t", (struct objfile *) NULL); | |
1949 | builtin_type_uint16 = | |
1950 | init_type (TYPE_CODE_INT, 16 / 8, | |
1951 | TYPE_FLAG_UNSIGNED, | |
1952 | "uint16_t", (struct objfile *) NULL); | |
1953 | builtin_type_int32 = | |
1954 | init_type (TYPE_CODE_INT, 32 / 8, | |
1955 | 0, | |
1956 | "int32_t", (struct objfile *) NULL); | |
1957 | builtin_type_uint32 = | |
1958 | init_type (TYPE_CODE_INT, 32 / 8, | |
1959 | TYPE_FLAG_UNSIGNED, | |
1960 | "uint32_t", (struct objfile *) NULL); | |
1961 | builtin_type_int64 = | |
1962 | init_type (TYPE_CODE_INT, 64 / 8, | |
1963 | 0, | |
1964 | "int64_t", (struct objfile *) NULL); | |
1965 | builtin_type_uint64 = | |
1966 | init_type (TYPE_CODE_INT, 64 / 8, | |
1967 | TYPE_FLAG_UNSIGNED, | |
1968 | "uint64_t", (struct objfile *) NULL); | |
1969 | /* start-sanitize-r5900 */ | |
1970 | builtin_type_int128 = | |
1971 | init_type (TYPE_CODE_INT, 128 / 8, | |
1972 | 0, | |
1973 | "int128_t", (struct objfile *) NULL); | |
1974 | builtin_type_uint128 = | |
1975 | init_type (TYPE_CODE_INT, 128 / 8, | |
1976 | TYPE_FLAG_UNSIGNED, | |
1977 | "uint128_t", (struct objfile *) NULL); | |
1978 | /* end-sanitize-r5900 */ | |
c4413e2c | 1979 | } |