1 /* Support routines for manipulating internal types for GDB.
2 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
4 Contributed by Cygnus Support, using pieces from other GDB modules.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 #include "gdb_string.h"
30 #include "expression.h"
35 #include "complaints.h"
39 #include "gdb_assert.h"
41 /* These variables point to the objects
42 representing the predefined C data types. */
44 struct type
*builtin_type_void
;
45 struct type
*builtin_type_char
;
46 struct type
*builtin_type_true_char
;
47 struct type
*builtin_type_short
;
48 struct type
*builtin_type_int
;
49 struct type
*builtin_type_long
;
50 struct type
*builtin_type_long_long
;
51 struct type
*builtin_type_signed_char
;
52 struct type
*builtin_type_unsigned_char
;
53 struct type
*builtin_type_unsigned_short
;
54 struct type
*builtin_type_unsigned_int
;
55 struct type
*builtin_type_unsigned_long
;
56 struct type
*builtin_type_unsigned_long_long
;
57 struct type
*builtin_type_float
;
58 struct type
*builtin_type_double
;
59 struct type
*builtin_type_long_double
;
60 struct type
*builtin_type_complex
;
61 struct type
*builtin_type_double_complex
;
62 struct type
*builtin_type_string
;
63 struct type
*builtin_type_int8
;
64 struct type
*builtin_type_uint8
;
65 struct type
*builtin_type_int16
;
66 struct type
*builtin_type_uint16
;
67 struct type
*builtin_type_int32
;
68 struct type
*builtin_type_uint32
;
69 struct type
*builtin_type_int64
;
70 struct type
*builtin_type_uint64
;
71 struct type
*builtin_type_int128
;
72 struct type
*builtin_type_uint128
;
73 struct type
*builtin_type_bool
;
74 struct type
*builtin_type_v4sf
;
75 struct type
*builtin_type_v4si
;
76 struct type
*builtin_type_v16qi
;
77 struct type
*builtin_type_v8qi
;
78 struct type
*builtin_type_v8hi
;
79 struct type
*builtin_type_v4hi
;
80 struct type
*builtin_type_v2si
;
81 struct type
*builtin_type_vec128
;
82 struct type
*builtin_type_ieee_single_big
;
83 struct type
*builtin_type_ieee_single_little
;
84 struct type
*builtin_type_ieee_double_big
;
85 struct type
*builtin_type_ieee_double_little
;
86 struct type
*builtin_type_ieee_double_littlebyte_bigword
;
87 struct type
*builtin_type_i387_ext
;
88 struct type
*builtin_type_m68881_ext
;
89 struct type
*builtin_type_i960_ext
;
90 struct type
*builtin_type_m88110_ext
;
91 struct type
*builtin_type_m88110_harris_ext
;
92 struct type
*builtin_type_arm_ext_big
;
93 struct type
*builtin_type_arm_ext_littlebyte_bigword
;
94 struct type
*builtin_type_ia64_spill_big
;
95 struct type
*builtin_type_ia64_spill_little
;
96 struct type
*builtin_type_ia64_quad_big
;
97 struct type
*builtin_type_ia64_quad_little
;
98 struct type
*builtin_type_void_data_ptr
;
99 struct type
*builtin_type_void_func_ptr
;
100 struct type
*builtin_type_CORE_ADDR
;
101 struct type
*builtin_type_bfd_vma
;
103 int opaque_type_resolution
= 1;
104 int overload_debug
= 0;
110 }; /* maximum extension is 128! FIXME */
112 static void add_name (struct extra
*, char *);
113 static void add_mangled_type (struct extra
*, struct type
*);
115 static void cfront_mangle_name (struct type
*, int, int);
117 static void print_bit_vector (B_TYPE
*, int);
118 static void print_arg_types (struct type
**, int);
119 static void dump_fn_fieldlists (struct type
*, int);
120 static void print_cplus_stuff (struct type
*, int);
121 static void virtual_base_list_aux (struct type
*dclass
);
124 /* Alloc a new type structure and fill it with some defaults. If
125 OBJFILE is non-NULL, then allocate the space for the type structure
126 in that objfile's type_obstack. */
129 alloc_type (struct objfile
*objfile
)
131 register struct type
*type
;
133 /* Alloc the structure and start off with all fields zeroed. */
137 type
= (struct type
*) xmalloc (sizeof (struct type
));
141 type
= (struct type
*) obstack_alloc (&objfile
->type_obstack
,
142 sizeof (struct type
));
143 OBJSTAT (objfile
, n_types
++);
145 memset ((char *) type
, 0, sizeof (struct type
));
147 /* Initialize the fields that might not be zero. */
149 TYPE_CODE (type
) = TYPE_CODE_UNDEF
;
150 TYPE_OBJFILE (type
) = objfile
;
151 TYPE_VPTR_FIELDNO (type
) = -1;
152 TYPE_CV_TYPE (type
) = type
; /* chain back to itself */
153 TYPE_AS_TYPE (type
) = type
; /* ditto */
158 /* Lookup a pointer to a type TYPE. TYPEPTR, if nonzero, points
159 to a pointer to memory where the pointer type should be stored.
160 If *TYPEPTR is zero, update it to point to the pointer type we return.
161 We allocate new memory if needed. */
164 make_pointer_type (struct type
*type
, struct type
**typeptr
)
166 register struct type
*ntype
; /* New type */
167 struct objfile
*objfile
;
169 ntype
= TYPE_POINTER_TYPE (type
);
174 return ntype
; /* Don't care about alloc, and have new type. */
175 else if (*typeptr
== 0)
177 *typeptr
= ntype
; /* Tracking alloc, and we have new type. */
182 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
184 ntype
= alloc_type (TYPE_OBJFILE (type
));
189 /* We have storage, but need to reset it. */
192 objfile
= TYPE_OBJFILE (ntype
);
193 memset ((char *) ntype
, 0, sizeof (struct type
));
194 TYPE_OBJFILE (ntype
) = objfile
;
197 TYPE_TARGET_TYPE (ntype
) = type
;
198 TYPE_POINTER_TYPE (type
) = ntype
;
200 /* FIXME! Assume the machine has only one representation for pointers! */
202 TYPE_LENGTH (ntype
) = TARGET_PTR_BIT
/ TARGET_CHAR_BIT
;
203 TYPE_CODE (ntype
) = TYPE_CODE_PTR
;
205 /* Mark pointers as unsigned. The target converts between pointers
206 and addresses (CORE_ADDRs) using POINTER_TO_ADDRESS() and
207 ADDRESS_TO_POINTER(). */
208 TYPE_FLAGS (ntype
) |= TYPE_FLAG_UNSIGNED
;
210 if (!TYPE_POINTER_TYPE (type
)) /* Remember it, if don't have one. */
211 TYPE_POINTER_TYPE (type
) = ntype
;
216 /* Given a type TYPE, return a type of pointers to that type.
217 May need to construct such a type if this is the first use. */
220 lookup_pointer_type (struct type
*type
)
222 return make_pointer_type (type
, (struct type
**) 0);
225 /* Lookup a C++ `reference' to a type TYPE. TYPEPTR, if nonzero, points
226 to a pointer to memory where the reference type should be stored.
227 If *TYPEPTR is zero, update it to point to the reference type we return.
228 We allocate new memory if needed. */
231 make_reference_type (struct type
*type
, struct type
**typeptr
)
233 register struct type
*ntype
; /* New type */
234 struct objfile
*objfile
;
236 ntype
= TYPE_REFERENCE_TYPE (type
);
241 return ntype
; /* Don't care about alloc, and have new type. */
242 else if (*typeptr
== 0)
244 *typeptr
= ntype
; /* Tracking alloc, and we have new type. */
249 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
251 ntype
= alloc_type (TYPE_OBJFILE (type
));
256 /* We have storage, but need to reset it. */
259 objfile
= TYPE_OBJFILE (ntype
);
260 memset ((char *) ntype
, 0, sizeof (struct type
));
261 TYPE_OBJFILE (ntype
) = objfile
;
264 TYPE_TARGET_TYPE (ntype
) = type
;
265 TYPE_REFERENCE_TYPE (type
) = ntype
;
267 /* FIXME! Assume the machine has only one representation for references,
268 and that it matches the (only) representation for pointers! */
270 TYPE_LENGTH (ntype
) = TARGET_PTR_BIT
/ TARGET_CHAR_BIT
;
271 TYPE_CODE (ntype
) = TYPE_CODE_REF
;
273 if (!TYPE_REFERENCE_TYPE (type
)) /* Remember it, if don't have one. */
274 TYPE_REFERENCE_TYPE (type
) = ntype
;
279 /* Same as above, but caller doesn't care about memory allocation details. */
282 lookup_reference_type (struct type
*type
)
284 return make_reference_type (type
, (struct type
**) 0);
287 /* Lookup a function type that returns type TYPE. TYPEPTR, if nonzero, points
288 to a pointer to memory where the function type should be stored.
289 If *TYPEPTR is zero, update it to point to the function type we return.
290 We allocate new memory if needed. */
293 make_function_type (struct type
*type
, struct type
**typeptr
)
295 register struct type
*ntype
; /* New type */
296 struct objfile
*objfile
;
298 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
300 ntype
= alloc_type (TYPE_OBJFILE (type
));
305 /* We have storage, but need to reset it. */
308 objfile
= TYPE_OBJFILE (ntype
);
309 memset ((char *) ntype
, 0, sizeof (struct type
));
310 TYPE_OBJFILE (ntype
) = objfile
;
313 TYPE_TARGET_TYPE (ntype
) = type
;
315 TYPE_LENGTH (ntype
) = 1;
316 TYPE_CODE (ntype
) = TYPE_CODE_FUNC
;
322 /* Given a type TYPE, return a type of functions that return that type.
323 May need to construct such a type if this is the first use. */
326 lookup_function_type (struct type
*type
)
328 return make_function_type (type
, (struct type
**) 0);
331 /* Identify address space identifier by name --
332 return the integer flag defined in gdbtypes.h. */
334 address_space_name_to_int (char *space_identifier
)
336 /* Check for known address space delimiters. */
337 if (!strcmp (space_identifier
, "code"))
338 return TYPE_FLAG_CODE_SPACE
;
339 else if (!strcmp (space_identifier
, "data"))
340 return TYPE_FLAG_DATA_SPACE
;
342 error ("Unknown address space specifier: \"%s\"", space_identifier
);
345 /* Identify address space identifier by integer flag as defined in
346 gdbtypes.h -- return the string version of the adress space name. */
349 address_space_int_to_name (int space_flag
)
351 if (space_flag
& TYPE_FLAG_CODE_SPACE
)
353 else if (space_flag
& TYPE_FLAG_DATA_SPACE
)
359 /* Make an address-space-delimited variant of a type -- a type that
360 is identical to the one supplied except that it has an address
361 space attribute attached to it (such as "code" or "data").
363 This is for Harvard architectures. */
366 make_type_with_address_space (struct type
*type
, int space_flag
)
372 if ((ntype
->flags
& space_flag
) != 0)
374 ntype
= TYPE_AS_TYPE (ntype
);
375 } while (ntype
!= type
);
377 /* Create a new, duplicate type. */
378 ntype
= alloc_type (TYPE_OBJFILE (type
));
379 /* Copy original type. */
380 memcpy ((char *) ntype
, (char *) type
, sizeof (struct type
));
382 /* Pointers or references to the original type are not relevant to
383 the new type; but if the original type is a pointer, the new type
384 points to the same thing (so TYPE_TARGET_TYPE remains unchanged). */
385 TYPE_POINTER_TYPE (ntype
) = (struct type
*) 0;
386 TYPE_REFERENCE_TYPE (ntype
) = (struct type
*) 0;
387 TYPE_CV_TYPE (ntype
) = ntype
;
389 /* Chain the new address-space-specific type to the old type. */
390 ntype
->as_type
= type
->as_type
;
391 type
->as_type
= ntype
;
393 /* Now set the address-space flag, and return the new type. */
394 ntype
->flags
|= space_flag
;
399 /* Make a "c-v" variant of a type -- a type that is identical to the
400 one supplied except that it may have const or volatile attributes
401 CNST is a flag for setting the const attribute
402 VOLTL is a flag for setting the volatile attribute
403 TYPE is the base type whose variant we are creating.
404 TYPEPTR, if nonzero, points
405 to a pointer to memory where the reference type should be stored.
406 If *TYPEPTR is zero, update it to point to the reference type we return.
407 We allocate new memory if needed. */
410 make_cv_type (int cnst
, int voltl
, struct type
*type
, struct type
**typeptr
)
412 register struct type
*ntype
; /* New type */
413 register struct type
*tmp_type
= type
; /* tmp type */
414 struct objfile
*objfile
;
416 ntype
= TYPE_CV_TYPE (type
);
418 while (ntype
!= type
)
420 if ((TYPE_CONST (ntype
) == cnst
) &&
421 (TYPE_VOLATILE (ntype
) == voltl
))
425 else if (*typeptr
== 0)
427 *typeptr
= ntype
; /* Tracking alloc, and we have new type. */
432 ntype
= TYPE_CV_TYPE (ntype
);
435 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
437 ntype
= alloc_type (TYPE_OBJFILE (type
));
442 /* We have storage, but need to reset it. */
445 objfile
= TYPE_OBJFILE (ntype
);
446 /* memset ((char *) ntype, 0, sizeof (struct type)); */
447 TYPE_OBJFILE (ntype
) = objfile
;
450 /* Copy original type */
451 memcpy ((char *) ntype
, (char *) type
, sizeof (struct type
));
452 /* But zero out fields that shouldn't be copied */
453 TYPE_POINTER_TYPE (ntype
) = (struct type
*) 0; /* Need new pointer kind */
454 TYPE_REFERENCE_TYPE (ntype
) = (struct type
*) 0; /* Need new referene kind */
455 TYPE_AS_TYPE (ntype
) = ntype
; /* Need new address-space kind. */
456 /* Note: TYPE_TARGET_TYPE can be left as is */
458 /* Set flags appropriately */
460 TYPE_FLAGS (ntype
) |= TYPE_FLAG_CONST
;
462 TYPE_FLAGS (ntype
) &= ~TYPE_FLAG_CONST
;
465 TYPE_FLAGS (ntype
) |= TYPE_FLAG_VOLATILE
;
467 TYPE_FLAGS (ntype
) &= ~TYPE_FLAG_VOLATILE
;
469 /* Fix the chain of cv variants */
470 TYPE_CV_TYPE (ntype
) = type
;
471 TYPE_CV_TYPE (tmp_type
) = ntype
;
476 /* When reading in a class type, we may have created references to
477 cv-qualified versions of the type (in method arguments, for
478 instance). Update everything on the cv ring from the primary
481 The only reason we do not need to do the same thing for address
482 spaces is that type readers do not create address space qualified
485 finish_cv_type (struct type
*type
)
487 struct type
*ntype
, *cv_type
, *ptr_type
, *ref_type
;
490 gdb_assert (!TYPE_CONST (type
) && !TYPE_VOLATILE (type
));
493 while ((ntype
= TYPE_CV_TYPE (ntype
)) != type
)
496 cv_flags
= TYPE_FLAGS (ntype
) & (TYPE_FLAG_VOLATILE
| TYPE_FLAG_CONST
);
498 /* If any reference or pointer types were created, save them too. */
499 ptr_type
= TYPE_POINTER_TYPE (ntype
);
500 ref_type
= TYPE_REFERENCE_TYPE (ntype
);
502 /* Don't disturb the CV chain. */
503 cv_type
= TYPE_CV_TYPE (ntype
);
505 /* Verify that we haven't added any address-space qualified types,
507 gdb_assert (ntype
== TYPE_AS_TYPE (ntype
));
509 /* Copy original type */
510 memcpy ((char *) ntype
, (char *) type
, sizeof (struct type
));
512 /* Restore everything. */
513 TYPE_POINTER_TYPE (ntype
) = ptr_type
;
514 TYPE_REFERENCE_TYPE (ntype
) = ref_type
;
515 TYPE_CV_TYPE (ntype
) = cv_type
;
516 TYPE_FLAGS (ntype
) = TYPE_FLAGS (ntype
) | cv_flags
;
518 TYPE_AS_TYPE (ntype
) = ntype
;
522 /* Replace the contents of ntype with the type *type.
524 In order to build recursive types, it's inevitable that we'll need
525 to update types in place --- but this sort of indiscriminate
526 smashing is ugly, and needs to be replaced with something more
527 controlled. For example, Daniel Jacobowitz has suggested moving
528 the fields common to a set of c/v variants into their own object,
529 which the variants would share.
531 This function does not handle the replacement type being
532 cv-qualified; it could be easily fixed to, but it would be better
533 to just change the whole approach. */
535 replace_type (struct type
*ntype
, struct type
*type
)
537 struct type
*cv_chain
, *as_chain
, *ptr
, *ref
;
539 cv_chain
= TYPE_CV_TYPE (ntype
);
540 as_chain
= TYPE_AS_TYPE (ntype
);
541 ptr
= TYPE_POINTER_TYPE (ntype
);
542 ref
= TYPE_REFERENCE_TYPE (ntype
);
546 TYPE_POINTER_TYPE (ntype
) = ptr
;
547 TYPE_REFERENCE_TYPE (ntype
) = ref
;
548 TYPE_CV_TYPE (ntype
) = cv_chain
;
549 TYPE_AS_TYPE (ntype
) = as_chain
;
551 finish_cv_type (ntype
);
554 /* Implement direct support for MEMBER_TYPE in GNU C++.
555 May need to construct such a type if this is the first use.
556 The TYPE is the type of the member. The DOMAIN is the type
557 of the aggregate that the member belongs to. */
560 lookup_member_type (struct type
*type
, struct type
*domain
)
562 register struct type
*mtype
;
564 mtype
= alloc_type (TYPE_OBJFILE (type
));
565 smash_to_member_type (mtype
, domain
, type
);
569 /* Allocate a stub method whose return type is TYPE.
570 This apparently happens for speed of symbol reading, since parsing
571 out the arguments to the method is cpu-intensive, the way we are doing
572 it. So, we will fill in arguments later.
573 This always returns a fresh type. */
576 allocate_stub_method (struct type
*type
)
580 mtype
= init_type (TYPE_CODE_METHOD
, 1, TYPE_FLAG_STUB
, NULL
,
581 TYPE_OBJFILE (type
));
582 TYPE_TARGET_TYPE (mtype
) = type
;
583 /* _DOMAIN_TYPE (mtype) = unknown yet */
584 /* _ARG_TYPES (mtype) = unknown yet */
588 /* Create a range type using either a blank type supplied in RESULT_TYPE,
589 or creating a new type, inheriting the objfile from INDEX_TYPE.
591 Indices will be of type INDEX_TYPE, and will range from LOW_BOUND to
592 HIGH_BOUND, inclusive.
594 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
595 sure it is TYPE_CODE_UNDEF before we bash it into a range type? */
598 create_range_type (struct type
*result_type
, struct type
*index_type
,
599 int low_bound
, int high_bound
)
601 if (result_type
== NULL
)
603 result_type
= alloc_type (TYPE_OBJFILE (index_type
));
605 TYPE_CODE (result_type
) = TYPE_CODE_RANGE
;
606 TYPE_TARGET_TYPE (result_type
) = index_type
;
607 if (TYPE_STUB (index_type
))
608 TYPE_FLAGS (result_type
) |= TYPE_FLAG_TARGET_STUB
;
610 TYPE_LENGTH (result_type
) = TYPE_LENGTH (check_typedef (index_type
));
611 TYPE_NFIELDS (result_type
) = 2;
612 TYPE_FIELDS (result_type
) = (struct field
*)
613 TYPE_ALLOC (result_type
, 2 * sizeof (struct field
));
614 memset (TYPE_FIELDS (result_type
), 0, 2 * sizeof (struct field
));
615 TYPE_FIELD_BITPOS (result_type
, 0) = low_bound
;
616 TYPE_FIELD_BITPOS (result_type
, 1) = high_bound
;
617 TYPE_FIELD_TYPE (result_type
, 0) = builtin_type_int
; /* FIXME */
618 TYPE_FIELD_TYPE (result_type
, 1) = builtin_type_int
; /* FIXME */
621 TYPE_FLAGS (result_type
) |= TYPE_FLAG_UNSIGNED
;
623 return (result_type
);
626 /* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type TYPE.
627 Return 1 of type is a range type, 0 if it is discrete (and bounds
628 will fit in LONGEST), or -1 otherwise. */
631 get_discrete_bounds (struct type
*type
, LONGEST
*lowp
, LONGEST
*highp
)
633 CHECK_TYPEDEF (type
);
634 switch (TYPE_CODE (type
))
636 case TYPE_CODE_RANGE
:
637 *lowp
= TYPE_LOW_BOUND (type
);
638 *highp
= TYPE_HIGH_BOUND (type
);
641 if (TYPE_NFIELDS (type
) > 0)
643 /* The enums may not be sorted by value, so search all
647 *lowp
= *highp
= TYPE_FIELD_BITPOS (type
, 0);
648 for (i
= 0; i
< TYPE_NFIELDS (type
); i
++)
650 if (TYPE_FIELD_BITPOS (type
, i
) < *lowp
)
651 *lowp
= TYPE_FIELD_BITPOS (type
, i
);
652 if (TYPE_FIELD_BITPOS (type
, i
) > *highp
)
653 *highp
= TYPE_FIELD_BITPOS (type
, i
);
656 /* Set unsigned indicator if warranted. */
659 TYPE_FLAGS (type
) |= TYPE_FLAG_UNSIGNED
;
673 if (TYPE_LENGTH (type
) > sizeof (LONGEST
)) /* Too big */
675 if (!TYPE_UNSIGNED (type
))
677 *lowp
= -(1 << (TYPE_LENGTH (type
) * TARGET_CHAR_BIT
- 1));
681 /* ... fall through for unsigned ints ... */
684 /* This round-about calculation is to avoid shifting by
685 TYPE_LENGTH (type) * TARGET_CHAR_BIT, which will not work
686 if TYPE_LENGTH (type) == sizeof (LONGEST). */
687 *highp
= 1 << (TYPE_LENGTH (type
) * TARGET_CHAR_BIT
- 1);
688 *highp
= (*highp
- 1) | *highp
;
695 /* Create an array type using either a blank type supplied in RESULT_TYPE,
696 or creating a new type, inheriting the objfile from RANGE_TYPE.
698 Elements will be of type ELEMENT_TYPE, the indices will be of type
701 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
702 sure it is TYPE_CODE_UNDEF before we bash it into an array type? */
705 create_array_type (struct type
*result_type
, struct type
*element_type
,
706 struct type
*range_type
)
708 LONGEST low_bound
, high_bound
;
710 if (result_type
== NULL
)
712 result_type
= alloc_type (TYPE_OBJFILE (range_type
));
714 TYPE_CODE (result_type
) = TYPE_CODE_ARRAY
;
715 TYPE_TARGET_TYPE (result_type
) = element_type
;
716 if (get_discrete_bounds (range_type
, &low_bound
, &high_bound
) < 0)
717 low_bound
= high_bound
= 0;
718 CHECK_TYPEDEF (element_type
);
719 TYPE_LENGTH (result_type
) =
720 TYPE_LENGTH (element_type
) * (high_bound
- low_bound
+ 1);
721 TYPE_NFIELDS (result_type
) = 1;
722 TYPE_FIELDS (result_type
) =
723 (struct field
*) TYPE_ALLOC (result_type
, sizeof (struct field
));
724 memset (TYPE_FIELDS (result_type
), 0, sizeof (struct field
));
725 TYPE_FIELD_TYPE (result_type
, 0) = range_type
;
726 TYPE_VPTR_FIELDNO (result_type
) = -1;
728 /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays */
729 if (TYPE_LENGTH (result_type
) == 0)
730 TYPE_FLAGS (result_type
) |= TYPE_FLAG_TARGET_STUB
;
732 return (result_type
);
735 /* Create a string type using either a blank type supplied in RESULT_TYPE,
736 or creating a new type. String types are similar enough to array of
737 char types that we can use create_array_type to build the basic type
738 and then bash it into a string type.
740 For fixed length strings, the range type contains 0 as the lower
741 bound and the length of the string minus one as the upper bound.
743 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
744 sure it is TYPE_CODE_UNDEF before we bash it into a string type? */
747 create_string_type (struct type
*result_type
, struct type
*range_type
)
749 result_type
= create_array_type (result_type
,
750 *current_language
->string_char_type
,
752 TYPE_CODE (result_type
) = TYPE_CODE_STRING
;
753 return (result_type
);
757 create_set_type (struct type
*result_type
, struct type
*domain_type
)
759 LONGEST low_bound
, high_bound
, bit_length
;
760 if (result_type
== NULL
)
762 result_type
= alloc_type (TYPE_OBJFILE (domain_type
));
764 TYPE_CODE (result_type
) = TYPE_CODE_SET
;
765 TYPE_NFIELDS (result_type
) = 1;
766 TYPE_FIELDS (result_type
) = (struct field
*)
767 TYPE_ALLOC (result_type
, 1 * sizeof (struct field
));
768 memset (TYPE_FIELDS (result_type
), 0, sizeof (struct field
));
770 if (!TYPE_STUB (domain_type
))
772 if (get_discrete_bounds (domain_type
, &low_bound
, &high_bound
) < 0)
773 low_bound
= high_bound
= 0;
774 bit_length
= high_bound
- low_bound
+ 1;
775 TYPE_LENGTH (result_type
)
776 = (bit_length
+ TARGET_CHAR_BIT
- 1) / TARGET_CHAR_BIT
;
778 TYPE_FIELD_TYPE (result_type
, 0) = domain_type
;
781 TYPE_FLAGS (result_type
) |= TYPE_FLAG_UNSIGNED
;
783 return (result_type
);
786 /* Construct and return a type of the form:
787 struct NAME { ELT_TYPE ELT_NAME[N]; }
788 We use these types for SIMD registers. For example, the type of
789 the SSE registers on the late x86-family processors is:
790 struct __builtin_v4sf { float f[4]; }
791 built by the function call:
792 init_simd_type ("__builtin_v4sf", builtin_type_float, "f", 4)
793 The type returned is a permanent type, allocated using malloc; it
794 doesn't live in any objfile's obstack. */
796 init_simd_type (char *name
,
797 struct type
*elt_type
,
801 struct type
*simd_type
;
802 struct type
*array_type
;
804 simd_type
= init_composite_type (name
, TYPE_CODE_STRUCT
);
805 array_type
= create_array_type (0, elt_type
,
806 create_range_type (0, builtin_type_int
,
808 append_composite_type_field (simd_type
, elt_name
, array_type
);
813 build_builtin_type_vec128 (void)
815 /* Construct a type for the 128 bit registers. The type we're
818 union __gdb_builtin_type_vec128
820 struct __builtin_v16qi v16qi
;
821 struct __builtin_v8hi v8hi
;
822 struct __builtin_v4si v4si
;
823 struct __builtin_v4sf v4sf
;
830 t
= init_composite_type ("__gdb_builtin_type_vec128", TYPE_CODE_UNION
);
831 append_composite_type_field (t
, "uint128", builtin_type_int128
);
832 append_composite_type_field (t
, "v4sf", builtin_type_v4sf
);
833 append_composite_type_field (t
, "v4si", builtin_type_v4si
);
834 append_composite_type_field (t
, "v8hi", builtin_type_v8hi
);
835 append_composite_type_field (t
, "v16qi", builtin_type_v16qi
);
840 /* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE.
841 A MEMBER is a wierd thing -- it amounts to a typed offset into
842 a struct, e.g. "an int at offset 8". A MEMBER TYPE doesn't
843 include the offset (that's the value of the MEMBER itself), but does
844 include the structure type into which it points (for some reason).
846 When "smashing" the type, we preserve the objfile that the
847 old type pointed to, since we aren't changing where the type is actually
851 smash_to_member_type (struct type
*type
, struct type
*domain
,
852 struct type
*to_type
)
854 struct objfile
*objfile
;
856 objfile
= TYPE_OBJFILE (type
);
858 memset ((char *) type
, 0, sizeof (struct type
));
859 TYPE_OBJFILE (type
) = objfile
;
860 TYPE_TARGET_TYPE (type
) = to_type
;
861 TYPE_DOMAIN_TYPE (type
) = domain
;
862 TYPE_LENGTH (type
) = 1; /* In practice, this is never needed. */
863 TYPE_CODE (type
) = TYPE_CODE_MEMBER
;
866 /* Smash TYPE to be a type of method of DOMAIN with type TO_TYPE.
867 METHOD just means `function that gets an extra "this" argument'.
869 When "smashing" the type, we preserve the objfile that the
870 old type pointed to, since we aren't changing where the type is actually
874 smash_to_method_type (struct type
*type
, struct type
*domain
,
875 struct type
*to_type
, struct type
**args
)
877 struct objfile
*objfile
;
879 objfile
= TYPE_OBJFILE (type
);
881 memset ((char *) type
, 0, sizeof (struct type
));
882 TYPE_OBJFILE (type
) = objfile
;
883 TYPE_TARGET_TYPE (type
) = to_type
;
884 TYPE_DOMAIN_TYPE (type
) = domain
;
885 TYPE_ARG_TYPES (type
) = args
;
886 TYPE_LENGTH (type
) = 1; /* In practice, this is never needed. */
887 TYPE_CODE (type
) = TYPE_CODE_METHOD
;
890 /* Return a typename for a struct/union/enum type without "struct ",
891 "union ", or "enum ". If the type has a NULL name, return NULL. */
894 type_name_no_tag (register const struct type
*type
)
896 if (TYPE_TAG_NAME (type
) != NULL
)
897 return TYPE_TAG_NAME (type
);
899 /* Is there code which expects this to return the name if there is no
900 tag name? My guess is that this is mainly used for C++ in cases where
901 the two will always be the same. */
902 return TYPE_NAME (type
);
905 /* Lookup a primitive type named NAME.
906 Return zero if NAME is not a primitive type. */
909 lookup_primitive_typename (char *name
)
911 struct type
**const *p
;
913 for (p
= current_language
->la_builtin_type_vector
; *p
!= NULL
; p
++)
915 if (STREQ ((**p
)->name
, name
))
923 /* Lookup a typedef or primitive type named NAME,
924 visible in lexical block BLOCK.
925 If NOERR is nonzero, return zero if NAME is not suitably defined. */
928 lookup_typename (char *name
, struct block
*block
, int noerr
)
930 register struct symbol
*sym
;
931 register struct type
*tmp
;
933 sym
= lookup_symbol (name
, block
, VAR_NAMESPACE
, 0, (struct symtab
**) NULL
);
934 if (sym
== NULL
|| SYMBOL_CLASS (sym
) != LOC_TYPEDEF
)
936 tmp
= lookup_primitive_typename (name
);
941 else if (!tmp
&& noerr
)
947 error ("No type named %s.", name
);
950 return (SYMBOL_TYPE (sym
));
954 lookup_unsigned_typename (char *name
)
956 char *uns
= alloca (strlen (name
) + 10);
958 strcpy (uns
, "unsigned ");
959 strcpy (uns
+ 9, name
);
960 return (lookup_typename (uns
, (struct block
*) NULL
, 0));
964 lookup_signed_typename (char *name
)
967 char *uns
= alloca (strlen (name
) + 8);
969 strcpy (uns
, "signed ");
970 strcpy (uns
+ 7, name
);
971 t
= lookup_typename (uns
, (struct block
*) NULL
, 1);
972 /* If we don't find "signed FOO" just try again with plain "FOO". */
975 return lookup_typename (name
, (struct block
*) NULL
, 0);
978 /* Lookup a structure type named "struct NAME",
979 visible in lexical block BLOCK. */
982 lookup_struct (char *name
, struct block
*block
)
984 register struct symbol
*sym
;
986 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
987 (struct symtab
**) NULL
);
991 error ("No struct type named %s.", name
);
993 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
995 error ("This context has class, union or enum %s, not a struct.", name
);
997 return (SYMBOL_TYPE (sym
));
1000 /* Lookup a union type named "union NAME",
1001 visible in lexical block BLOCK. */
1004 lookup_union (char *name
, struct block
*block
)
1006 register struct symbol
*sym
;
1009 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
1010 (struct symtab
**) NULL
);
1013 error ("No union type named %s.", name
);
1015 t
= SYMBOL_TYPE (sym
);
1017 if (TYPE_CODE (t
) == TYPE_CODE_UNION
)
1020 /* C++ unions may come out with TYPE_CODE_CLASS, but we look at
1021 * a further "declared_type" field to discover it is really a union.
1023 if (HAVE_CPLUS_STRUCT (t
))
1024 if (TYPE_DECLARED_TYPE (t
) == DECLARED_TYPE_UNION
)
1027 /* If we get here, it's not a union */
1028 error ("This context has class, struct or enum %s, not a union.", name
);
1032 /* Lookup an enum type named "enum NAME",
1033 visible in lexical block BLOCK. */
1036 lookup_enum (char *name
, struct block
*block
)
1038 register struct symbol
*sym
;
1040 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
1041 (struct symtab
**) NULL
);
1044 error ("No enum type named %s.", name
);
1046 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_ENUM
)
1048 error ("This context has class, struct or union %s, not an enum.", name
);
1050 return (SYMBOL_TYPE (sym
));
1053 /* Lookup a template type named "template NAME<TYPE>",
1054 visible in lexical block BLOCK. */
1057 lookup_template_type (char *name
, struct type
*type
, struct block
*block
)
1060 char *nam
= (char *) alloca (strlen (name
) + strlen (type
->name
) + 4);
1063 strcat (nam
, type
->name
);
1064 strcat (nam
, " >"); /* FIXME, extra space still introduced in gcc? */
1066 sym
= lookup_symbol (nam
, block
, VAR_NAMESPACE
, 0, (struct symtab
**) NULL
);
1070 error ("No template type named %s.", name
);
1072 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
1074 error ("This context has class, union or enum %s, not a struct.", name
);
1076 return (SYMBOL_TYPE (sym
));
1079 /* Given a type TYPE, lookup the type of the component of type named NAME.
1081 TYPE can be either a struct or union, or a pointer or reference to a struct or
1082 union. If it is a pointer or reference, its target type is automatically used.
1083 Thus '.' and '->' are interchangable, as specified for the definitions of the
1084 expression element types STRUCTOP_STRUCT and STRUCTOP_PTR.
1086 If NOERR is nonzero, return zero if NAME is not suitably defined.
1087 If NAME is the name of a baseclass type, return that type. */
1090 lookup_struct_elt_type (struct type
*type
, char *name
, int noerr
)
1096 CHECK_TYPEDEF (type
);
1097 if (TYPE_CODE (type
) != TYPE_CODE_PTR
1098 && TYPE_CODE (type
) != TYPE_CODE_REF
)
1100 type
= TYPE_TARGET_TYPE (type
);
1103 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
&&
1104 TYPE_CODE (type
) != TYPE_CODE_UNION
)
1106 target_terminal_ours ();
1107 gdb_flush (gdb_stdout
);
1108 fprintf_unfiltered (gdb_stderr
, "Type ");
1109 type_print (type
, "", gdb_stderr
, -1);
1110 error (" is not a structure or union type.");
1114 /* FIXME: This change put in by Michael seems incorrect for the case where
1115 the structure tag name is the same as the member name. I.E. when doing
1116 "ptype bell->bar" for "struct foo { int bar; int foo; } bell;"
1121 typename
= type_name_no_tag (type
);
1122 if (typename
!= NULL
&& STREQ (typename
, name
))
1127 for (i
= TYPE_NFIELDS (type
) - 1; i
>= TYPE_N_BASECLASSES (type
); i
--)
1129 char *t_field_name
= TYPE_FIELD_NAME (type
, i
);
1131 if (t_field_name
&& (strcmp_iw (t_field_name
, name
) == 0))
1133 return TYPE_FIELD_TYPE (type
, i
);
1137 /* OK, it's not in this class. Recursively check the baseclasses. */
1138 for (i
= TYPE_N_BASECLASSES (type
) - 1; i
>= 0; i
--)
1142 t
= lookup_struct_elt_type (TYPE_BASECLASS (type
, i
), name
, noerr
);
1154 target_terminal_ours ();
1155 gdb_flush (gdb_stdout
);
1156 fprintf_unfiltered (gdb_stderr
, "Type ");
1157 type_print (type
, "", gdb_stderr
, -1);
1158 fprintf_unfiltered (gdb_stderr
, " has no component named ");
1159 fputs_filtered (name
, gdb_stderr
);
1161 return (struct type
*) -1; /* For lint */
1164 /* If possible, make the vptr_fieldno and vptr_basetype fields of TYPE
1165 valid. Callers should be aware that in some cases (for example,
1166 the type or one of its baseclasses is a stub type and we are
1167 debugging a .o file), this function will not be able to find the virtual
1168 function table pointer, and vptr_fieldno will remain -1 and vptr_basetype
1169 will remain NULL. */
1172 fill_in_vptr_fieldno (struct type
*type
)
1174 CHECK_TYPEDEF (type
);
1176 if (TYPE_VPTR_FIELDNO (type
) < 0)
1180 /* We must start at zero in case the first (and only) baseclass is
1181 virtual (and hence we cannot share the table pointer). */
1182 for (i
= 0; i
< TYPE_N_BASECLASSES (type
); i
++)
1184 fill_in_vptr_fieldno (TYPE_BASECLASS (type
, i
));
1185 if (TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type
, i
)) >= 0)
1187 TYPE_VPTR_FIELDNO (type
)
1188 = TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type
, i
));
1189 TYPE_VPTR_BASETYPE (type
)
1190 = TYPE_VPTR_BASETYPE (TYPE_BASECLASS (type
, i
));
1197 /* Find the method and field indices for the destructor in class type T.
1198 Return 1 if the destructor was found, otherwise, return 0. */
1201 get_destructor_fn_field (struct type
*t
, int *method_indexp
, int *field_indexp
)
1205 for (i
= 0; i
< TYPE_NFN_FIELDS (t
); i
++)
1208 struct fn_field
*f
= TYPE_FN_FIELDLIST1 (t
, i
);
1210 for (j
= 0; j
< TYPE_FN_FIELDLIST_LENGTH (t
, i
); j
++)
1212 if (is_destructor_name (TYPE_FN_FIELD_PHYSNAME (f
, j
)) != 0)
1223 /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989.
1225 If this is a stubbed struct (i.e. declared as struct foo *), see if
1226 we can find a full definition in some other file. If so, copy this
1227 definition, so we can use it in future. There used to be a comment (but
1228 not any code) that if we don't find a full definition, we'd set a flag
1229 so we don't spend time in the future checking the same type. That would
1230 be a mistake, though--we might load in more symbols which contain a
1231 full definition for the type.
1233 This used to be coded as a macro, but I don't think it is called
1234 often enough to merit such treatment. */
1236 struct complaint stub_noname_complaint
=
1237 {"stub type has NULL name", 0, 0};
1240 check_typedef (struct type
*type
)
1242 struct type
*orig_type
= type
;
1243 int is_const
, is_volatile
;
1245 while (TYPE_CODE (type
) == TYPE_CODE_TYPEDEF
)
1247 if (!TYPE_TARGET_TYPE (type
))
1252 /* It is dangerous to call lookup_symbol if we are currently
1253 reading a symtab. Infinite recursion is one danger. */
1254 if (currently_reading_symtab
)
1257 name
= type_name_no_tag (type
);
1258 /* FIXME: shouldn't we separately check the TYPE_NAME and the
1259 TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE
1260 as appropriate? (this code was written before TYPE_NAME and
1261 TYPE_TAG_NAME were separate). */
1264 complain (&stub_noname_complaint
);
1267 sym
= lookup_symbol (name
, 0, STRUCT_NAMESPACE
, 0,
1268 (struct symtab
**) NULL
);
1270 TYPE_TARGET_TYPE (type
) = SYMBOL_TYPE (sym
);
1272 TYPE_TARGET_TYPE (type
) = alloc_type (NULL
); /* TYPE_CODE_UNDEF */
1274 type
= TYPE_TARGET_TYPE (type
);
1277 is_const
= TYPE_CONST (type
);
1278 is_volatile
= TYPE_VOLATILE (type
);
1280 /* If this is a struct/class/union with no fields, then check whether a
1281 full definition exists somewhere else. This is for systems where a
1282 type definition with no fields is issued for such types, instead of
1283 identifying them as stub types in the first place */
1285 if (TYPE_IS_OPAQUE (type
) && opaque_type_resolution
&& !currently_reading_symtab
)
1287 char *name
= type_name_no_tag (type
);
1288 struct type
*newtype
;
1291 complain (&stub_noname_complaint
);
1294 newtype
= lookup_transparent_type (name
);
1296 make_cv_type (is_const
, is_volatile
, newtype
, &type
);
1298 /* Otherwise, rely on the stub flag being set for opaque/stubbed types */
1299 else if (TYPE_STUB (type
) && !currently_reading_symtab
)
1301 char *name
= type_name_no_tag (type
);
1302 /* FIXME: shouldn't we separately check the TYPE_NAME and the
1303 TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE
1304 as appropriate? (this code was written before TYPE_NAME and
1305 TYPE_TAG_NAME were separate). */
1309 complain (&stub_noname_complaint
);
1312 sym
= lookup_symbol (name
, 0, STRUCT_NAMESPACE
, 0, (struct symtab
**) NULL
);
1314 make_cv_type (is_const
, is_volatile
, SYMBOL_TYPE (sym
), &type
);
1317 if (TYPE_TARGET_STUB (type
))
1319 struct type
*range_type
;
1320 struct type
*target_type
= check_typedef (TYPE_TARGET_TYPE (type
));
1322 if (TYPE_STUB (target_type
) || TYPE_TARGET_STUB (target_type
))
1325 else if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
1326 && TYPE_NFIELDS (type
) == 1
1327 && (TYPE_CODE (range_type
= TYPE_FIELD_TYPE (type
, 0))
1328 == TYPE_CODE_RANGE
))
1330 /* Now recompute the length of the array type, based on its
1331 number of elements and the target type's length. */
1332 TYPE_LENGTH (type
) =
1333 ((TYPE_FIELD_BITPOS (range_type
, 1)
1334 - TYPE_FIELD_BITPOS (range_type
, 0)
1336 * TYPE_LENGTH (target_type
));
1337 TYPE_FLAGS (type
) &= ~TYPE_FLAG_TARGET_STUB
;
1339 else if (TYPE_CODE (type
) == TYPE_CODE_RANGE
)
1341 TYPE_LENGTH (type
) = TYPE_LENGTH (target_type
);
1342 TYPE_FLAGS (type
) &= ~TYPE_FLAG_TARGET_STUB
;
1345 /* Cache TYPE_LENGTH for future use. */
1346 TYPE_LENGTH (orig_type
) = TYPE_LENGTH (type
);
1350 /* New code added to support parsing of Cfront stabs strings */
1351 #define INIT_EXTRA { pextras->len=0; pextras->str[0]='\0'; }
1352 #define ADD_EXTRA(c) { pextras->str[pextras->len++]=c; }
1355 add_name (struct extra
*pextras
, char *n
)
1359 if ((nlen
= (n
? strlen (n
) : 0)) == 0)
1361 sprintf (pextras
->str
+ pextras
->len
, "%d%s", nlen
, n
);
1362 pextras
->len
= strlen (pextras
->str
);
1366 add_mangled_type (struct extra
*pextras
, struct type
*t
)
1368 enum type_code tcode
;
1372 tcode
= TYPE_CODE (t
);
1373 tlen
= TYPE_LENGTH (t
);
1374 tflags
= TYPE_FLAGS (t
);
1375 tname
= TYPE_NAME (t
);
1376 /* args of "..." seem to get mangled as "e" */
1394 if ((pname
= strrchr (tname
, 'l'), pname
) && !strcmp (pname
, "long"))
1407 static struct complaint msg
=
1408 {"Bad int type code length x%x\n", 0, 0};
1410 complain (&msg
, tlen
);
1429 static struct complaint msg
=
1430 {"Bad float type code length x%x\n", 0, 0};
1431 complain (&msg
, tlen
);
1437 /* followed by what it's a ref to */
1441 /* followed by what it's a ptr to */
1443 case TYPE_CODE_TYPEDEF
:
1445 static struct complaint msg
=
1446 {"Typedefs in overloaded functions not yet supported\n", 0, 0};
1449 /* followed by type bytes & name */
1451 case TYPE_CODE_FUNC
:
1453 /* followed by func's arg '_' & ret types */
1455 case TYPE_CODE_VOID
:
1458 case TYPE_CODE_METHOD
:
1460 /* followed by name of class and func's arg '_' & ret types */
1461 add_name (pextras
, tname
);
1462 ADD_EXTRA ('F'); /* then mangle function */
1464 case TYPE_CODE_STRUCT
: /* C struct */
1465 case TYPE_CODE_UNION
: /* C union */
1466 case TYPE_CODE_ENUM
: /* Enumeration type */
1467 /* followed by name of type */
1468 add_name (pextras
, tname
);
1471 /* errors possible types/not supported */
1472 case TYPE_CODE_CHAR
:
1473 case TYPE_CODE_ARRAY
: /* Array type */
1474 case TYPE_CODE_MEMBER
: /* Member type */
1475 case TYPE_CODE_BOOL
:
1476 case TYPE_CODE_COMPLEX
: /* Complex float */
1477 case TYPE_CODE_UNDEF
:
1478 case TYPE_CODE_SET
: /* Pascal sets */
1479 case TYPE_CODE_RANGE
:
1480 case TYPE_CODE_STRING
:
1481 case TYPE_CODE_BITSTRING
:
1482 case TYPE_CODE_ERROR
:
1485 static struct complaint msg
=
1486 {"Unknown type code x%x\n", 0, 0};
1487 complain (&msg
, tcode
);
1491 add_mangled_type (pextras
, t
->target_type
);
1496 cfront_mangle_name (struct type
*type
, int i
, int j
)
1499 char *mangled_name
= gdb_mangle_name (type
, i
, j
);
1501 f
= TYPE_FN_FIELDLIST1 (type
, i
); /* moved from below */
1503 /* kludge to support cfront methods - gdb expects to find "F" for
1504 ARM_mangled names, so when we mangle, we have to add it here */
1508 char *arm_mangled_name
;
1509 struct fn_field
*method
= &f
[j
];
1510 char *field_name
= TYPE_FN_FIELDLIST_NAME (type
, i
);
1511 char *physname
= TYPE_FN_FIELD_PHYSNAME (f
, j
);
1512 char *newname
= type_name_no_tag (type
);
1514 struct type
*ftype
= TYPE_FN_FIELD_TYPE (f
, j
);
1515 int nargs
= TYPE_NFIELDS (ftype
); /* number of args */
1516 struct extra extras
, *pextras
= &extras
;
1519 if (TYPE_FN_FIELD_STATIC_P (f
, j
)) /* j for sublist within this list */
1522 /* add args here! */
1523 if (nargs
<= 1) /* no args besides this */
1527 for (k
= 1; k
< nargs
; k
++)
1530 t
= TYPE_FIELD_TYPE (ftype
, k
);
1531 add_mangled_type (pextras
, t
);
1535 printf ("add_mangled_type: %s\n", extras
.str
); /* FIXME */
1536 xasprintf (&arm_mangled_name
, "%s%s", mangled_name
, extras
.str
);
1537 xfree (mangled_name
);
1538 mangled_name
= arm_mangled_name
;
1544 /* End of new code added to support parsing of Cfront stabs strings */
1546 /* Parse a type expression in the string [P..P+LENGTH). If an error occurs,
1547 silently return builtin_type_void. */
1550 safe_parse_type (char *p
, int length
)
1552 struct ui_file
*saved_gdb_stderr
;
1555 /* Suppress error messages. */
1556 saved_gdb_stderr
= gdb_stderr
;
1557 gdb_stderr
= ui_file_new ();
1559 /* Call parse_and_eval_type() without fear of longjmp()s. */
1560 if (!gdb_parse_and_eval_type (p
, length
, &type
))
1561 type
= builtin_type_void
;
1563 /* Stop suppressing error messages. */
1564 ui_file_delete (gdb_stderr
);
1565 gdb_stderr
= saved_gdb_stderr
;
1570 /* Ugly hack to convert method stubs into method types.
1572 He ain't kiddin'. This demangles the name of the method into a string
1573 including argument types, parses out each argument type, generates
1574 a string casting a zero to that type, evaluates the string, and stuffs
1575 the resulting type into an argtype vector!!! Then it knows the type
1576 of the whole function (including argument types for overloading),
1577 which info used to be in the stab's but was removed to hack back
1578 the space required for them. */
1581 check_stub_method (struct type
*type
, int method_id
, int signature_id
)
1584 char *mangled_name
= gdb_mangle_name (type
, method_id
, signature_id
);
1585 char *demangled_name
= cplus_demangle (mangled_name
,
1586 DMGL_PARAMS
| DMGL_ANSI
);
1587 char *argtypetext
, *p
;
1588 int depth
= 0, argcount
= 1;
1589 struct type
**argtypes
;
1592 /* Make sure we got back a function string that we can use. */
1594 p
= strchr (demangled_name
, '(');
1598 if (demangled_name
== NULL
|| p
== NULL
)
1599 error ("Internal: Cannot demangle mangled name `%s'.", mangled_name
);
1601 /* Now, read in the parameters that define this type. */
1606 if (*p
== '(' || *p
== '<')
1610 else if (*p
== ')' || *p
== '>')
1614 else if (*p
== ',' && depth
== 0)
1622 /* We need two more slots: one for the THIS pointer, and one for the
1623 NULL [...] or void [end of arglist]. */
1625 argtypes
= (struct type
**)
1626 TYPE_ALLOC (type
, (argcount
+ 2) * sizeof (struct type
*));
1628 /* FIXME: This is wrong for static member functions. */
1629 argtypes
[0] = lookup_pointer_type (type
);
1632 if (*p
!= ')') /* () means no args, skip while */
1637 if (depth
<= 0 && (*p
== ',' || *p
== ')'))
1639 /* Avoid parsing of ellipsis, they will be handled below. */
1640 if (strncmp (argtypetext
, "...", p
- argtypetext
) != 0)
1642 argtypes
[argcount
] =
1643 safe_parse_type (argtypetext
, p
- argtypetext
);
1646 argtypetext
= p
+ 1;
1649 if (*p
== '(' || *p
== '<')
1653 else if (*p
== ')' || *p
== '>')
1662 if (p
[-2] != '.') /* Not '...' */
1664 argtypes
[argcount
] = builtin_type_void
; /* List terminator */
1668 argtypes
[argcount
] = NULL
; /* Ellist terminator */
1671 xfree (demangled_name
);
1673 f
= TYPE_FN_FIELDLIST1 (type
, method_id
);
1675 TYPE_FN_FIELD_PHYSNAME (f
, signature_id
) = mangled_name
;
1677 /* Now update the old "stub" type into a real type. */
1678 mtype
= TYPE_FN_FIELD_TYPE (f
, signature_id
);
1679 TYPE_DOMAIN_TYPE (mtype
) = type
;
1680 TYPE_ARG_TYPES (mtype
) = argtypes
;
1681 TYPE_FLAGS (mtype
) &= ~TYPE_FLAG_STUB
;
1682 TYPE_FN_FIELD_STUB (f
, signature_id
) = 0;
1685 const struct cplus_struct_type cplus_struct_default
;
1688 allocate_cplus_struct_type (struct type
*type
)
1690 if (!HAVE_CPLUS_STRUCT (type
))
1692 TYPE_CPLUS_SPECIFIC (type
) = (struct cplus_struct_type
*)
1693 TYPE_ALLOC (type
, sizeof (struct cplus_struct_type
));
1694 *(TYPE_CPLUS_SPECIFIC (type
)) = cplus_struct_default
;
1698 /* Helper function to initialize the standard scalar types.
1700 If NAME is non-NULL and OBJFILE is non-NULL, then we make a copy
1701 of the string pointed to by name in the type_obstack for that objfile,
1702 and initialize the type name to that copy. There are places (mipsread.c
1703 in particular, where init_type is called with a NULL value for NAME). */
1706 init_type (enum type_code code
, int length
, int flags
, char *name
,
1707 struct objfile
*objfile
)
1709 register struct type
*type
;
1711 type
= alloc_type (objfile
);
1712 TYPE_CODE (type
) = code
;
1713 TYPE_LENGTH (type
) = length
;
1714 TYPE_FLAGS (type
) |= flags
;
1715 if ((name
!= NULL
) && (objfile
!= NULL
))
1718 obsavestring (name
, strlen (name
), &objfile
->type_obstack
);
1722 TYPE_NAME (type
) = name
;
1727 if (code
== TYPE_CODE_STRUCT
|| code
== TYPE_CODE_UNION
)
1729 INIT_CPLUS_SPECIFIC (type
);
1734 /* Helper function. Create an empty composite type. */
1737 init_composite_type (char *name
, enum type_code code
)
1740 gdb_assert (code
== TYPE_CODE_STRUCT
1741 || code
== TYPE_CODE_UNION
);
1742 t
= init_type (code
, 0, 0, NULL
, NULL
);
1743 TYPE_TAG_NAME (t
) = name
;
1747 /* Helper function. Append a field to a composite type. */
1750 append_composite_type_field (struct type
*t
, char *name
, struct type
*field
)
1753 TYPE_NFIELDS (t
) = TYPE_NFIELDS (t
) + 1;
1754 TYPE_FIELDS (t
) = xrealloc (TYPE_FIELDS (t
),
1755 sizeof (struct field
) * TYPE_NFIELDS (t
));
1756 f
= &(TYPE_FIELDS (t
)[TYPE_NFIELDS (t
) - 1]);
1757 memset (f
, 0, sizeof f
[0]);
1758 FIELD_TYPE (f
[0]) = field
;
1759 FIELD_NAME (f
[0]) = name
;
1760 if (TYPE_CODE (t
) == TYPE_CODE_UNION
)
1762 if (TYPE_LENGTH (t
) < TYPE_LENGTH (field
))
1763 TYPE_LENGTH (t
) = TYPE_LENGTH (field
);
1765 else if (TYPE_CODE (t
) == TYPE_CODE_STRUCT
)
1767 TYPE_LENGTH (t
) = TYPE_LENGTH (t
) + TYPE_LENGTH (field
);
1768 if (TYPE_NFIELDS (t
) > 1)
1770 FIELD_BITPOS (f
[0]) = (FIELD_BITPOS (f
[-1])
1771 + TYPE_LENGTH (field
) * TARGET_CHAR_BIT
);
1776 /* Look up a fundamental type for the specified objfile.
1777 May need to construct such a type if this is the first use.
1779 Some object file formats (ELF, COFF, etc) do not define fundamental
1780 types such as "int" or "double". Others (stabs for example), do
1781 define fundamental types.
1783 For the formats which don't provide fundamental types, gdb can create
1784 such types, using defaults reasonable for the current language and
1785 the current target machine.
1787 NOTE: This routine is obsolescent. Each debugging format reader
1788 should manage it's own fundamental types, either creating them from
1789 suitable defaults or reading them from the debugging information,
1790 whichever is appropriate. The DWARF reader has already been
1791 fixed to do this. Once the other readers are fixed, this routine
1792 will go away. Also note that fundamental types should be managed
1793 on a compilation unit basis in a multi-language environment, not
1794 on a linkage unit basis as is done here. */
1798 lookup_fundamental_type (struct objfile
*objfile
, int typeid)
1800 register struct type
**typep
;
1801 register int nbytes
;
1803 if (typeid < 0 || typeid >= FT_NUM_MEMBERS
)
1805 error ("internal error - invalid fundamental type id %d", typeid);
1808 /* If this is the first time we need a fundamental type for this objfile
1809 then we need to initialize the vector of type pointers. */
1811 if (objfile
->fundamental_types
== NULL
)
1813 nbytes
= FT_NUM_MEMBERS
* sizeof (struct type
*);
1814 objfile
->fundamental_types
= (struct type
**)
1815 obstack_alloc (&objfile
->type_obstack
, nbytes
);
1816 memset ((char *) objfile
->fundamental_types
, 0, nbytes
);
1817 OBJSTAT (objfile
, n_types
+= FT_NUM_MEMBERS
);
1820 /* Look for this particular type in the fundamental type vector. If one is
1821 not found, create and install one appropriate for the current language. */
1823 typep
= objfile
->fundamental_types
+ typeid;
1826 *typep
= create_fundamental_type (objfile
, typeid);
1833 can_dereference (struct type
*t
)
1835 /* FIXME: Should we return true for references as well as pointers? */
1839 && TYPE_CODE (t
) == TYPE_CODE_PTR
1840 && TYPE_CODE (TYPE_TARGET_TYPE (t
)) != TYPE_CODE_VOID
);
1844 is_integral_type (struct type
*t
)
1849 && ((TYPE_CODE (t
) == TYPE_CODE_INT
)
1850 || (TYPE_CODE (t
) == TYPE_CODE_ENUM
)
1851 || (TYPE_CODE (t
) == TYPE_CODE_CHAR
)
1852 || (TYPE_CODE (t
) == TYPE_CODE_RANGE
)
1853 || (TYPE_CODE (t
) == TYPE_CODE_BOOL
)));
1856 /* Chill varying string and arrays are represented as follows:
1858 struct { int __var_length; ELEMENT_TYPE[MAX_SIZE] __var_data};
1860 Return true if TYPE is such a Chill varying type. */
1863 chill_varying_type (struct type
*type
)
1865 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
1866 || TYPE_NFIELDS (type
) != 2
1867 || strcmp (TYPE_FIELD_NAME (type
, 0), "__var_length") != 0)
1872 /* Check whether BASE is an ancestor or base class or DCLASS
1873 Return 1 if so, and 0 if not.
1874 Note: callers may want to check for identity of the types before
1875 calling this function -- identical types are considered to satisfy
1876 the ancestor relationship even if they're identical */
1879 is_ancestor (struct type
*base
, struct type
*dclass
)
1883 CHECK_TYPEDEF (base
);
1884 CHECK_TYPEDEF (dclass
);
1888 if (TYPE_NAME (base
) && TYPE_NAME (dclass
) &&
1889 !strcmp (TYPE_NAME (base
), TYPE_NAME (dclass
)))
1892 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1893 if (is_ancestor (base
, TYPE_BASECLASS (dclass
, i
)))
1901 /* See whether DCLASS has a virtual table. This routine is aimed at
1902 the HP/Taligent ANSI C++ runtime model, and may not work with other
1903 runtime models. Return 1 => Yes, 0 => No. */
1906 has_vtable (struct type
*dclass
)
1908 /* In the HP ANSI C++ runtime model, a class has a vtable only if it
1909 has virtual functions or virtual bases. */
1913 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
1916 /* First check for the presence of virtual bases */
1917 if (TYPE_FIELD_VIRTUAL_BITS (dclass
))
1918 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1919 if (B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass
), i
))
1922 /* Next check for virtual functions */
1923 if (TYPE_FN_FIELDLISTS (dclass
))
1924 for (i
= 0; i
< TYPE_NFN_FIELDS (dclass
); i
++)
1925 if (TYPE_FN_FIELD_VIRTUAL_P (TYPE_FN_FIELDLIST1 (dclass
, i
), 0))
1928 /* Recurse on non-virtual bases to see if any of them needs a vtable */
1929 if (TYPE_FIELD_VIRTUAL_BITS (dclass
))
1930 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1931 if ((!B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass
), i
)) &&
1932 (has_vtable (TYPE_FIELD_TYPE (dclass
, i
))))
1935 /* Well, maybe we don't need a virtual table */
1939 /* Return a pointer to the "primary base class" of DCLASS.
1941 A NULL return indicates that DCLASS has no primary base, or that it
1942 couldn't be found (insufficient information).
1944 This routine is aimed at the HP/Taligent ANSI C++ runtime model,
1945 and may not work with other runtime models. */
1948 primary_base_class (struct type
*dclass
)
1950 /* In HP ANSI C++'s runtime model, a "primary base class" of a class
1951 is the first directly inherited, non-virtual base class that
1952 requires a virtual table */
1956 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
1959 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1960 if (!TYPE_FIELD_VIRTUAL (dclass
, i
) &&
1961 has_vtable (TYPE_FIELD_TYPE (dclass
, i
)))
1962 return TYPE_FIELD_TYPE (dclass
, i
);
1967 /* Global manipulated by virtual_base_list[_aux]() */
1969 static struct vbase
*current_vbase_list
= NULL
;
1971 /* Return a pointer to a null-terminated list of struct vbase
1972 items. The vbasetype pointer of each item in the list points to the
1973 type information for a virtual base of the argument DCLASS.
1975 Helper function for virtual_base_list().
1976 Note: the list goes backward, right-to-left. virtual_base_list()
1977 copies the items out in reverse order. */
1980 virtual_base_list_aux (struct type
*dclass
)
1982 struct vbase
*tmp_vbase
;
1985 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
1988 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1990 /* Recurse on this ancestor, first */
1991 virtual_base_list_aux (TYPE_FIELD_TYPE (dclass
, i
));
1993 /* If this current base is itself virtual, add it to the list */
1994 if (BASETYPE_VIA_VIRTUAL (dclass
, i
))
1996 struct type
*basetype
= TYPE_FIELD_TYPE (dclass
, i
);
1998 /* Check if base already recorded */
1999 tmp_vbase
= current_vbase_list
;
2002 if (tmp_vbase
->vbasetype
== basetype
)
2003 break; /* found it */
2004 tmp_vbase
= tmp_vbase
->next
;
2007 if (!tmp_vbase
) /* normal exit from loop */
2009 /* Allocate new item for this virtual base */
2010 tmp_vbase
= (struct vbase
*) xmalloc (sizeof (struct vbase
));
2012 /* Stick it on at the end of the list */
2013 tmp_vbase
->vbasetype
= basetype
;
2014 tmp_vbase
->next
= current_vbase_list
;
2015 current_vbase_list
= tmp_vbase
;
2018 } /* for loop over bases */
2022 /* Compute the list of virtual bases in the right order. Virtual
2023 bases are laid out in the object's memory area in order of their
2024 occurrence in a depth-first, left-to-right search through the
2027 Argument DCLASS is the type whose virtual bases are required.
2028 Return value is the address of a null-terminated array of pointers
2029 to struct type items.
2031 This routine is aimed at the HP/Taligent ANSI C++ runtime model,
2032 and may not work with other runtime models.
2034 This routine merely hands off the argument to virtual_base_list_aux()
2035 and then copies the result into an array to save space. */
2038 virtual_base_list (struct type
*dclass
)
2040 register struct vbase
*tmp_vbase
;
2041 register struct vbase
*tmp_vbase_2
;
2044 struct type
**vbase_array
;
2046 current_vbase_list
= NULL
;
2047 virtual_base_list_aux (dclass
);
2049 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; i
++, tmp_vbase
= tmp_vbase
->next
)
2054 vbase_array
= (struct type
**) xmalloc ((count
+ 1) * sizeof (struct type
*));
2056 for (i
= count
- 1, tmp_vbase
= current_vbase_list
; i
>= 0; i
--, tmp_vbase
= tmp_vbase
->next
)
2057 vbase_array
[i
] = tmp_vbase
->vbasetype
;
2059 /* Get rid of constructed chain */
2060 tmp_vbase_2
= tmp_vbase
= current_vbase_list
;
2063 tmp_vbase
= tmp_vbase
->next
;
2064 xfree (tmp_vbase_2
);
2065 tmp_vbase_2
= tmp_vbase
;
2068 vbase_array
[count
] = NULL
;
2072 /* Return the length of the virtual base list of the type DCLASS. */
2075 virtual_base_list_length (struct type
*dclass
)
2078 register struct vbase
*tmp_vbase
;
2080 current_vbase_list
= NULL
;
2081 virtual_base_list_aux (dclass
);
2083 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; i
++, tmp_vbase
= tmp_vbase
->next
)
2088 /* Return the number of elements of the virtual base list of the type
2089 DCLASS, ignoring those appearing in the primary base (and its
2090 primary base, recursively). */
2093 virtual_base_list_length_skip_primaries (struct type
*dclass
)
2096 register struct vbase
*tmp_vbase
;
2097 struct type
*primary
;
2099 primary
= TYPE_RUNTIME_PTR (dclass
) ? TYPE_PRIMARY_BASE (dclass
) : NULL
;
2102 return virtual_base_list_length (dclass
);
2104 current_vbase_list
= NULL
;
2105 virtual_base_list_aux (dclass
);
2107 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; tmp_vbase
= tmp_vbase
->next
)
2109 if (virtual_base_index (tmp_vbase
->vbasetype
, primary
) >= 0)
2117 /* Return the index (position) of type BASE, which is a virtual base
2118 class of DCLASS, in the latter's virtual base list. A return of -1
2119 indicates "not found" or a problem. */
2122 virtual_base_index (struct type
*base
, struct type
*dclass
)
2124 register struct type
*vbase
;
2127 if ((TYPE_CODE (dclass
) != TYPE_CODE_CLASS
) ||
2128 (TYPE_CODE (base
) != TYPE_CODE_CLASS
))
2132 vbase
= virtual_base_list (dclass
)[0];
2137 vbase
= virtual_base_list (dclass
)[++i
];
2140 return vbase
? i
: -1;
2145 /* Return the index (position) of type BASE, which is a virtual base
2146 class of DCLASS, in the latter's virtual base list. Skip over all
2147 bases that may appear in the virtual base list of the primary base
2148 class of DCLASS (recursively). A return of -1 indicates "not
2149 found" or a problem. */
2152 virtual_base_index_skip_primaries (struct type
*base
, struct type
*dclass
)
2154 register struct type
*vbase
;
2156 struct type
*primary
;
2158 if ((TYPE_CODE (dclass
) != TYPE_CODE_CLASS
) ||
2159 (TYPE_CODE (base
) != TYPE_CODE_CLASS
))
2162 primary
= TYPE_RUNTIME_PTR (dclass
) ? TYPE_PRIMARY_BASE (dclass
) : NULL
;
2166 vbase
= virtual_base_list (dclass
)[0];
2169 if (!primary
|| (virtual_base_index_skip_primaries (vbase
, primary
) < 0))
2173 vbase
= virtual_base_list (dclass
)[++i
];
2176 return vbase
? j
: -1;
2179 /* Return position of a derived class DCLASS in the list of
2180 * primary bases starting with the remotest ancestor.
2181 * Position returned is 0-based. */
2184 class_index_in_primary_list (struct type
*dclass
)
2186 struct type
*pbc
; /* primary base class */
2188 /* Simply recurse on primary base */
2189 pbc
= TYPE_PRIMARY_BASE (dclass
);
2191 return 1 + class_index_in_primary_list (pbc
);
2196 /* Return a count of the number of virtual functions a type has.
2197 * This includes all the virtual functions it inherits from its
2201 /* pai: FIXME This doesn't do the right thing: count redefined virtual
2202 * functions only once (latest redefinition)
2206 count_virtual_fns (struct type
*dclass
)
2208 int fn
, oi
; /* function and overloaded instance indices */
2209 int vfuncs
; /* count to return */
2211 /* recurse on bases that can share virtual table */
2212 struct type
*pbc
= primary_base_class (dclass
);
2214 vfuncs
= count_virtual_fns (pbc
);
2218 for (fn
= 0; fn
< TYPE_NFN_FIELDS (dclass
); fn
++)
2219 for (oi
= 0; oi
< TYPE_FN_FIELDLIST_LENGTH (dclass
, fn
); oi
++)
2220 if (TYPE_FN_FIELD_VIRTUAL_P (TYPE_FN_FIELDLIST1 (dclass
, fn
), oi
))
2228 /* Functions for overload resolution begin here */
2230 /* Compare two badness vectors A and B and return the result.
2231 * 0 => A and B are identical
2232 * 1 => A and B are incomparable
2233 * 2 => A is better than B
2234 * 3 => A is worse than B */
2237 compare_badness (struct badness_vector
*a
, struct badness_vector
*b
)
2241 short found_pos
= 0; /* any positives in c? */
2242 short found_neg
= 0; /* any negatives in c? */
2244 /* differing lengths => incomparable */
2245 if (a
->length
!= b
->length
)
2248 /* Subtract b from a */
2249 for (i
= 0; i
< a
->length
; i
++)
2251 tmp
= a
->rank
[i
] - b
->rank
[i
];
2261 return 1; /* incomparable */
2263 return 3; /* A > B */
2269 return 2; /* A < B */
2271 return 0; /* A == B */
2275 /* Rank a function by comparing its parameter types (PARMS, length NPARMS),
2276 * to the types of an argument list (ARGS, length NARGS).
2277 * Return a pointer to a badness vector. This has NARGS + 1 entries. */
2279 struct badness_vector
*
2280 rank_function (struct type
**parms
, int nparms
, struct type
**args
, int nargs
)
2283 struct badness_vector
*bv
;
2284 int min_len
= nparms
< nargs
? nparms
: nargs
;
2286 bv
= xmalloc (sizeof (struct badness_vector
));
2287 bv
->length
= nargs
+ 1; /* add 1 for the length-match rank */
2288 bv
->rank
= xmalloc ((nargs
+ 1) * sizeof (int));
2290 /* First compare the lengths of the supplied lists.
2291 * If there is a mismatch, set it to a high value. */
2293 /* pai/1997-06-03 FIXME: when we have debug info about default
2294 * arguments and ellipsis parameter lists, we should consider those
2295 * and rank the length-match more finely. */
2297 LENGTH_MATCH (bv
) = (nargs
!= nparms
) ? LENGTH_MISMATCH_BADNESS
: 0;
2299 /* Now rank all the parameters of the candidate function */
2300 for (i
= 1; i
<= min_len
; i
++)
2301 bv
->rank
[i
] = rank_one_type (parms
[i
-1], args
[i
-1]);
2303 /* If more arguments than parameters, add dummy entries */
2304 for (i
= min_len
+ 1; i
<= nargs
; i
++)
2305 bv
->rank
[i
] = TOO_FEW_PARAMS_BADNESS
;
2310 /* Compare one type (PARM) for compatibility with another (ARG).
2311 * PARM is intended to be the parameter type of a function; and
2312 * ARG is the supplied argument's type. This function tests if
2313 * the latter can be converted to the former.
2315 * Return 0 if they are identical types;
2316 * Otherwise, return an integer which corresponds to how compatible
2317 * PARM is to ARG. The higher the return value, the worse the match.
2318 * Generally the "bad" conversions are all uniformly assigned a 100 */
2321 rank_one_type (struct type
*parm
, struct type
*arg
)
2323 /* Identical type pointers */
2324 /* However, this still doesn't catch all cases of same type for arg
2325 * and param. The reason is that builtin types are different from
2326 * the same ones constructed from the object. */
2330 /* Resolve typedefs */
2331 if (TYPE_CODE (parm
) == TYPE_CODE_TYPEDEF
)
2332 parm
= check_typedef (parm
);
2333 if (TYPE_CODE (arg
) == TYPE_CODE_TYPEDEF
)
2334 arg
= check_typedef (arg
);
2337 Well, damnit, if the names are exactly the same,
2338 i'll say they are exactly the same. This happens when we generate
2339 method stubs. The types won't point to the same address, but they
2340 really are the same.
2343 if (TYPE_NAME (parm
) && TYPE_NAME (arg
) &&
2344 !strcmp (TYPE_NAME (parm
), TYPE_NAME (arg
)))
2347 /* Check if identical after resolving typedefs */
2351 /* See through references, since we can almost make non-references
2353 if (TYPE_CODE (arg
) == TYPE_CODE_REF
)
2354 return (rank_one_type (parm
, TYPE_TARGET_TYPE (arg
))
2355 + REFERENCE_CONVERSION_BADNESS
);
2356 if (TYPE_CODE (parm
) == TYPE_CODE_REF
)
2357 return (rank_one_type (TYPE_TARGET_TYPE (parm
), arg
)
2358 + REFERENCE_CONVERSION_BADNESS
);
2360 /* Debugging only. */
2361 fprintf_filtered (gdb_stderr
,"------ Arg is %s [%d], parm is %s [%d]\n",
2362 TYPE_NAME (arg
), TYPE_CODE (arg
), TYPE_NAME (parm
), TYPE_CODE (parm
));
2364 /* x -> y means arg of type x being supplied for parameter of type y */
2366 switch (TYPE_CODE (parm
))
2369 switch (TYPE_CODE (arg
))
2372 if (TYPE_CODE (TYPE_TARGET_TYPE (parm
)) == TYPE_CODE_VOID
)
2373 return VOID_PTR_CONVERSION_BADNESS
;
2375 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2376 case TYPE_CODE_ARRAY
:
2377 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2378 case TYPE_CODE_FUNC
:
2379 return rank_one_type (TYPE_TARGET_TYPE (parm
), arg
);
2381 case TYPE_CODE_ENUM
:
2382 case TYPE_CODE_CHAR
:
2383 case TYPE_CODE_RANGE
:
2384 case TYPE_CODE_BOOL
:
2385 return POINTER_CONVERSION_BADNESS
;
2387 return INCOMPATIBLE_TYPE_BADNESS
;
2389 case TYPE_CODE_ARRAY
:
2390 switch (TYPE_CODE (arg
))
2393 case TYPE_CODE_ARRAY
:
2394 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2396 return INCOMPATIBLE_TYPE_BADNESS
;
2398 case TYPE_CODE_FUNC
:
2399 switch (TYPE_CODE (arg
))
2401 case TYPE_CODE_PTR
: /* funcptr -> func */
2402 return rank_one_type (parm
, TYPE_TARGET_TYPE (arg
));
2404 return INCOMPATIBLE_TYPE_BADNESS
;
2407 switch (TYPE_CODE (arg
))
2410 if (TYPE_LENGTH (arg
) == TYPE_LENGTH (parm
))
2412 /* Deal with signed, unsigned, and plain chars and
2413 signed and unsigned ints */
2414 if (TYPE_NOSIGN (parm
))
2416 /* This case only for character types */
2417 if (TYPE_NOSIGN (arg
)) /* plain char -> plain char */
2420 return INTEGER_COERCION_BADNESS
; /* signed/unsigned char -> plain char */
2422 else if (TYPE_UNSIGNED (parm
))
2424 if (TYPE_UNSIGNED (arg
))
2426 if (!strcmp_iw (TYPE_NAME (parm
), TYPE_NAME (arg
)))
2427 return 0; /* unsigned int -> unsigned int, or unsigned long -> unsigned long */
2428 else if (!strcmp_iw (TYPE_NAME (arg
), "int") && !strcmp_iw (TYPE_NAME (parm
), "long"))
2429 return INTEGER_PROMOTION_BADNESS
; /* unsigned int -> unsigned long */
2431 return INTEGER_COERCION_BADNESS
; /* unsigned long -> unsigned int */
2435 if (!strcmp_iw (TYPE_NAME (arg
), "long") && !strcmp_iw (TYPE_NAME (parm
), "int"))
2436 return INTEGER_COERCION_BADNESS
; /* signed long -> unsigned int */
2438 return INTEGER_CONVERSION_BADNESS
; /* signed int/long -> unsigned int/long */
2441 else if (!TYPE_NOSIGN (arg
) && !TYPE_UNSIGNED (arg
))
2443 if (!strcmp_iw (TYPE_NAME (parm
), TYPE_NAME (arg
)))
2445 else if (!strcmp_iw (TYPE_NAME (arg
), "int") && !strcmp_iw (TYPE_NAME (parm
), "long"))
2446 return INTEGER_PROMOTION_BADNESS
;
2448 return INTEGER_COERCION_BADNESS
;
2451 return INTEGER_COERCION_BADNESS
;
2453 else if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2454 return INTEGER_PROMOTION_BADNESS
;
2456 return INTEGER_COERCION_BADNESS
;
2457 case TYPE_CODE_ENUM
:
2458 case TYPE_CODE_CHAR
:
2459 case TYPE_CODE_RANGE
:
2460 case TYPE_CODE_BOOL
:
2461 return INTEGER_PROMOTION_BADNESS
;
2463 return INT_FLOAT_CONVERSION_BADNESS
;
2465 return NS_POINTER_CONVERSION_BADNESS
;
2467 return INCOMPATIBLE_TYPE_BADNESS
;
2470 case TYPE_CODE_ENUM
:
2471 switch (TYPE_CODE (arg
))
2474 case TYPE_CODE_CHAR
:
2475 case TYPE_CODE_RANGE
:
2476 case TYPE_CODE_BOOL
:
2477 case TYPE_CODE_ENUM
:
2478 return INTEGER_COERCION_BADNESS
;
2480 return INT_FLOAT_CONVERSION_BADNESS
;
2482 return INCOMPATIBLE_TYPE_BADNESS
;
2485 case TYPE_CODE_CHAR
:
2486 switch (TYPE_CODE (arg
))
2488 case TYPE_CODE_RANGE
:
2489 case TYPE_CODE_BOOL
:
2490 case TYPE_CODE_ENUM
:
2491 return INTEGER_COERCION_BADNESS
;
2493 return INT_FLOAT_CONVERSION_BADNESS
;
2495 if (TYPE_LENGTH (arg
) > TYPE_LENGTH (parm
))
2496 return INTEGER_COERCION_BADNESS
;
2497 else if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2498 return INTEGER_PROMOTION_BADNESS
;
2499 /* >>> !! else fall through !! <<< */
2500 case TYPE_CODE_CHAR
:
2501 /* Deal with signed, unsigned, and plain chars for C++
2502 and with int cases falling through from previous case */
2503 if (TYPE_NOSIGN (parm
))
2505 if (TYPE_NOSIGN (arg
))
2508 return INTEGER_COERCION_BADNESS
;
2510 else if (TYPE_UNSIGNED (parm
))
2512 if (TYPE_UNSIGNED (arg
))
2515 return INTEGER_PROMOTION_BADNESS
;
2517 else if (!TYPE_NOSIGN (arg
) && !TYPE_UNSIGNED (arg
))
2520 return INTEGER_COERCION_BADNESS
;
2522 return INCOMPATIBLE_TYPE_BADNESS
;
2525 case TYPE_CODE_RANGE
:
2526 switch (TYPE_CODE (arg
))
2529 case TYPE_CODE_CHAR
:
2530 case TYPE_CODE_RANGE
:
2531 case TYPE_CODE_BOOL
:
2532 case TYPE_CODE_ENUM
:
2533 return INTEGER_COERCION_BADNESS
;
2535 return INT_FLOAT_CONVERSION_BADNESS
;
2537 return INCOMPATIBLE_TYPE_BADNESS
;
2540 case TYPE_CODE_BOOL
:
2541 switch (TYPE_CODE (arg
))
2544 case TYPE_CODE_CHAR
:
2545 case TYPE_CODE_RANGE
:
2546 case TYPE_CODE_ENUM
:
2549 return BOOLEAN_CONVERSION_BADNESS
;
2550 case TYPE_CODE_BOOL
:
2553 return INCOMPATIBLE_TYPE_BADNESS
;
2557 switch (TYPE_CODE (arg
))
2560 if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2561 return FLOAT_PROMOTION_BADNESS
;
2562 else if (TYPE_LENGTH (arg
) == TYPE_LENGTH (parm
))
2565 return FLOAT_CONVERSION_BADNESS
;
2567 case TYPE_CODE_BOOL
:
2568 case TYPE_CODE_ENUM
:
2569 case TYPE_CODE_RANGE
:
2570 case TYPE_CODE_CHAR
:
2571 return INT_FLOAT_CONVERSION_BADNESS
;
2573 return INCOMPATIBLE_TYPE_BADNESS
;
2576 case TYPE_CODE_COMPLEX
:
2577 switch (TYPE_CODE (arg
))
2578 { /* Strictly not needed for C++, but... */
2580 return FLOAT_PROMOTION_BADNESS
;
2581 case TYPE_CODE_COMPLEX
:
2584 return INCOMPATIBLE_TYPE_BADNESS
;
2587 case TYPE_CODE_STRUCT
:
2588 /* currently same as TYPE_CODE_CLASS */
2589 switch (TYPE_CODE (arg
))
2591 case TYPE_CODE_STRUCT
:
2592 /* Check for derivation */
2593 if (is_ancestor (parm
, arg
))
2594 return BASE_CONVERSION_BADNESS
;
2595 /* else fall through */
2597 return INCOMPATIBLE_TYPE_BADNESS
;
2600 case TYPE_CODE_UNION
:
2601 switch (TYPE_CODE (arg
))
2603 case TYPE_CODE_UNION
:
2605 return INCOMPATIBLE_TYPE_BADNESS
;
2608 case TYPE_CODE_MEMBER
:
2609 switch (TYPE_CODE (arg
))
2612 return INCOMPATIBLE_TYPE_BADNESS
;
2615 case TYPE_CODE_METHOD
:
2616 switch (TYPE_CODE (arg
))
2620 return INCOMPATIBLE_TYPE_BADNESS
;
2624 switch (TYPE_CODE (arg
))
2628 return INCOMPATIBLE_TYPE_BADNESS
;
2633 switch (TYPE_CODE (arg
))
2637 return rank_one_type (TYPE_FIELD_TYPE (parm
, 0), TYPE_FIELD_TYPE (arg
, 0));
2639 return INCOMPATIBLE_TYPE_BADNESS
;
2642 case TYPE_CODE_VOID
:
2644 return INCOMPATIBLE_TYPE_BADNESS
;
2645 } /* switch (TYPE_CODE (arg)) */
2649 /* End of functions for overload resolution */
2652 print_bit_vector (B_TYPE
*bits
, int nbits
)
2656 for (bitno
= 0; bitno
< nbits
; bitno
++)
2658 if ((bitno
% 8) == 0)
2660 puts_filtered (" ");
2662 if (B_TST (bits
, bitno
))
2664 printf_filtered ("1");
2668 printf_filtered ("0");
2673 /* The args list is a strange beast. It is either terminated by a NULL
2674 pointer for varargs functions, or by a pointer to a TYPE_CODE_VOID
2675 type for normal fixed argcount functions. (FIXME someday)
2676 Also note the first arg should be the "this" pointer, we may not want to
2677 include it since we may get into a infinitely recursive situation. */
2680 print_arg_types (struct type
**args
, int spaces
)
2684 while (*args
!= NULL
)
2686 recursive_dump_type (*args
, spaces
+ 2);
2687 if ((*args
++)->code
== TYPE_CODE_VOID
)
2696 dump_fn_fieldlists (struct type
*type
, int spaces
)
2702 printfi_filtered (spaces
, "fn_fieldlists ");
2703 gdb_print_host_address (TYPE_FN_FIELDLISTS (type
), gdb_stdout
);
2704 printf_filtered ("\n");
2705 for (method_idx
= 0; method_idx
< TYPE_NFN_FIELDS (type
); method_idx
++)
2707 f
= TYPE_FN_FIELDLIST1 (type
, method_idx
);
2708 printfi_filtered (spaces
+ 2, "[%d] name '%s' (",
2710 TYPE_FN_FIELDLIST_NAME (type
, method_idx
));
2711 gdb_print_host_address (TYPE_FN_FIELDLIST_NAME (type
, method_idx
),
2713 printf_filtered (") length %d\n",
2714 TYPE_FN_FIELDLIST_LENGTH (type
, method_idx
));
2715 for (overload_idx
= 0;
2716 overload_idx
< TYPE_FN_FIELDLIST_LENGTH (type
, method_idx
);
2719 printfi_filtered (spaces
+ 4, "[%d] physname '%s' (",
2721 TYPE_FN_FIELD_PHYSNAME (f
, overload_idx
));
2722 gdb_print_host_address (TYPE_FN_FIELD_PHYSNAME (f
, overload_idx
),
2724 printf_filtered (")\n");
2725 printfi_filtered (spaces
+ 8, "type ");
2726 gdb_print_host_address (TYPE_FN_FIELD_TYPE (f
, overload_idx
), gdb_stdout
);
2727 printf_filtered ("\n");
2729 recursive_dump_type (TYPE_FN_FIELD_TYPE (f
, overload_idx
),
2732 printfi_filtered (spaces
+ 8, "args ");
2733 gdb_print_host_address (TYPE_FN_FIELD_ARGS (f
, overload_idx
), gdb_stdout
);
2734 printf_filtered ("\n");
2736 print_arg_types (TYPE_FN_FIELD_ARGS (f
, overload_idx
), spaces
);
2737 printfi_filtered (spaces
+ 8, "fcontext ");
2738 gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f
, overload_idx
),
2740 printf_filtered ("\n");
2742 printfi_filtered (spaces
+ 8, "is_const %d\n",
2743 TYPE_FN_FIELD_CONST (f
, overload_idx
));
2744 printfi_filtered (spaces
+ 8, "is_volatile %d\n",
2745 TYPE_FN_FIELD_VOLATILE (f
, overload_idx
));
2746 printfi_filtered (spaces
+ 8, "is_private %d\n",
2747 TYPE_FN_FIELD_PRIVATE (f
, overload_idx
));
2748 printfi_filtered (spaces
+ 8, "is_protected %d\n",
2749 TYPE_FN_FIELD_PROTECTED (f
, overload_idx
));
2750 printfi_filtered (spaces
+ 8, "is_stub %d\n",
2751 TYPE_FN_FIELD_STUB (f
, overload_idx
));
2752 printfi_filtered (spaces
+ 8, "voffset %u\n",
2753 TYPE_FN_FIELD_VOFFSET (f
, overload_idx
));
2759 print_cplus_stuff (struct type
*type
, int spaces
)
2761 printfi_filtered (spaces
, "n_baseclasses %d\n",
2762 TYPE_N_BASECLASSES (type
));
2763 printfi_filtered (spaces
, "nfn_fields %d\n",
2764 TYPE_NFN_FIELDS (type
));
2765 printfi_filtered (spaces
, "nfn_fields_total %d\n",
2766 TYPE_NFN_FIELDS_TOTAL (type
));
2767 if (TYPE_N_BASECLASSES (type
) > 0)
2769 printfi_filtered (spaces
, "virtual_field_bits (%d bits at *",
2770 TYPE_N_BASECLASSES (type
));
2771 gdb_print_host_address (TYPE_FIELD_VIRTUAL_BITS (type
), gdb_stdout
);
2772 printf_filtered (")");
2774 print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type
),
2775 TYPE_N_BASECLASSES (type
));
2776 puts_filtered ("\n");
2778 if (TYPE_NFIELDS (type
) > 0)
2780 if (TYPE_FIELD_PRIVATE_BITS (type
) != NULL
)
2782 printfi_filtered (spaces
, "private_field_bits (%d bits at *",
2783 TYPE_NFIELDS (type
));
2784 gdb_print_host_address (TYPE_FIELD_PRIVATE_BITS (type
), gdb_stdout
);
2785 printf_filtered (")");
2786 print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type
),
2787 TYPE_NFIELDS (type
));
2788 puts_filtered ("\n");
2790 if (TYPE_FIELD_PROTECTED_BITS (type
) != NULL
)
2792 printfi_filtered (spaces
, "protected_field_bits (%d bits at *",
2793 TYPE_NFIELDS (type
));
2794 gdb_print_host_address (TYPE_FIELD_PROTECTED_BITS (type
), gdb_stdout
);
2795 printf_filtered (")");
2796 print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type
),
2797 TYPE_NFIELDS (type
));
2798 puts_filtered ("\n");
2801 if (TYPE_NFN_FIELDS (type
) > 0)
2803 dump_fn_fieldlists (type
, spaces
);
2808 print_bound_type (int bt
)
2812 case BOUND_CANNOT_BE_DETERMINED
:
2813 printf_filtered ("(BOUND_CANNOT_BE_DETERMINED)");
2815 case BOUND_BY_REF_ON_STACK
:
2816 printf_filtered ("(BOUND_BY_REF_ON_STACK)");
2818 case BOUND_BY_VALUE_ON_STACK
:
2819 printf_filtered ("(BOUND_BY_VALUE_ON_STACK)");
2821 case BOUND_BY_REF_IN_REG
:
2822 printf_filtered ("(BOUND_BY_REF_IN_REG)");
2824 case BOUND_BY_VALUE_IN_REG
:
2825 printf_filtered ("(BOUND_BY_VALUE_IN_REG)");
2828 printf_filtered ("(BOUND_SIMPLE)");
2831 printf_filtered ("(unknown bound type)");
2836 static struct obstack dont_print_type_obstack
;
2839 recursive_dump_type (struct type
*type
, int spaces
)
2844 obstack_begin (&dont_print_type_obstack
, 0);
2846 if (TYPE_NFIELDS (type
) > 0
2847 || (TYPE_CPLUS_SPECIFIC (type
) && TYPE_NFN_FIELDS (type
) > 0))
2849 struct type
**first_dont_print
2850 = (struct type
**) obstack_base (&dont_print_type_obstack
);
2852 int i
= (struct type
**) obstack_next_free (&dont_print_type_obstack
)
2857 if (type
== first_dont_print
[i
])
2859 printfi_filtered (spaces
, "type node ");
2860 gdb_print_host_address (type
, gdb_stdout
);
2861 printf_filtered (" <same as already seen type>\n");
2866 obstack_ptr_grow (&dont_print_type_obstack
, type
);
2869 printfi_filtered (spaces
, "type node ");
2870 gdb_print_host_address (type
, gdb_stdout
);
2871 printf_filtered ("\n");
2872 printfi_filtered (spaces
, "name '%s' (",
2873 TYPE_NAME (type
) ? TYPE_NAME (type
) : "<NULL>");
2874 gdb_print_host_address (TYPE_NAME (type
), gdb_stdout
);
2875 printf_filtered (")\n");
2876 printfi_filtered (spaces
, "tagname '%s' (",
2877 TYPE_TAG_NAME (type
) ? TYPE_TAG_NAME (type
) : "<NULL>");
2878 gdb_print_host_address (TYPE_TAG_NAME (type
), gdb_stdout
);
2879 printf_filtered (")\n");
2880 printfi_filtered (spaces
, "code 0x%x ", TYPE_CODE (type
));
2881 switch (TYPE_CODE (type
))
2883 case TYPE_CODE_UNDEF
:
2884 printf_filtered ("(TYPE_CODE_UNDEF)");
2887 printf_filtered ("(TYPE_CODE_PTR)");
2889 case TYPE_CODE_ARRAY
:
2890 printf_filtered ("(TYPE_CODE_ARRAY)");
2892 case TYPE_CODE_STRUCT
:
2893 printf_filtered ("(TYPE_CODE_STRUCT)");
2895 case TYPE_CODE_UNION
:
2896 printf_filtered ("(TYPE_CODE_UNION)");
2898 case TYPE_CODE_ENUM
:
2899 printf_filtered ("(TYPE_CODE_ENUM)");
2901 case TYPE_CODE_FUNC
:
2902 printf_filtered ("(TYPE_CODE_FUNC)");
2905 printf_filtered ("(TYPE_CODE_INT)");
2908 printf_filtered ("(TYPE_CODE_FLT)");
2910 case TYPE_CODE_VOID
:
2911 printf_filtered ("(TYPE_CODE_VOID)");
2914 printf_filtered ("(TYPE_CODE_SET)");
2916 case TYPE_CODE_RANGE
:
2917 printf_filtered ("(TYPE_CODE_RANGE)");
2919 case TYPE_CODE_STRING
:
2920 printf_filtered ("(TYPE_CODE_STRING)");
2922 case TYPE_CODE_BITSTRING
:
2923 printf_filtered ("(TYPE_CODE_BITSTRING)");
2925 case TYPE_CODE_ERROR
:
2926 printf_filtered ("(TYPE_CODE_ERROR)");
2928 case TYPE_CODE_MEMBER
:
2929 printf_filtered ("(TYPE_CODE_MEMBER)");
2931 case TYPE_CODE_METHOD
:
2932 printf_filtered ("(TYPE_CODE_METHOD)");
2935 printf_filtered ("(TYPE_CODE_REF)");
2937 case TYPE_CODE_CHAR
:
2938 printf_filtered ("(TYPE_CODE_CHAR)");
2940 case TYPE_CODE_BOOL
:
2941 printf_filtered ("(TYPE_CODE_BOOL)");
2943 case TYPE_CODE_COMPLEX
:
2944 printf_filtered ("(TYPE_CODE_COMPLEX)");
2946 case TYPE_CODE_TYPEDEF
:
2947 printf_filtered ("(TYPE_CODE_TYPEDEF)");
2949 case TYPE_CODE_TEMPLATE
:
2950 printf_filtered ("(TYPE_CODE_TEMPLATE)");
2952 case TYPE_CODE_TEMPLATE_ARG
:
2953 printf_filtered ("(TYPE_CODE_TEMPLATE_ARG)");
2956 printf_filtered ("(UNKNOWN TYPE CODE)");
2959 puts_filtered ("\n");
2960 printfi_filtered (spaces
, "length %d\n", TYPE_LENGTH (type
));
2961 printfi_filtered (spaces
, "upper_bound_type 0x%x ",
2962 TYPE_ARRAY_UPPER_BOUND_TYPE (type
));
2963 print_bound_type (TYPE_ARRAY_UPPER_BOUND_TYPE (type
));
2964 puts_filtered ("\n");
2965 printfi_filtered (spaces
, "lower_bound_type 0x%x ",
2966 TYPE_ARRAY_LOWER_BOUND_TYPE (type
));
2967 print_bound_type (TYPE_ARRAY_LOWER_BOUND_TYPE (type
));
2968 puts_filtered ("\n");
2969 printfi_filtered (spaces
, "objfile ");
2970 gdb_print_host_address (TYPE_OBJFILE (type
), gdb_stdout
);
2971 printf_filtered ("\n");
2972 printfi_filtered (spaces
, "target_type ");
2973 gdb_print_host_address (TYPE_TARGET_TYPE (type
), gdb_stdout
);
2974 printf_filtered ("\n");
2975 if (TYPE_TARGET_TYPE (type
) != NULL
)
2977 recursive_dump_type (TYPE_TARGET_TYPE (type
), spaces
+ 2);
2979 printfi_filtered (spaces
, "pointer_type ");
2980 gdb_print_host_address (TYPE_POINTER_TYPE (type
), gdb_stdout
);
2981 printf_filtered ("\n");
2982 printfi_filtered (spaces
, "reference_type ");
2983 gdb_print_host_address (TYPE_REFERENCE_TYPE (type
), gdb_stdout
);
2984 printf_filtered ("\n");
2985 printfi_filtered (spaces
, "cv_type ");
2986 gdb_print_host_address (TYPE_CV_TYPE (type
), gdb_stdout
);
2987 printf_filtered ("\n");
2988 printfi_filtered (spaces
, "as_type ");
2989 gdb_print_host_address (TYPE_AS_TYPE (type
), gdb_stdout
);
2990 printf_filtered ("\n");
2991 printfi_filtered (spaces
, "flags 0x%x", TYPE_FLAGS (type
));
2992 if (TYPE_UNSIGNED (type
))
2994 puts_filtered (" TYPE_FLAG_UNSIGNED");
2996 if (TYPE_NOSIGN (type
))
2998 puts_filtered (" TYPE_FLAG_NOSIGN");
3000 if (TYPE_STUB (type
))
3002 puts_filtered (" TYPE_FLAG_STUB");
3004 if (TYPE_TARGET_STUB (type
))
3006 puts_filtered (" TYPE_FLAG_TARGET_STUB");
3008 if (TYPE_STATIC (type
))
3010 puts_filtered (" TYPE_FLAG_STATIC");
3012 if (TYPE_CONST (type
))
3014 puts_filtered (" TYPE_FLAG_CONST");
3016 if (TYPE_VOLATILE (type
))
3018 puts_filtered (" TYPE_FLAG_VOLATILE");
3020 if (TYPE_PROTOTYPED (type
))
3022 puts_filtered (" TYPE_FLAG_PROTOTYPED");
3024 if (TYPE_INCOMPLETE (type
))
3026 puts_filtered (" TYPE_FLAG_INCOMPLETE");
3028 if (TYPE_CODE_SPACE (type
))
3030 puts_filtered (" TYPE_FLAG_CODE_SPACE");
3032 if (TYPE_DATA_SPACE (type
))
3034 puts_filtered (" TYPE_FLAG_DATA_SPACE");
3036 if (TYPE_VARARGS (type
))
3038 puts_filtered (" TYPE_FLAG_VARARGS");
3040 /* This is used for things like AltiVec registers on ppc. Gcc emits
3041 an attribute for the array type, which tells whether or not we
3042 have a vector, instead of a regular array. */
3043 if (TYPE_VECTOR (type
))
3045 puts_filtered (" TYPE_FLAG_VECTOR");
3047 puts_filtered ("\n");
3048 printfi_filtered (spaces
, "nfields %d ", TYPE_NFIELDS (type
));
3049 gdb_print_host_address (TYPE_FIELDS (type
), gdb_stdout
);
3050 puts_filtered ("\n");
3051 for (idx
= 0; idx
< TYPE_NFIELDS (type
); idx
++)
3053 printfi_filtered (spaces
+ 2,
3054 "[%d] bitpos %d bitsize %d type ",
3055 idx
, TYPE_FIELD_BITPOS (type
, idx
),
3056 TYPE_FIELD_BITSIZE (type
, idx
));
3057 gdb_print_host_address (TYPE_FIELD_TYPE (type
, idx
), gdb_stdout
);
3058 printf_filtered (" name '%s' (",
3059 TYPE_FIELD_NAME (type
, idx
) != NULL
3060 ? TYPE_FIELD_NAME (type
, idx
)
3062 gdb_print_host_address (TYPE_FIELD_NAME (type
, idx
), gdb_stdout
);
3063 printf_filtered (")\n");
3064 if (TYPE_FIELD_TYPE (type
, idx
) != NULL
)
3066 recursive_dump_type (TYPE_FIELD_TYPE (type
, idx
), spaces
+ 4);
3069 printfi_filtered (spaces
, "vptr_basetype ");
3070 gdb_print_host_address (TYPE_VPTR_BASETYPE (type
), gdb_stdout
);
3071 puts_filtered ("\n");
3072 if (TYPE_VPTR_BASETYPE (type
) != NULL
)
3074 recursive_dump_type (TYPE_VPTR_BASETYPE (type
), spaces
+ 2);
3076 printfi_filtered (spaces
, "vptr_fieldno %d\n", TYPE_VPTR_FIELDNO (type
));
3077 switch (TYPE_CODE (type
))
3079 case TYPE_CODE_METHOD
:
3080 case TYPE_CODE_FUNC
:
3081 printfi_filtered (spaces
, "arg_types ");
3082 gdb_print_host_address (TYPE_ARG_TYPES (type
), gdb_stdout
);
3083 puts_filtered ("\n");
3084 print_arg_types (TYPE_ARG_TYPES (type
), spaces
);
3087 case TYPE_CODE_STRUCT
:
3088 printfi_filtered (spaces
, "cplus_stuff ");
3089 gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type
), gdb_stdout
);
3090 puts_filtered ("\n");
3091 print_cplus_stuff (type
, spaces
);
3095 printfi_filtered (spaces
, "floatformat ");
3096 if (TYPE_FLOATFORMAT (type
) == NULL
3097 || TYPE_FLOATFORMAT (type
)->name
== NULL
)
3098 puts_filtered ("(null)");
3100 puts_filtered (TYPE_FLOATFORMAT (type
)->name
);
3101 puts_filtered ("\n");
3105 /* We have to pick one of the union types to be able print and test
3106 the value. Pick cplus_struct_type, even though we know it isn't
3107 any particular one. */
3108 printfi_filtered (spaces
, "type_specific ");
3109 gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type
), gdb_stdout
);
3110 if (TYPE_CPLUS_SPECIFIC (type
) != NULL
)
3112 printf_filtered (" (unknown data form)");
3114 printf_filtered ("\n");
3119 obstack_free (&dont_print_type_obstack
, NULL
);
3122 static void build_gdbtypes (void);
3124 build_gdbtypes (void)
3127 init_type (TYPE_CODE_VOID
, 1,
3129 "void", (struct objfile
*) NULL
);
3131 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3133 | (TARGET_CHAR_SIGNED
? 0 : TYPE_FLAG_UNSIGNED
)),
3134 "char", (struct objfile
*) NULL
);
3135 builtin_type_true_char
=
3136 init_type (TYPE_CODE_CHAR
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3138 "true character", (struct objfile
*) NULL
);
3139 builtin_type_signed_char
=
3140 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3142 "signed char", (struct objfile
*) NULL
);
3143 builtin_type_unsigned_char
=
3144 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3146 "unsigned char", (struct objfile
*) NULL
);
3147 builtin_type_short
=
3148 init_type (TYPE_CODE_INT
, TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
3150 "short", (struct objfile
*) NULL
);
3151 builtin_type_unsigned_short
=
3152 init_type (TYPE_CODE_INT
, TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
3154 "unsigned short", (struct objfile
*) NULL
);
3156 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
3158 "int", (struct objfile
*) NULL
);
3159 builtin_type_unsigned_int
=
3160 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
3162 "unsigned int", (struct objfile
*) NULL
);
3164 init_type (TYPE_CODE_INT
, TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
3166 "long", (struct objfile
*) NULL
);
3167 builtin_type_unsigned_long
=
3168 init_type (TYPE_CODE_INT
, TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
3170 "unsigned long", (struct objfile
*) NULL
);
3171 builtin_type_long_long
=
3172 init_type (TYPE_CODE_INT
, TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
3174 "long long", (struct objfile
*) NULL
);
3175 builtin_type_unsigned_long_long
=
3176 init_type (TYPE_CODE_INT
, TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
3178 "unsigned long long", (struct objfile
*) NULL
);
3179 builtin_type_float
=
3180 init_type (TYPE_CODE_FLT
, TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
3182 "float", (struct objfile
*) NULL
);
3183 /* vinschen@redhat.com 2002-02-08:
3184 The below lines are disabled since they are doing the wrong
3185 thing for non-multiarch targets. They are setting the correct
3186 type of floats for the target but while on multiarch targets
3187 this is done everytime the architecture changes, it's done on
3188 non-multiarch targets only on startup, leaving the wrong values
3189 in even if the architecture changes (eg. from big-endian to
3192 TYPE_FLOATFORMAT (builtin_type_float
) = TARGET_FLOAT_FORMAT
;
3194 builtin_type_double
=
3195 init_type (TYPE_CODE_FLT
, TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
3197 "double", (struct objfile
*) NULL
);
3199 TYPE_FLOATFORMAT (builtin_type_double
) = TARGET_DOUBLE_FORMAT
;
3201 builtin_type_long_double
=
3202 init_type (TYPE_CODE_FLT
, TARGET_LONG_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
3204 "long double", (struct objfile
*) NULL
);
3206 TYPE_FLOATFORMAT (builtin_type_long_double
) = TARGET_LONG_DOUBLE_FORMAT
;
3208 builtin_type_complex
=
3209 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
3211 "complex", (struct objfile
*) NULL
);
3212 TYPE_TARGET_TYPE (builtin_type_complex
) = builtin_type_float
;
3213 builtin_type_double_complex
=
3214 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
3216 "double complex", (struct objfile
*) NULL
);
3217 TYPE_TARGET_TYPE (builtin_type_double_complex
) = builtin_type_double
;
3218 builtin_type_string
=
3219 init_type (TYPE_CODE_STRING
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3221 "string", (struct objfile
*) NULL
);
3223 init_type (TYPE_CODE_INT
, 8 / 8,
3225 "int8_t", (struct objfile
*) NULL
);
3226 builtin_type_uint8
=
3227 init_type (TYPE_CODE_INT
, 8 / 8,
3229 "uint8_t", (struct objfile
*) NULL
);
3230 builtin_type_int16
=
3231 init_type (TYPE_CODE_INT
, 16 / 8,
3233 "int16_t", (struct objfile
*) NULL
);
3234 builtin_type_uint16
=
3235 init_type (TYPE_CODE_INT
, 16 / 8,
3237 "uint16_t", (struct objfile
*) NULL
);
3238 builtin_type_int32
=
3239 init_type (TYPE_CODE_INT
, 32 / 8,
3241 "int32_t", (struct objfile
*) NULL
);
3242 builtin_type_uint32
=
3243 init_type (TYPE_CODE_INT
, 32 / 8,
3245 "uint32_t", (struct objfile
*) NULL
);
3246 builtin_type_int64
=
3247 init_type (TYPE_CODE_INT
, 64 / 8,
3249 "int64_t", (struct objfile
*) NULL
);
3250 builtin_type_uint64
=
3251 init_type (TYPE_CODE_INT
, 64 / 8,
3253 "uint64_t", (struct objfile
*) NULL
);
3254 builtin_type_int128
=
3255 init_type (TYPE_CODE_INT
, 128 / 8,
3257 "int128_t", (struct objfile
*) NULL
);
3258 builtin_type_uint128
=
3259 init_type (TYPE_CODE_INT
, 128 / 8,
3261 "uint128_t", (struct objfile
*) NULL
);
3263 init_type (TYPE_CODE_BOOL
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3265 "bool", (struct objfile
*) NULL
);
3267 /* Add user knob for controlling resolution of opaque types */
3269 (add_set_cmd ("opaque-type-resolution", class_support
, var_boolean
, (char *) &opaque_type_resolution
,
3270 "Set resolution of opaque struct/class/union types (if set before loading symbols).",
3273 opaque_type_resolution
= 1;
3275 /* Build SIMD types. */
3277 = init_simd_type ("__builtin_v4sf", builtin_type_float
, "f", 4);
3279 = init_simd_type ("__builtin_v4si", builtin_type_int32
, "f", 4);
3281 = init_simd_type ("__builtin_v16qi", builtin_type_int8
, "f", 16);
3283 = init_simd_type ("__builtin_v8qi", builtin_type_int8
, "f", 8);
3285 = init_simd_type ("__builtin_v8hi", builtin_type_int16
, "f", 8);
3287 = init_simd_type ("__builtin_v4hi", builtin_type_int16
, "f", 4);
3289 = init_simd_type ("__builtin_v2si", builtin_type_int32
, "f", 2);
3293 = build_builtin_type_vec128 ();
3295 /* Pointer/Address types. */
3297 /* NOTE: on some targets, addresses and pointers are not necessarily
3298 the same --- for example, on the D10V, pointers are 16 bits long,
3299 but addresses are 32 bits long. See doc/gdbint.texinfo,
3300 ``Pointers Are Not Always Addresses''.
3303 - gdb's `struct type' always describes the target's
3305 - gdb's `struct value' objects should always hold values in
3307 - gdb's CORE_ADDR values are addresses in the unified virtual
3308 address space that the assembler and linker work with. Thus,
3309 since target_read_memory takes a CORE_ADDR as an argument, it
3310 can access any memory on the target, even if the processor has
3311 separate code and data address spaces.
3314 - If v is a value holding a D10V code pointer, its contents are
3315 in target form: a big-endian address left-shifted two bits.
3316 - If p is a D10V pointer type, TYPE_LENGTH (p) == 2, just as
3317 sizeof (void *) == 2 on the target.
3319 In this context, builtin_type_CORE_ADDR is a bit odd: it's a
3320 target type for a value the target will never see. It's only
3321 used to hold the values of (typeless) linker symbols, which are
3322 indeed in the unified virtual address space. */
3323 builtin_type_void_data_ptr
= make_pointer_type (builtin_type_void
, NULL
);
3324 builtin_type_void_func_ptr
3325 = lookup_pointer_type (lookup_function_type (builtin_type_void
));
3326 builtin_type_CORE_ADDR
=
3327 init_type (TYPE_CODE_INT
, TARGET_ADDR_BIT
/ 8,
3329 "__CORE_ADDR", (struct objfile
*) NULL
);
3330 builtin_type_bfd_vma
=
3331 init_type (TYPE_CODE_INT
, TARGET_BFD_VMA_BIT
/ 8,
3333 "__bfd_vma", (struct objfile
*) NULL
);
3337 extern void _initialize_gdbtypes (void);
3339 _initialize_gdbtypes (void)
3341 struct cmd_list_element
*c
;
3344 /* FIXME - For the moment, handle types by swapping them in and out.
3345 Should be using the per-architecture data-pointer and a large
3347 register_gdbarch_swap (&builtin_type_void
, sizeof (struct type
*), NULL
);
3348 register_gdbarch_swap (&builtin_type_char
, sizeof (struct type
*), NULL
);
3349 register_gdbarch_swap (&builtin_type_short
, sizeof (struct type
*), NULL
);
3350 register_gdbarch_swap (&builtin_type_int
, sizeof (struct type
*), NULL
);
3351 register_gdbarch_swap (&builtin_type_long
, sizeof (struct type
*), NULL
);
3352 register_gdbarch_swap (&builtin_type_long_long
, sizeof (struct type
*), NULL
);
3353 register_gdbarch_swap (&builtin_type_signed_char
, sizeof (struct type
*), NULL
);
3354 register_gdbarch_swap (&builtin_type_unsigned_char
, sizeof (struct type
*), NULL
);
3355 register_gdbarch_swap (&builtin_type_unsigned_short
, sizeof (struct type
*), NULL
);
3356 register_gdbarch_swap (&builtin_type_unsigned_int
, sizeof (struct type
*), NULL
);
3357 register_gdbarch_swap (&builtin_type_unsigned_long
, sizeof (struct type
*), NULL
);
3358 register_gdbarch_swap (&builtin_type_unsigned_long_long
, sizeof (struct type
*), NULL
);
3359 register_gdbarch_swap (&builtin_type_float
, sizeof (struct type
*), NULL
);
3360 register_gdbarch_swap (&builtin_type_double
, sizeof (struct type
*), NULL
);
3361 register_gdbarch_swap (&builtin_type_long_double
, sizeof (struct type
*), NULL
);
3362 register_gdbarch_swap (&builtin_type_complex
, sizeof (struct type
*), NULL
);
3363 register_gdbarch_swap (&builtin_type_double_complex
, sizeof (struct type
*), NULL
);
3364 register_gdbarch_swap (&builtin_type_string
, sizeof (struct type
*), NULL
);
3365 register_gdbarch_swap (&builtin_type_int8
, sizeof (struct type
*), NULL
);
3366 register_gdbarch_swap (&builtin_type_uint8
, sizeof (struct type
*), NULL
);
3367 register_gdbarch_swap (&builtin_type_int16
, sizeof (struct type
*), NULL
);
3368 register_gdbarch_swap (&builtin_type_uint16
, sizeof (struct type
*), NULL
);
3369 register_gdbarch_swap (&builtin_type_int32
, sizeof (struct type
*), NULL
);
3370 register_gdbarch_swap (&builtin_type_uint32
, sizeof (struct type
*), NULL
);
3371 register_gdbarch_swap (&builtin_type_int64
, sizeof (struct type
*), NULL
);
3372 register_gdbarch_swap (&builtin_type_uint64
, sizeof (struct type
*), NULL
);
3373 register_gdbarch_swap (&builtin_type_int128
, sizeof (struct type
*), NULL
);
3374 register_gdbarch_swap (&builtin_type_uint128
, sizeof (struct type
*), NULL
);
3375 register_gdbarch_swap (&builtin_type_v4sf
, sizeof (struct type
*), NULL
);
3376 register_gdbarch_swap (&builtin_type_v4si
, sizeof (struct type
*), NULL
);
3377 register_gdbarch_swap (&builtin_type_v16qi
, sizeof (struct type
*), NULL
);
3378 register_gdbarch_swap (&builtin_type_v8qi
, sizeof (struct type
*), NULL
);
3379 register_gdbarch_swap (&builtin_type_v8hi
, sizeof (struct type
*), NULL
);
3380 register_gdbarch_swap (&builtin_type_v4hi
, sizeof (struct type
*), NULL
);
3381 register_gdbarch_swap (&builtin_type_v2si
, sizeof (struct type
*), NULL
);
3382 register_gdbarch_swap (&builtin_type_vec128
, sizeof (struct type
*), NULL
);
3383 REGISTER_GDBARCH_SWAP (builtin_type_void_data_ptr
);
3384 REGISTER_GDBARCH_SWAP (builtin_type_void_func_ptr
);
3385 REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR
);
3386 REGISTER_GDBARCH_SWAP (builtin_type_bfd_vma
);
3387 register_gdbarch_swap (NULL
, 0, build_gdbtypes
);
3389 /* Note: These types do not need to be swapped - they are target
3391 builtin_type_ieee_single_big
=
3392 init_type (TYPE_CODE_FLT
, floatformat_ieee_single_big
.totalsize
/ 8,
3393 0, "builtin_type_ieee_single_big", NULL
);
3394 TYPE_FLOATFORMAT (builtin_type_ieee_single_big
) = &floatformat_ieee_single_big
;
3395 builtin_type_ieee_single_little
=
3396 init_type (TYPE_CODE_FLT
, floatformat_ieee_single_little
.totalsize
/ 8,
3397 0, "builtin_type_ieee_single_little", NULL
);
3398 TYPE_FLOATFORMAT (builtin_type_ieee_single_little
) = &floatformat_ieee_single_little
;
3399 builtin_type_ieee_double_big
=
3400 init_type (TYPE_CODE_FLT
, floatformat_ieee_double_big
.totalsize
/ 8,
3401 0, "builtin_type_ieee_double_big", NULL
);
3402 TYPE_FLOATFORMAT (builtin_type_ieee_double_big
) = &floatformat_ieee_double_big
;
3403 builtin_type_ieee_double_little
=
3404 init_type (TYPE_CODE_FLT
, floatformat_ieee_double_little
.totalsize
/ 8,
3405 0, "builtin_type_ieee_double_little", NULL
);
3406 TYPE_FLOATFORMAT (builtin_type_ieee_double_little
) = &floatformat_ieee_double_little
;
3407 builtin_type_ieee_double_littlebyte_bigword
=
3408 init_type (TYPE_CODE_FLT
, floatformat_ieee_double_littlebyte_bigword
.totalsize
/ 8,
3409 0, "builtin_type_ieee_double_littlebyte_bigword", NULL
);
3410 TYPE_FLOATFORMAT (builtin_type_ieee_double_littlebyte_bigword
) = &floatformat_ieee_double_littlebyte_bigword
;
3411 builtin_type_i387_ext
=
3412 init_type (TYPE_CODE_FLT
, floatformat_i387_ext
.totalsize
/ 8,
3413 0, "builtin_type_i387_ext", NULL
);
3414 TYPE_FLOATFORMAT (builtin_type_i387_ext
) = &floatformat_i387_ext
;
3415 builtin_type_m68881_ext
=
3416 init_type (TYPE_CODE_FLT
, floatformat_m68881_ext
.totalsize
/ 8,
3417 0, "builtin_type_m68881_ext", NULL
);
3418 TYPE_FLOATFORMAT (builtin_type_m68881_ext
) = &floatformat_m68881_ext
;
3419 builtin_type_i960_ext
=
3420 init_type (TYPE_CODE_FLT
, floatformat_i960_ext
.totalsize
/ 8,
3421 0, "builtin_type_i960_ext", NULL
);
3422 TYPE_FLOATFORMAT (builtin_type_i960_ext
) = &floatformat_i960_ext
;
3423 builtin_type_m88110_ext
=
3424 init_type (TYPE_CODE_FLT
, floatformat_m88110_ext
.totalsize
/ 8,
3425 0, "builtin_type_m88110_ext", NULL
);
3426 TYPE_FLOATFORMAT (builtin_type_m88110_ext
) = &floatformat_m88110_ext
;
3427 builtin_type_m88110_harris_ext
=
3428 init_type (TYPE_CODE_FLT
, floatformat_m88110_harris_ext
.totalsize
/ 8,
3429 0, "builtin_type_m88110_harris_ext", NULL
);
3430 TYPE_FLOATFORMAT (builtin_type_m88110_harris_ext
) = &floatformat_m88110_harris_ext
;
3431 builtin_type_arm_ext_big
=
3432 init_type (TYPE_CODE_FLT
, floatformat_arm_ext_big
.totalsize
/ 8,
3433 0, "builtin_type_arm_ext_big", NULL
);
3434 TYPE_FLOATFORMAT (builtin_type_arm_ext_big
) = &floatformat_arm_ext_big
;
3435 builtin_type_arm_ext_littlebyte_bigword
=
3436 init_type (TYPE_CODE_FLT
, floatformat_arm_ext_littlebyte_bigword
.totalsize
/ 8,
3437 0, "builtin_type_arm_ext_littlebyte_bigword", NULL
);
3438 TYPE_FLOATFORMAT (builtin_type_arm_ext_littlebyte_bigword
) = &floatformat_arm_ext_littlebyte_bigword
;
3439 builtin_type_ia64_spill_big
=
3440 init_type (TYPE_CODE_FLT
, floatformat_ia64_spill_big
.totalsize
/ 8,
3441 0, "builtin_type_ia64_spill_big", NULL
);
3442 TYPE_FLOATFORMAT (builtin_type_ia64_spill_big
) = &floatformat_ia64_spill_big
;
3443 builtin_type_ia64_spill_little
=
3444 init_type (TYPE_CODE_FLT
, floatformat_ia64_spill_little
.totalsize
/ 8,
3445 0, "builtin_type_ia64_spill_little", NULL
);
3446 TYPE_FLOATFORMAT (builtin_type_ia64_spill_little
) = &floatformat_ia64_spill_little
;
3447 builtin_type_ia64_quad_big
=
3448 init_type (TYPE_CODE_FLT
, floatformat_ia64_quad_big
.totalsize
/ 8,
3449 0, "builtin_type_ia64_quad_big", NULL
);
3450 TYPE_FLOATFORMAT (builtin_type_ia64_quad_big
) = &floatformat_ia64_quad_big
;
3451 builtin_type_ia64_quad_little
=
3452 init_type (TYPE_CODE_FLT
, floatformat_ia64_quad_little
.totalsize
/ 8,
3453 0, "builtin_type_ia64_quad_little", NULL
);
3454 TYPE_FLOATFORMAT (builtin_type_ia64_quad_little
) = &floatformat_ia64_quad_little
;
3457 add_set_cmd ("overload", no_class
, var_zinteger
, (char *) &overload_debug
,
3458 "Set debugging of C++ overloading.\n\
3459 When enabled, ranking of the functions\n\
3460 is displayed.", &setdebuglist
),