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;
75 /* 128 bit long vector types */
76 struct type *builtin_type_v2_double;
77 struct type *builtin_type_v4_float;
78 struct type *builtin_type_v2_int64;
79 struct type *builtin_type_v4_int32;
80 struct type *builtin_type_v8_int16;
81 struct type *builtin_type_v16_int8;
82 /* 64 bit long vector types */
83 struct type *builtin_type_v2_float;
84 struct type *builtin_type_v2_int32;
85 struct type *builtin_type_v4_int16;
86 struct type *builtin_type_v8_int8;
88 struct type *builtin_type_v4sf;
89 struct type *builtin_type_v4si;
90 struct type *builtin_type_v16qi;
91 struct type *builtin_type_v8qi;
92 struct type *builtin_type_v8hi;
93 struct type *builtin_type_v4hi;
94 struct type *builtin_type_v2si;
95 struct type *builtin_type_vec64;
96 struct type *builtin_type_vec64i;
97 struct type *builtin_type_vec128;
98 struct type *builtin_type_vec128i;
99 struct type *builtin_type_ieee_single_big;
100 struct type *builtin_type_ieee_single_little;
101 struct type *builtin_type_ieee_double_big;
102 struct type *builtin_type_ieee_double_little;
103 struct type *builtin_type_ieee_double_littlebyte_bigword;
104 struct type *builtin_type_i387_ext;
105 struct type *builtin_type_m68881_ext;
106 struct type *builtin_type_i960_ext;
107 struct type *builtin_type_m88110_ext;
108 struct type *builtin_type_m88110_harris_ext;
109 struct type *builtin_type_arm_ext_big;
110 struct type *builtin_type_arm_ext_littlebyte_bigword;
111 struct type *builtin_type_ia64_spill_big;
112 struct type *builtin_type_ia64_spill_little;
113 struct type *builtin_type_ia64_quad_big;
114 struct type *builtin_type_ia64_quad_little;
115 struct type *builtin_type_void_data_ptr;
116 struct type *builtin_type_void_func_ptr;
117 struct type *builtin_type_CORE_ADDR;
118 struct type *builtin_type_bfd_vma;
120 int opaque_type_resolution = 1;
121 int overload_debug = 0;
127 }; /* maximum extension is 128! FIXME */
129 static void add_name (struct extra *, char *);
130 static void add_mangled_type (struct extra *, struct type *);
132 static void cfront_mangle_name (struct type *, int, int);
134 static void print_bit_vector (B_TYPE *, int);
135 static void print_arg_types (struct field *, int, int);
136 static void dump_fn_fieldlists (struct type *, int);
137 static void print_cplus_stuff (struct type *, int);
138 static void virtual_base_list_aux (struct type *dclass);
141 /* Alloc a new type structure and fill it with some defaults. If
142 OBJFILE is non-NULL, then allocate the space for the type structure
143 in that objfile's type_obstack. Otherwise allocate the new type structure
144 by xmalloc () (for permanent types). */
147 alloc_type (struct objfile *objfile)
149 register struct type *type;
151 /* Alloc the structure and start off with all fields zeroed. */
155 type = xmalloc (sizeof (struct type));
156 memset (type, 0, sizeof (struct type));
157 TYPE_MAIN_TYPE (type) = xmalloc (sizeof (struct main_type));
161 type = obstack_alloc (&objfile->type_obstack,
162 sizeof (struct type));
163 memset (type, 0, sizeof (struct type));
164 TYPE_MAIN_TYPE (type) = obstack_alloc (&objfile->type_obstack,
165 sizeof (struct main_type));
166 OBJSTAT (objfile, n_types++);
168 memset (TYPE_MAIN_TYPE (type), 0, sizeof (struct main_type));
170 /* Initialize the fields that might not be zero. */
172 TYPE_CODE (type) = TYPE_CODE_UNDEF;
173 TYPE_OBJFILE (type) = objfile;
174 TYPE_VPTR_FIELDNO (type) = -1;
175 TYPE_CHAIN (type) = type; /* Chain back to itself. */
180 /* Alloc a new type instance structure, fill it with some defaults,
181 and point it at OLDTYPE. Allocate the new type instance from the
182 same place as OLDTYPE. */
185 alloc_type_instance (struct type *oldtype)
189 /* Allocate the structure. */
191 if (TYPE_OBJFILE (oldtype) == NULL)
193 type = xmalloc (sizeof (struct type));
194 memset (type, 0, sizeof (struct type));
198 type = obstack_alloc (&TYPE_OBJFILE (oldtype)->type_obstack,
199 sizeof (struct type));
200 memset (type, 0, sizeof (struct type));
202 TYPE_MAIN_TYPE (type) = TYPE_MAIN_TYPE (oldtype);
204 TYPE_CHAIN (type) = type; /* Chain back to itself for now. */
209 /* Clear all remnants of the previous type at TYPE, in preparation for
210 replacing it with something else. */
212 smash_type (struct type *type)
214 memset (TYPE_MAIN_TYPE (type), 0, sizeof (struct main_type));
216 /* For now, delete the rings. */
217 TYPE_CHAIN (type) = type;
219 /* For now, leave the pointer/reference types alone. */
222 /* Lookup a pointer to a type TYPE. TYPEPTR, if nonzero, points
223 to a pointer to memory where the pointer type should be stored.
224 If *TYPEPTR is zero, update it to point to the pointer type we return.
225 We allocate new memory if needed. */
228 make_pointer_type (struct type *type, struct type **typeptr)
230 register struct type *ntype; /* New type */
231 struct objfile *objfile;
233 ntype = TYPE_POINTER_TYPE (type);
238 return ntype; /* Don't care about alloc, and have new type. */
239 else if (*typeptr == 0)
241 *typeptr = ntype; /* Tracking alloc, and we have new type. */
246 if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */
248 ntype = alloc_type (TYPE_OBJFILE (type));
253 /* We have storage, but need to reset it. */
256 objfile = TYPE_OBJFILE (ntype);
258 TYPE_OBJFILE (ntype) = objfile;
261 TYPE_TARGET_TYPE (ntype) = type;
262 TYPE_POINTER_TYPE (type) = ntype;
264 /* FIXME! Assume the machine has only one representation for pointers! */
266 TYPE_LENGTH (ntype) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
267 TYPE_CODE (ntype) = TYPE_CODE_PTR;
269 /* Mark pointers as unsigned. The target converts between pointers
270 and addresses (CORE_ADDRs) using POINTER_TO_ADDRESS() and
271 ADDRESS_TO_POINTER(). */
272 TYPE_FLAGS (ntype) |= TYPE_FLAG_UNSIGNED;
274 if (!TYPE_POINTER_TYPE (type)) /* Remember it, if don't have one. */
275 TYPE_POINTER_TYPE (type) = ntype;
280 /* Given a type TYPE, return a type of pointers to that type.
281 May need to construct such a type if this is the first use. */
284 lookup_pointer_type (struct type *type)
286 return make_pointer_type (type, (struct type **) 0);
289 /* Lookup a C++ `reference' to a type TYPE. TYPEPTR, if nonzero, points
290 to a pointer to memory where the reference type should be stored.
291 If *TYPEPTR is zero, update it to point to the reference type we return.
292 We allocate new memory if needed. */
295 make_reference_type (struct type *type, struct type **typeptr)
297 register struct type *ntype; /* New type */
298 struct objfile *objfile;
300 ntype = TYPE_REFERENCE_TYPE (type);
305 return ntype; /* Don't care about alloc, and have new type. */
306 else if (*typeptr == 0)
308 *typeptr = ntype; /* Tracking alloc, and we have new type. */
313 if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */
315 ntype = alloc_type (TYPE_OBJFILE (type));
320 /* We have storage, but need to reset it. */
323 objfile = TYPE_OBJFILE (ntype);
325 TYPE_OBJFILE (ntype) = objfile;
328 TYPE_TARGET_TYPE (ntype) = type;
329 TYPE_REFERENCE_TYPE (type) = ntype;
331 /* FIXME! Assume the machine has only one representation for references,
332 and that it matches the (only) representation for pointers! */
334 TYPE_LENGTH (ntype) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
335 TYPE_CODE (ntype) = TYPE_CODE_REF;
337 if (!TYPE_REFERENCE_TYPE (type)) /* Remember it, if don't have one. */
338 TYPE_REFERENCE_TYPE (type) = ntype;
343 /* Same as above, but caller doesn't care about memory allocation details. */
346 lookup_reference_type (struct type *type)
348 return make_reference_type (type, (struct type **) 0);
351 /* Lookup a function type that returns type TYPE. TYPEPTR, if nonzero, points
352 to a pointer to memory where the function type should be stored.
353 If *TYPEPTR is zero, update it to point to the function type we return.
354 We allocate new memory if needed. */
357 make_function_type (struct type *type, struct type **typeptr)
359 register struct type *ntype; /* New type */
360 struct objfile *objfile;
362 if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */
364 ntype = alloc_type (TYPE_OBJFILE (type));
369 /* We have storage, but need to reset it. */
372 objfile = TYPE_OBJFILE (ntype);
374 TYPE_OBJFILE (ntype) = objfile;
377 TYPE_TARGET_TYPE (ntype) = type;
379 TYPE_LENGTH (ntype) = 1;
380 TYPE_CODE (ntype) = TYPE_CODE_FUNC;
386 /* Given a type TYPE, return a type of functions that return that type.
387 May need to construct such a type if this is the first use. */
390 lookup_function_type (struct type *type)
392 return make_function_type (type, (struct type **) 0);
395 /* Identify address space identifier by name --
396 return the integer flag defined in gdbtypes.h. */
398 address_space_name_to_int (char *space_identifier)
400 struct gdbarch *gdbarch = current_gdbarch;
402 /* Check for known address space delimiters. */
403 if (!strcmp (space_identifier, "code"))
404 return TYPE_FLAG_CODE_SPACE;
405 else if (!strcmp (space_identifier, "data"))
406 return TYPE_FLAG_DATA_SPACE;
407 else if (gdbarch_address_class_name_to_type_flags_p (gdbarch)
408 && gdbarch_address_class_name_to_type_flags (gdbarch,
413 error ("Unknown address space specifier: \"%s\"", space_identifier);
416 /* Identify address space identifier by integer flag as defined in
417 gdbtypes.h -- return the string version of the adress space name. */
420 address_space_int_to_name (int space_flag)
422 struct gdbarch *gdbarch = current_gdbarch;
423 if (space_flag & TYPE_FLAG_CODE_SPACE)
425 else if (space_flag & TYPE_FLAG_DATA_SPACE)
427 else if ((space_flag & TYPE_FLAG_ADDRESS_CLASS_ALL)
428 && gdbarch_address_class_type_flags_to_name_p (gdbarch))
429 return gdbarch_address_class_type_flags_to_name (gdbarch, space_flag);
434 /* Create a new type with instance flags NEW_FLAGS, based on TYPE.
435 If STORAGE is non-NULL, create the new type instance there. */
438 make_qualified_type (struct type *type, int new_flags,
439 struct type *storage)
445 if (TYPE_INSTANCE_FLAGS (ntype) == new_flags)
447 ntype = TYPE_CHAIN (ntype);
448 } while (ntype != type);
450 /* Create a new type instance. */
452 ntype = alloc_type_instance (type);
456 TYPE_MAIN_TYPE (ntype) = TYPE_MAIN_TYPE (type);
457 TYPE_CHAIN (ntype) = ntype;
460 /* Pointers or references to the original type are not relevant to
462 TYPE_POINTER_TYPE (ntype) = (struct type *) 0;
463 TYPE_REFERENCE_TYPE (ntype) = (struct type *) 0;
465 /* Chain the new qualified type to the old type. */
466 TYPE_CHAIN (ntype) = TYPE_CHAIN (type);
467 TYPE_CHAIN (type) = ntype;
469 /* Now set the instance flags and return the new type. */
470 TYPE_INSTANCE_FLAGS (ntype) = new_flags;
475 /* Make an address-space-delimited variant of a type -- a type that
476 is identical to the one supplied except that it has an address
477 space attribute attached to it (such as "code" or "data").
479 The space attributes "code" and "data" are for Harvard architectures.
480 The address space attributes are for architectures which have
481 alternately sized pointers or pointers with alternate representations. */
484 make_type_with_address_space (struct type *type, int space_flag)
487 int new_flags = ((TYPE_INSTANCE_FLAGS (type)
488 & ~(TYPE_FLAG_CODE_SPACE | TYPE_FLAG_DATA_SPACE
489 | TYPE_FLAG_ADDRESS_CLASS_ALL))
492 return make_qualified_type (type, new_flags, NULL);
495 /* Make a "c-v" variant of a type -- a type that is identical to the
496 one supplied except that it may have const or volatile attributes
497 CNST is a flag for setting the const attribute
498 VOLTL is a flag for setting the volatile attribute
499 TYPE is the base type whose variant we are creating.
500 TYPEPTR, if nonzero, points
501 to a pointer to memory where the reference type should be stored.
502 If *TYPEPTR is zero, update it to point to the reference type we return.
503 We allocate new memory if needed. */
506 make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr)
508 register struct type *ntype; /* New type */
509 register struct type *tmp_type = type; /* tmp type */
510 struct objfile *objfile;
512 int new_flags = (TYPE_INSTANCE_FLAGS (type)
513 & ~(TYPE_FLAG_CONST | TYPE_FLAG_VOLATILE));
516 new_flags |= TYPE_FLAG_CONST;
519 new_flags |= TYPE_FLAG_VOLATILE;
521 if (typeptr && *typeptr != NULL)
523 /* Objfile is per-core-type. This const-qualified type had best
524 belong to the same objfile as the type it is qualifying, unless
525 we are overwriting a stub type, in which case the safest thing
526 to do is to copy the core type into the new objfile. */
528 gdb_assert (TYPE_OBJFILE (*typeptr) == TYPE_OBJFILE (type)
529 || TYPE_STUB (*typeptr));
530 if (TYPE_OBJFILE (*typeptr) != TYPE_OBJFILE (type))
532 TYPE_MAIN_TYPE (*typeptr)
533 = TYPE_ALLOC (*typeptr, sizeof (struct main_type));
534 *TYPE_MAIN_TYPE (*typeptr)
535 = *TYPE_MAIN_TYPE (type);
539 ntype = make_qualified_type (type, new_flags, typeptr ? *typeptr : NULL);
547 /* Replace the contents of ntype with the type *type. This changes the
548 contents, rather than the pointer for TYPE_MAIN_TYPE (ntype); thus
549 the changes are propogated to all types in the TYPE_CHAIN.
551 In order to build recursive types, it's inevitable that we'll need
552 to update types in place --- but this sort of indiscriminate
553 smashing is ugly, and needs to be replaced with something more
554 controlled. TYPE_MAIN_TYPE is a step in this direction; it's not
555 clear if more steps are needed. */
557 replace_type (struct type *ntype, struct type *type)
559 struct type *cv_chain, *as_chain, *ptr, *ref;
561 *TYPE_MAIN_TYPE (ntype) = *TYPE_MAIN_TYPE (type);
563 /* Assert that the two types have equivalent instance qualifiers.
564 This should be true for at least all of our debug readers. */
565 gdb_assert (TYPE_INSTANCE_FLAGS (ntype) == TYPE_INSTANCE_FLAGS (type));
568 /* Implement direct support for MEMBER_TYPE in GNU C++.
569 May need to construct such a type if this is the first use.
570 The TYPE is the type of the member. The DOMAIN is the type
571 of the aggregate that the member belongs to. */
574 lookup_member_type (struct type *type, struct type *domain)
576 register struct type *mtype;
578 mtype = alloc_type (TYPE_OBJFILE (type));
579 smash_to_member_type (mtype, domain, type);
583 /* Allocate a stub method whose return type is TYPE.
584 This apparently happens for speed of symbol reading, since parsing
585 out the arguments to the method is cpu-intensive, the way we are doing
586 it. So, we will fill in arguments later.
587 This always returns a fresh type. */
590 allocate_stub_method (struct type *type)
594 mtype = init_type (TYPE_CODE_METHOD, 1, TYPE_FLAG_STUB, NULL,
595 TYPE_OBJFILE (type));
596 TYPE_TARGET_TYPE (mtype) = type;
597 /* _DOMAIN_TYPE (mtype) = unknown yet */
601 /* Create a range type using either a blank type supplied in RESULT_TYPE,
602 or creating a new type, inheriting the objfile from INDEX_TYPE.
604 Indices will be of type INDEX_TYPE, and will range from LOW_BOUND to
605 HIGH_BOUND, inclusive.
607 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
608 sure it is TYPE_CODE_UNDEF before we bash it into a range type? */
611 create_range_type (struct type *result_type, struct type *index_type,
612 int low_bound, int high_bound)
614 if (result_type == NULL)
616 result_type = alloc_type (TYPE_OBJFILE (index_type));
618 TYPE_CODE (result_type) = TYPE_CODE_RANGE;
619 TYPE_TARGET_TYPE (result_type) = index_type;
620 if (TYPE_STUB (index_type))
621 TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB;
623 TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
624 TYPE_NFIELDS (result_type) = 2;
625 TYPE_FIELDS (result_type) = (struct field *)
626 TYPE_ALLOC (result_type, 2 * sizeof (struct field));
627 memset (TYPE_FIELDS (result_type), 0, 2 * sizeof (struct field));
628 TYPE_FIELD_BITPOS (result_type, 0) = low_bound;
629 TYPE_FIELD_BITPOS (result_type, 1) = high_bound;
630 TYPE_FIELD_TYPE (result_type, 0) = builtin_type_int; /* FIXME */
631 TYPE_FIELD_TYPE (result_type, 1) = builtin_type_int; /* FIXME */
634 TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED;
636 return (result_type);
639 /* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type TYPE.
640 Return 1 of type is a range type, 0 if it is discrete (and bounds
641 will fit in LONGEST), or -1 otherwise. */
644 get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
646 CHECK_TYPEDEF (type);
647 switch (TYPE_CODE (type))
649 case TYPE_CODE_RANGE:
650 *lowp = TYPE_LOW_BOUND (type);
651 *highp = TYPE_HIGH_BOUND (type);
654 if (TYPE_NFIELDS (type) > 0)
656 /* The enums may not be sorted by value, so search all
660 *lowp = *highp = TYPE_FIELD_BITPOS (type, 0);
661 for (i = 0; i < TYPE_NFIELDS (type); i++)
663 if (TYPE_FIELD_BITPOS (type, i) < *lowp)
664 *lowp = TYPE_FIELD_BITPOS (type, i);
665 if (TYPE_FIELD_BITPOS (type, i) > *highp)
666 *highp = TYPE_FIELD_BITPOS (type, i);
669 /* Set unsigned indicator if warranted. */
672 TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
686 if (TYPE_LENGTH (type) > sizeof (LONGEST)) /* Too big */
688 if (!TYPE_UNSIGNED (type))
690 *lowp = -(1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1));
694 /* ... fall through for unsigned ints ... */
697 /* This round-about calculation is to avoid shifting by
698 TYPE_LENGTH (type) * TARGET_CHAR_BIT, which will not work
699 if TYPE_LENGTH (type) == sizeof (LONGEST). */
700 *highp = 1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1);
701 *highp = (*highp - 1) | *highp;
708 /* Create an array type using either a blank type supplied in RESULT_TYPE,
709 or creating a new type, inheriting the objfile from RANGE_TYPE.
711 Elements will be of type ELEMENT_TYPE, the indices will be of type
714 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
715 sure it is TYPE_CODE_UNDEF before we bash it into an array type? */
718 create_array_type (struct type *result_type, struct type *element_type,
719 struct type *range_type)
721 LONGEST low_bound, high_bound;
723 if (result_type == NULL)
725 result_type = alloc_type (TYPE_OBJFILE (range_type));
727 TYPE_CODE (result_type) = TYPE_CODE_ARRAY;
728 TYPE_TARGET_TYPE (result_type) = element_type;
729 if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
730 low_bound = high_bound = 0;
731 CHECK_TYPEDEF (element_type);
732 TYPE_LENGTH (result_type) =
733 TYPE_LENGTH (element_type) * (high_bound - low_bound + 1);
734 TYPE_NFIELDS (result_type) = 1;
735 TYPE_FIELDS (result_type) =
736 (struct field *) TYPE_ALLOC (result_type, sizeof (struct field));
737 memset (TYPE_FIELDS (result_type), 0, sizeof (struct field));
738 TYPE_FIELD_TYPE (result_type, 0) = range_type;
739 TYPE_VPTR_FIELDNO (result_type) = -1;
741 /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays */
742 if (TYPE_LENGTH (result_type) == 0)
743 TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB;
745 return (result_type);
748 /* Create a string type using either a blank type supplied in RESULT_TYPE,
749 or creating a new type. String types are similar enough to array of
750 char types that we can use create_array_type to build the basic type
751 and then bash it into a string type.
753 For fixed length strings, the range type contains 0 as the lower
754 bound and the length of the string minus one as the upper bound.
756 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
757 sure it is TYPE_CODE_UNDEF before we bash it into a string type? */
760 create_string_type (struct type *result_type, struct type *range_type)
762 result_type = create_array_type (result_type,
763 *current_language->string_char_type,
765 TYPE_CODE (result_type) = TYPE_CODE_STRING;
766 return (result_type);
770 create_set_type (struct type *result_type, struct type *domain_type)
772 LONGEST low_bound, high_bound, bit_length;
773 if (result_type == NULL)
775 result_type = alloc_type (TYPE_OBJFILE (domain_type));
777 TYPE_CODE (result_type) = TYPE_CODE_SET;
778 TYPE_NFIELDS (result_type) = 1;
779 TYPE_FIELDS (result_type) = (struct field *)
780 TYPE_ALLOC (result_type, 1 * sizeof (struct field));
781 memset (TYPE_FIELDS (result_type), 0, sizeof (struct field));
783 if (!TYPE_STUB (domain_type))
785 if (get_discrete_bounds (domain_type, &low_bound, &high_bound) < 0)
786 low_bound = high_bound = 0;
787 bit_length = high_bound - low_bound + 1;
788 TYPE_LENGTH (result_type)
789 = (bit_length + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT;
791 TYPE_FIELD_TYPE (result_type, 0) = domain_type;
794 TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED;
796 return (result_type);
799 /* Construct and return a type of the form:
800 struct NAME { ELT_TYPE ELT_NAME[N]; }
801 We use these types for SIMD registers. For example, the type of
802 the SSE registers on the late x86-family processors is:
803 struct __builtin_v4sf { float f[4]; }
804 built by the function call:
805 init_simd_type ("__builtin_v4sf", builtin_type_float, "f", 4)
806 The type returned is a permanent type, allocated using malloc; it
807 doesn't live in any objfile's obstack. */
809 init_simd_type (char *name,
810 struct type *elt_type,
814 struct type *simd_type;
815 struct type *array_type;
817 simd_type = init_composite_type (name, TYPE_CODE_STRUCT);
818 array_type = create_array_type (0, elt_type,
819 create_range_type (0, builtin_type_int,
821 append_composite_type_field (simd_type, elt_name, array_type);
826 init_vector_type (struct type *elt_type, int n)
828 struct type *array_type;
830 array_type = create_array_type (0, elt_type,
831 create_range_type (0, builtin_type_int,
833 TYPE_FLAGS (array_type) |= TYPE_FLAG_VECTOR;
838 build_builtin_type_vec64 (void)
840 /* Construct a type for the 64 bit registers. The type we're
843 union __gdb_builtin_type_vec64
855 t = init_composite_type ("__gdb_builtin_type_vec64", TYPE_CODE_UNION);
856 append_composite_type_field (t, "uint64", builtin_type_int64);
857 append_composite_type_field (t, "v2_float", builtin_type_v2_float);
858 append_composite_type_field (t, "v2_int32", builtin_type_v2_int32);
859 append_composite_type_field (t, "v4_int16", builtin_type_v4_int16);
860 append_composite_type_field (t, "v8_int8", builtin_type_v8_int8);
862 TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
863 TYPE_NAME (t) = "builtin_type_vec64";
868 build_builtin_type_vec64i (void)
870 /* Construct a type for the 64 bit registers. The type we're
873 union __gdb_builtin_type_vec64i
884 t = init_composite_type ("__gdb_builtin_type_vec64i", TYPE_CODE_UNION);
885 append_composite_type_field (t, "uint64", builtin_type_int64);
886 append_composite_type_field (t, "v2_int32", builtin_type_v2_int32);
887 append_composite_type_field (t, "v4_int16", builtin_type_v4_int16);
888 append_composite_type_field (t, "v8_int8", builtin_type_v8_int8);
890 TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
891 TYPE_NAME (t) = "builtin_type_vec64i";
896 build_builtin_type_vec128 (void)
898 /* Construct a type for the 128 bit registers. The type we're
901 union __gdb_builtin_type_vec128
913 t = init_composite_type ("__gdb_builtin_type_vec128", TYPE_CODE_UNION);
914 append_composite_type_field (t, "uint128", builtin_type_int128);
915 append_composite_type_field (t, "v4_float", builtin_type_v4_float);
916 append_composite_type_field (t, "v4_int32", builtin_type_v4_int32);
917 append_composite_type_field (t, "v8_int16", builtin_type_v8_int16);
918 append_composite_type_field (t, "v16_int8", builtin_type_v16_int8);
920 TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
921 TYPE_NAME (t) = "builtin_type_vec128";
926 build_builtin_type_vec128i (void)
928 /* 128-bit Intel SIMD registers */
931 t = init_composite_type ("__gdb_builtin_type_vec128i", TYPE_CODE_UNION);
932 append_composite_type_field (t, "v4_float", builtin_type_v4_float);
933 append_composite_type_field (t, "v2_double", builtin_type_v2_double);
934 append_composite_type_field (t, "v16_int8", builtin_type_v16_int8);
935 append_composite_type_field (t, "v8_int16", builtin_type_v8_int16);
936 append_composite_type_field (t, "v4_int32", builtin_type_v4_int32);
937 append_composite_type_field (t, "v2_int64", builtin_type_v2_int64);
938 append_composite_type_field (t, "uint128", builtin_type_int128);
940 TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
941 TYPE_NAME (t) = "builtin_type_vec128i";
945 /* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE.
946 A MEMBER is a wierd thing -- it amounts to a typed offset into
947 a struct, e.g. "an int at offset 8". A MEMBER TYPE doesn't
948 include the offset (that's the value of the MEMBER itself), but does
949 include the structure type into which it points (for some reason).
951 When "smashing" the type, we preserve the objfile that the
952 old type pointed to, since we aren't changing where the type is actually
956 smash_to_member_type (struct type *type, struct type *domain,
957 struct type *to_type)
959 struct objfile *objfile;
961 objfile = TYPE_OBJFILE (type);
964 TYPE_OBJFILE (type) = objfile;
965 TYPE_TARGET_TYPE (type) = to_type;
966 TYPE_DOMAIN_TYPE (type) = domain;
967 TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */
968 TYPE_CODE (type) = TYPE_CODE_MEMBER;
971 /* Smash TYPE to be a type of method of DOMAIN with type TO_TYPE.
972 METHOD just means `function that gets an extra "this" argument'.
974 When "smashing" the type, we preserve the objfile that the
975 old type pointed to, since we aren't changing where the type is actually
979 smash_to_method_type (struct type *type, struct type *domain,
980 struct type *to_type, struct field *args,
981 int nargs, int varargs)
983 struct objfile *objfile;
985 objfile = TYPE_OBJFILE (type);
988 TYPE_OBJFILE (type) = objfile;
989 TYPE_TARGET_TYPE (type) = to_type;
990 TYPE_DOMAIN_TYPE (type) = domain;
991 TYPE_FIELDS (type) = args;
992 TYPE_NFIELDS (type) = nargs;
994 TYPE_FLAGS (type) |= TYPE_FLAG_VARARGS;
995 TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */
996 TYPE_CODE (type) = TYPE_CODE_METHOD;
999 /* Return a typename for a struct/union/enum type without "struct ",
1000 "union ", or "enum ". If the type has a NULL name, return NULL. */
1003 type_name_no_tag (register const struct type *type)
1005 if (TYPE_TAG_NAME (type) != NULL)
1006 return TYPE_TAG_NAME (type);
1008 /* Is there code which expects this to return the name if there is no
1009 tag name? My guess is that this is mainly used for C++ in cases where
1010 the two will always be the same. */
1011 return TYPE_NAME (type);
1014 /* Lookup a primitive type named NAME.
1015 Return zero if NAME is not a primitive type. */
1018 lookup_primitive_typename (char *name)
1020 struct type **const *p;
1022 for (p = current_language->la_builtin_type_vector; *p != NULL; p++)
1024 if (STREQ (TYPE_NAME (**p), name))
1032 /* Lookup a typedef or primitive type named NAME,
1033 visible in lexical block BLOCK.
1034 If NOERR is nonzero, return zero if NAME is not suitably defined. */
1037 lookup_typename (char *name, struct block *block, int noerr)
1039 register struct symbol *sym;
1040 register struct type *tmp;
1042 sym = lookup_symbol (name, block, VAR_NAMESPACE, 0, (struct symtab **) NULL);
1043 if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
1045 tmp = lookup_primitive_typename (name);
1050 else if (!tmp && noerr)
1056 error ("No type named %s.", name);
1059 return (SYMBOL_TYPE (sym));
1063 lookup_unsigned_typename (char *name)
1065 char *uns = alloca (strlen (name) + 10);
1067 strcpy (uns, "unsigned ");
1068 strcpy (uns + 9, name);
1069 return (lookup_typename (uns, (struct block *) NULL, 0));
1073 lookup_signed_typename (char *name)
1076 char *uns = alloca (strlen (name) + 8);
1078 strcpy (uns, "signed ");
1079 strcpy (uns + 7, name);
1080 t = lookup_typename (uns, (struct block *) NULL, 1);
1081 /* If we don't find "signed FOO" just try again with plain "FOO". */
1084 return lookup_typename (name, (struct block *) NULL, 0);
1087 /* Lookup a structure type named "struct NAME",
1088 visible in lexical block BLOCK. */
1091 lookup_struct (char *name, struct block *block)
1093 register struct symbol *sym;
1095 sym = lookup_symbol (name, block, STRUCT_NAMESPACE, 0,
1096 (struct symtab **) NULL);
1100 error ("No struct type named %s.", name);
1102 if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT)
1104 error ("This context has class, union or enum %s, not a struct.", name);
1106 return (SYMBOL_TYPE (sym));
1109 /* Lookup a union type named "union NAME",
1110 visible in lexical block BLOCK. */
1113 lookup_union (char *name, struct block *block)
1115 register struct symbol *sym;
1118 sym = lookup_symbol (name, block, STRUCT_NAMESPACE, 0,
1119 (struct symtab **) NULL);
1122 error ("No union type named %s.", name);
1124 t = SYMBOL_TYPE (sym);
1126 if (TYPE_CODE (t) == TYPE_CODE_UNION)
1129 /* C++ unions may come out with TYPE_CODE_CLASS, but we look at
1130 * a further "declared_type" field to discover it is really a union.
1132 if (HAVE_CPLUS_STRUCT (t))
1133 if (TYPE_DECLARED_TYPE (t) == DECLARED_TYPE_UNION)
1136 /* If we get here, it's not a union */
1137 error ("This context has class, struct or enum %s, not a union.", name);
1141 /* Lookup an enum type named "enum NAME",
1142 visible in lexical block BLOCK. */
1145 lookup_enum (char *name, struct block *block)
1147 register struct symbol *sym;
1149 sym = lookup_symbol (name, block, STRUCT_NAMESPACE, 0,
1150 (struct symtab **) NULL);
1153 error ("No enum type named %s.", name);
1155 if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_ENUM)
1157 error ("This context has class, struct or union %s, not an enum.", name);
1159 return (SYMBOL_TYPE (sym));
1162 /* Lookup a template type named "template NAME<TYPE>",
1163 visible in lexical block BLOCK. */
1166 lookup_template_type (char *name, struct type *type, struct block *block)
1169 char *nam = (char *) alloca (strlen (name) + strlen (TYPE_NAME (type)) + 4);
1172 strcat (nam, TYPE_NAME (type));
1173 strcat (nam, " >"); /* FIXME, extra space still introduced in gcc? */
1175 sym = lookup_symbol (nam, block, VAR_NAMESPACE, 0, (struct symtab **) NULL);
1179 error ("No template type named %s.", name);
1181 if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT)
1183 error ("This context has class, union or enum %s, not a struct.", name);
1185 return (SYMBOL_TYPE (sym));
1188 /* Given a type TYPE, lookup the type of the component of type named NAME.
1190 TYPE can be either a struct or union, or a pointer or reference to a struct or
1191 union. If it is a pointer or reference, its target type is automatically used.
1192 Thus '.' and '->' are interchangable, as specified for the definitions of the
1193 expression element types STRUCTOP_STRUCT and STRUCTOP_PTR.
1195 If NOERR is nonzero, return zero if NAME is not suitably defined.
1196 If NAME is the name of a baseclass type, return that type. */
1199 lookup_struct_elt_type (struct type *type, char *name, int noerr)
1205 CHECK_TYPEDEF (type);
1206 if (TYPE_CODE (type) != TYPE_CODE_PTR
1207 && TYPE_CODE (type) != TYPE_CODE_REF)
1209 type = TYPE_TARGET_TYPE (type);
1212 if (TYPE_CODE (type) != TYPE_CODE_STRUCT &&
1213 TYPE_CODE (type) != TYPE_CODE_UNION)
1215 target_terminal_ours ();
1216 gdb_flush (gdb_stdout);
1217 fprintf_unfiltered (gdb_stderr, "Type ");
1218 type_print (type, "", gdb_stderr, -1);
1219 error (" is not a structure or union type.");
1223 /* FIXME: This change put in by Michael seems incorrect for the case where
1224 the structure tag name is the same as the member name. I.E. when doing
1225 "ptype bell->bar" for "struct foo { int bar; int foo; } bell;"
1230 typename = type_name_no_tag (type);
1231 if (typename != NULL && STREQ (typename, name))
1236 for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
1238 char *t_field_name = TYPE_FIELD_NAME (type, i);
1240 if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
1242 return TYPE_FIELD_TYPE (type, i);
1246 /* OK, it's not in this class. Recursively check the baseclasses. */
1247 for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
1251 t = lookup_struct_elt_type (TYPE_BASECLASS (type, i), name, noerr);
1263 target_terminal_ours ();
1264 gdb_flush (gdb_stdout);
1265 fprintf_unfiltered (gdb_stderr, "Type ");
1266 type_print (type, "", gdb_stderr, -1);
1267 fprintf_unfiltered (gdb_stderr, " has no component named ");
1268 fputs_filtered (name, gdb_stderr);
1270 return (struct type *) -1; /* For lint */
1273 /* If possible, make the vptr_fieldno and vptr_basetype fields of TYPE
1274 valid. Callers should be aware that in some cases (for example,
1275 the type or one of its baseclasses is a stub type and we are
1276 debugging a .o file), this function will not be able to find the virtual
1277 function table pointer, and vptr_fieldno will remain -1 and vptr_basetype
1278 will remain NULL. */
1281 fill_in_vptr_fieldno (struct type *type)
1283 CHECK_TYPEDEF (type);
1285 if (TYPE_VPTR_FIELDNO (type) < 0)
1289 /* We must start at zero in case the first (and only) baseclass is
1290 virtual (and hence we cannot share the table pointer). */
1291 for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
1293 struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
1294 fill_in_vptr_fieldno (baseclass);
1295 if (TYPE_VPTR_FIELDNO (baseclass) >= 0)
1297 TYPE_VPTR_FIELDNO (type) = TYPE_VPTR_FIELDNO (baseclass);
1298 TYPE_VPTR_BASETYPE (type) = TYPE_VPTR_BASETYPE (baseclass);
1305 /* Find the method and field indices for the destructor in class type T.
1306 Return 1 if the destructor was found, otherwise, return 0. */
1309 get_destructor_fn_field (struct type *t, int *method_indexp, int *field_indexp)
1313 for (i = 0; i < TYPE_NFN_FIELDS (t); i++)
1316 struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
1318 for (j = 0; j < TYPE_FN_FIELDLIST_LENGTH (t, i); j++)
1320 if (is_destructor_name (TYPE_FN_FIELD_PHYSNAME (f, j)) != 0)
1331 /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989.
1333 If this is a stubbed struct (i.e. declared as struct foo *), see if
1334 we can find a full definition in some other file. If so, copy this
1335 definition, so we can use it in future. There used to be a comment (but
1336 not any code) that if we don't find a full definition, we'd set a flag
1337 so we don't spend time in the future checking the same type. That would
1338 be a mistake, though--we might load in more symbols which contain a
1339 full definition for the type.
1341 This used to be coded as a macro, but I don't think it is called
1342 often enough to merit such treatment. */
1345 stub_noname_complaint (void)
1347 complaint (&symfile_complaints, "stub type has NULL name");
1351 check_typedef (struct type *type)
1353 struct type *orig_type = type;
1354 int is_const, is_volatile;
1356 while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
1358 if (!TYPE_TARGET_TYPE (type))
1363 /* It is dangerous to call lookup_symbol if we are currently
1364 reading a symtab. Infinite recursion is one danger. */
1365 if (currently_reading_symtab)
1368 name = type_name_no_tag (type);
1369 /* FIXME: shouldn't we separately check the TYPE_NAME and the
1370 TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE
1371 as appropriate? (this code was written before TYPE_NAME and
1372 TYPE_TAG_NAME were separate). */
1375 stub_noname_complaint ();
1378 sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0,
1379 (struct symtab **) NULL);
1381 TYPE_TARGET_TYPE (type) = SYMBOL_TYPE (sym);
1383 TYPE_TARGET_TYPE (type) = alloc_type (NULL); /* TYPE_CODE_UNDEF */
1385 type = TYPE_TARGET_TYPE (type);
1388 is_const = TYPE_CONST (type);
1389 is_volatile = TYPE_VOLATILE (type);
1391 /* If this is a struct/class/union with no fields, then check whether a
1392 full definition exists somewhere else. This is for systems where a
1393 type definition with no fields is issued for such types, instead of
1394 identifying them as stub types in the first place */
1396 if (TYPE_IS_OPAQUE (type) && opaque_type_resolution && !currently_reading_symtab)
1398 char *name = type_name_no_tag (type);
1399 struct type *newtype;
1402 stub_noname_complaint ();
1405 newtype = lookup_transparent_type (name);
1407 make_cv_type (is_const, is_volatile, newtype, &type);
1409 /* Otherwise, rely on the stub flag being set for opaque/stubbed types */
1410 else if (TYPE_STUB (type) && !currently_reading_symtab)
1412 char *name = type_name_no_tag (type);
1413 /* FIXME: shouldn't we separately check the TYPE_NAME and the
1414 TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE
1415 as appropriate? (this code was written before TYPE_NAME and
1416 TYPE_TAG_NAME were separate). */
1420 stub_noname_complaint ();
1423 sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0, (struct symtab **) NULL);
1425 make_cv_type (is_const, is_volatile, SYMBOL_TYPE (sym), &type);
1428 if (TYPE_TARGET_STUB (type))
1430 struct type *range_type;
1431 struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
1433 if (TYPE_STUB (target_type) || TYPE_TARGET_STUB (target_type))
1436 else if (TYPE_CODE (type) == TYPE_CODE_ARRAY
1437 && TYPE_NFIELDS (type) == 1
1438 && (TYPE_CODE (range_type = TYPE_FIELD_TYPE (type, 0))
1439 == TYPE_CODE_RANGE))
1441 /* Now recompute the length of the array type, based on its
1442 number of elements and the target type's length. */
1443 TYPE_LENGTH (type) =
1444 ((TYPE_FIELD_BITPOS (range_type, 1)
1445 - TYPE_FIELD_BITPOS (range_type, 0)
1447 * TYPE_LENGTH (target_type));
1448 TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB;
1450 else if (TYPE_CODE (type) == TYPE_CODE_RANGE)
1452 TYPE_LENGTH (type) = TYPE_LENGTH (target_type);
1453 TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB;
1456 /* Cache TYPE_LENGTH for future use. */
1457 TYPE_LENGTH (orig_type) = TYPE_LENGTH (type);
1461 /* New code added to support parsing of Cfront stabs strings */
1462 #define INIT_EXTRA { pextras->len=0; pextras->str[0]='\0'; }
1463 #define ADD_EXTRA(c) { pextras->str[pextras->len++]=c; }
1466 add_name (struct extra *pextras, char *n)
1470 if ((nlen = (n ? strlen (n) : 0)) == 0)
1472 sprintf (pextras->str + pextras->len, "%d%s", nlen, n);
1473 pextras->len = strlen (pextras->str);
1477 add_mangled_type (struct extra *pextras, struct type *t)
1479 enum type_code tcode;
1483 tcode = TYPE_CODE (t);
1484 tlen = TYPE_LENGTH (t);
1485 tflags = TYPE_FLAGS (t);
1486 tname = TYPE_NAME (t);
1487 /* args of "..." seem to get mangled as "e" */
1505 if ((pname = strrchr (tname, 'l'), pname) && !strcmp (pname, "long"))
1517 complaint (&symfile_complaints, "Bad int type code length x%x",
1536 complaint (&symfile_complaints, "Bad float type code length x%x",
1543 /* followed by what it's a ref to */
1547 /* followed by what it's a ptr to */
1549 case TYPE_CODE_TYPEDEF:
1551 complaint (&symfile_complaints,
1552 "Typedefs in overloaded functions not yet supported");
1554 /* followed by type bytes & name */
1556 case TYPE_CODE_FUNC:
1558 /* followed by func's arg '_' & ret types */
1560 case TYPE_CODE_VOID:
1563 case TYPE_CODE_METHOD:
1565 /* followed by name of class and func's arg '_' & ret types */
1566 add_name (pextras, tname);
1567 ADD_EXTRA ('F'); /* then mangle function */
1569 case TYPE_CODE_STRUCT: /* C struct */
1570 case TYPE_CODE_UNION: /* C union */
1571 case TYPE_CODE_ENUM: /* Enumeration type */
1572 /* followed by name of type */
1573 add_name (pextras, tname);
1576 /* errors possible types/not supported */
1577 case TYPE_CODE_CHAR:
1578 case TYPE_CODE_ARRAY: /* Array type */
1579 case TYPE_CODE_MEMBER: /* Member type */
1580 case TYPE_CODE_BOOL:
1581 case TYPE_CODE_COMPLEX: /* Complex float */
1582 case TYPE_CODE_UNDEF:
1583 case TYPE_CODE_SET: /* Pascal sets */
1584 case TYPE_CODE_RANGE:
1585 case TYPE_CODE_STRING:
1586 case TYPE_CODE_BITSTRING:
1587 case TYPE_CODE_ERROR:
1590 complaint (&symfile_complaints, "Unknown type code x%x", tcode);
1593 if (TYPE_TARGET_TYPE (t))
1594 add_mangled_type (pextras, TYPE_TARGET_TYPE (t));
1599 cfront_mangle_name (struct type *type, int i, int j)
1602 char *mangled_name = gdb_mangle_name (type, i, j);
1604 f = TYPE_FN_FIELDLIST1 (type, i); /* moved from below */
1606 /* kludge to support cfront methods - gdb expects to find "F" for
1607 ARM_mangled names, so when we mangle, we have to add it here */
1611 char *arm_mangled_name;
1612 struct fn_field *method = &f[j];
1613 char *field_name = TYPE_FN_FIELDLIST_NAME (type, i);
1614 char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
1615 char *newname = type_name_no_tag (type);
1617 struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
1618 int nargs = TYPE_NFIELDS (ftype); /* number of args */
1619 struct extra extras, *pextras = &extras;
1622 if (TYPE_FN_FIELD_STATIC_P (f, j)) /* j for sublist within this list */
1625 /* add args here! */
1626 if (nargs <= 1) /* no args besides this */
1630 for (k = 1; k < nargs; k++)
1633 t = TYPE_FIELD_TYPE (ftype, k);
1634 add_mangled_type (pextras, t);
1638 printf ("add_mangled_type: %s\n", extras.str); /* FIXME */
1639 xasprintf (&arm_mangled_name, "%s%s", mangled_name, extras.str);
1640 xfree (mangled_name);
1641 mangled_name = arm_mangled_name;
1647 /* End of new code added to support parsing of Cfront stabs strings */
1649 /* Parse a type expression in the string [P..P+LENGTH). If an error occurs,
1650 silently return builtin_type_void. */
1653 safe_parse_type (char *p, int length)
1655 struct ui_file *saved_gdb_stderr;
1658 /* Suppress error messages. */
1659 saved_gdb_stderr = gdb_stderr;
1660 gdb_stderr = ui_file_new ();
1662 /* Call parse_and_eval_type() without fear of longjmp()s. */
1663 if (!gdb_parse_and_eval_type (p, length, &type))
1664 type = builtin_type_void;
1666 /* Stop suppressing error messages. */
1667 ui_file_delete (gdb_stderr);
1668 gdb_stderr = saved_gdb_stderr;
1673 /* Ugly hack to convert method stubs into method types.
1675 He ain't kiddin'. This demangles the name of the method into a string
1676 including argument types, parses out each argument type, generates
1677 a string casting a zero to that type, evaluates the string, and stuffs
1678 the resulting type into an argtype vector!!! Then it knows the type
1679 of the whole function (including argument types for overloading),
1680 which info used to be in the stab's but was removed to hack back
1681 the space required for them. */
1684 check_stub_method (struct type *type, int method_id, int signature_id)
1687 char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
1688 char *demangled_name = cplus_demangle (mangled_name,
1689 DMGL_PARAMS | DMGL_ANSI);
1690 char *argtypetext, *p;
1691 int depth = 0, argcount = 1;
1692 struct field *argtypes;
1695 /* Make sure we got back a function string that we can use. */
1697 p = strchr (demangled_name, '(');
1701 if (demangled_name == NULL || p == NULL)
1702 error ("Internal: Cannot demangle mangled name `%s'.", mangled_name);
1704 /* Now, read in the parameters that define this type. */
1709 if (*p == '(' || *p == '<')
1713 else if (*p == ')' || *p == '>')
1717 else if (*p == ',' && depth == 0)
1725 /* If we read one argument and it was ``void'', don't count it. */
1726 if (strncmp (argtypetext, "(void)", 6) == 0)
1729 /* We need one extra slot, for the THIS pointer. */
1731 argtypes = (struct field *)
1732 TYPE_ALLOC (type, (argcount + 1) * sizeof (struct field));
1735 /* Add THIS pointer for non-static methods. */
1736 f = TYPE_FN_FIELDLIST1 (type, method_id);
1737 if (TYPE_FN_FIELD_STATIC_P (f, signature_id))
1741 argtypes[0].type = lookup_pointer_type (type);
1745 if (*p != ')') /* () means no args, skip while */
1750 if (depth <= 0 && (*p == ',' || *p == ')'))
1752 /* Avoid parsing of ellipsis, they will be handled below.
1753 Also avoid ``void'' as above. */
1754 if (strncmp (argtypetext, "...", p - argtypetext) != 0
1755 && strncmp (argtypetext, "void", p - argtypetext) != 0)
1757 argtypes[argcount].type =
1758 safe_parse_type (argtypetext, p - argtypetext);
1761 argtypetext = p + 1;
1764 if (*p == '(' || *p == '<')
1768 else if (*p == ')' || *p == '>')
1777 TYPE_FN_FIELD_PHYSNAME (f, signature_id) = mangled_name;
1779 /* Now update the old "stub" type into a real type. */
1780 mtype = TYPE_FN_FIELD_TYPE (f, signature_id);
1781 TYPE_DOMAIN_TYPE (mtype) = type;
1782 TYPE_FIELDS (mtype) = argtypes;
1783 TYPE_NFIELDS (mtype) = argcount;
1784 TYPE_FLAGS (mtype) &= ~TYPE_FLAG_STUB;
1785 TYPE_FN_FIELD_STUB (f, signature_id) = 0;
1787 TYPE_FLAGS (mtype) |= TYPE_FLAG_VARARGS;
1789 xfree (demangled_name);
1792 /* This is the external interface to check_stub_method, above. This function
1793 unstubs all of the signatures for TYPE's METHOD_ID method name. After
1794 calling this function TYPE_FN_FIELD_STUB will be cleared for each signature
1795 and TYPE_FN_FIELDLIST_NAME will be correct.
1797 This function unfortunately can not die until stabs do. */
1800 check_stub_method_group (struct type *type, int method_id)
1802 int len = TYPE_FN_FIELDLIST_LENGTH (type, method_id);
1803 struct fn_field *f = TYPE_FN_FIELDLIST1 (type, method_id);
1804 int j, found_stub = 0;
1806 for (j = 0; j < len; j++)
1807 if (TYPE_FN_FIELD_STUB (f, j))
1810 check_stub_method (type, method_id, j);
1813 /* GNU v3 methods with incorrect names were corrected when we read in
1814 type information, because it was cheaper to do it then. The only GNU v2
1815 methods with incorrect method names are operators and destructors;
1816 destructors were also corrected when we read in type information.
1818 Therefore the only thing we need to handle here are v2 operator
1820 if (found_stub && strncmp (TYPE_FN_FIELD_PHYSNAME (f, 0), "_Z", 2) != 0)
1823 char dem_opname[256];
1825 ret = cplus_demangle_opname (TYPE_FN_FIELDLIST_NAME (type, method_id),
1826 dem_opname, DMGL_ANSI);
1828 ret = cplus_demangle_opname (TYPE_FN_FIELDLIST_NAME (type, method_id),
1831 TYPE_FN_FIELDLIST_NAME (type, method_id) = xstrdup (dem_opname);
1835 const struct cplus_struct_type cplus_struct_default;
1838 allocate_cplus_struct_type (struct type *type)
1840 if (!HAVE_CPLUS_STRUCT (type))
1842 TYPE_CPLUS_SPECIFIC (type) = (struct cplus_struct_type *)
1843 TYPE_ALLOC (type, sizeof (struct cplus_struct_type));
1844 *(TYPE_CPLUS_SPECIFIC (type)) = cplus_struct_default;
1848 /* Helper function to initialize the standard scalar types.
1850 If NAME is non-NULL and OBJFILE is non-NULL, then we make a copy
1851 of the string pointed to by name in the type_obstack for that objfile,
1852 and initialize the type name to that copy. There are places (mipsread.c
1853 in particular, where init_type is called with a NULL value for NAME). */
1856 init_type (enum type_code code, int length, int flags, char *name,
1857 struct objfile *objfile)
1859 register struct type *type;
1861 type = alloc_type (objfile);
1862 TYPE_CODE (type) = code;
1863 TYPE_LENGTH (type) = length;
1864 TYPE_FLAGS (type) |= flags;
1865 if ((name != NULL) && (objfile != NULL))
1868 obsavestring (name, strlen (name), &objfile->type_obstack);
1872 TYPE_NAME (type) = name;
1877 if (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION)
1879 INIT_CPLUS_SPECIFIC (type);
1884 /* Helper function. Create an empty composite type. */
1887 init_composite_type (char *name, enum type_code code)
1890 gdb_assert (code == TYPE_CODE_STRUCT
1891 || code == TYPE_CODE_UNION);
1892 t = init_type (code, 0, 0, NULL, NULL);
1893 TYPE_TAG_NAME (t) = name;
1897 /* Helper function. Append a field to a composite type. */
1900 append_composite_type_field (struct type *t, char *name, struct type *field)
1903 TYPE_NFIELDS (t) = TYPE_NFIELDS (t) + 1;
1904 TYPE_FIELDS (t) = xrealloc (TYPE_FIELDS (t),
1905 sizeof (struct field) * TYPE_NFIELDS (t));
1906 f = &(TYPE_FIELDS (t)[TYPE_NFIELDS (t) - 1]);
1907 memset (f, 0, sizeof f[0]);
1908 FIELD_TYPE (f[0]) = field;
1909 FIELD_NAME (f[0]) = name;
1910 if (TYPE_CODE (t) == TYPE_CODE_UNION)
1912 if (TYPE_LENGTH (t) < TYPE_LENGTH (field))
1913 TYPE_LENGTH (t) = TYPE_LENGTH (field);
1915 else if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
1917 TYPE_LENGTH (t) = TYPE_LENGTH (t) + TYPE_LENGTH (field);
1918 if (TYPE_NFIELDS (t) > 1)
1920 FIELD_BITPOS (f[0]) = (FIELD_BITPOS (f[-1])
1921 + TYPE_LENGTH (field) * TARGET_CHAR_BIT);
1926 /* Look up a fundamental type for the specified objfile.
1927 May need to construct such a type if this is the first use.
1929 Some object file formats (ELF, COFF, etc) do not define fundamental
1930 types such as "int" or "double". Others (stabs for example), do
1931 define fundamental types.
1933 For the formats which don't provide fundamental types, gdb can create
1934 such types, using defaults reasonable for the current language and
1935 the current target machine.
1937 NOTE: This routine is obsolescent. Each debugging format reader
1938 should manage it's own fundamental types, either creating them from
1939 suitable defaults or reading them from the debugging information,
1940 whichever is appropriate. The DWARF reader has already been
1941 fixed to do this. Once the other readers are fixed, this routine
1942 will go away. Also note that fundamental types should be managed
1943 on a compilation unit basis in a multi-language environment, not
1944 on a linkage unit basis as is done here. */
1948 lookup_fundamental_type (struct objfile *objfile, int typeid)
1950 register struct type **typep;
1951 register int nbytes;
1953 if (typeid < 0 || typeid >= FT_NUM_MEMBERS)
1955 error ("internal error - invalid fundamental type id %d", typeid);
1958 /* If this is the first time we need a fundamental type for this objfile
1959 then we need to initialize the vector of type pointers. */
1961 if (objfile->fundamental_types == NULL)
1963 nbytes = FT_NUM_MEMBERS * sizeof (struct type *);
1964 objfile->fundamental_types = (struct type **)
1965 obstack_alloc (&objfile->type_obstack, nbytes);
1966 memset ((char *) objfile->fundamental_types, 0, nbytes);
1967 OBJSTAT (objfile, n_types += FT_NUM_MEMBERS);
1970 /* Look for this particular type in the fundamental type vector. If one is
1971 not found, create and install one appropriate for the current language. */
1973 typep = objfile->fundamental_types + typeid;
1976 *typep = create_fundamental_type (objfile, typeid);
1983 can_dereference (struct type *t)
1985 /* FIXME: Should we return true for references as well as pointers? */
1989 && TYPE_CODE (t) == TYPE_CODE_PTR
1990 && TYPE_CODE (TYPE_TARGET_TYPE (t)) != TYPE_CODE_VOID);
1994 is_integral_type (struct type *t)
1999 && ((TYPE_CODE (t) == TYPE_CODE_INT)
2000 || (TYPE_CODE (t) == TYPE_CODE_ENUM)
2001 || (TYPE_CODE (t) == TYPE_CODE_CHAR)
2002 || (TYPE_CODE (t) == TYPE_CODE_RANGE)
2003 || (TYPE_CODE (t) == TYPE_CODE_BOOL)));
2006 /* Check whether BASE is an ancestor or base class or DCLASS
2007 Return 1 if so, and 0 if not.
2008 Note: callers may want to check for identity of the types before
2009 calling this function -- identical types are considered to satisfy
2010 the ancestor relationship even if they're identical */
2013 is_ancestor (struct type *base, struct type *dclass)
2017 CHECK_TYPEDEF (base);
2018 CHECK_TYPEDEF (dclass);
2022 if (TYPE_NAME (base) && TYPE_NAME (dclass) &&
2023 !strcmp (TYPE_NAME (base), TYPE_NAME (dclass)))
2026 for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
2027 if (is_ancestor (base, TYPE_BASECLASS (dclass, i)))
2035 /* See whether DCLASS has a virtual table. This routine is aimed at
2036 the HP/Taligent ANSI C++ runtime model, and may not work with other
2037 runtime models. Return 1 => Yes, 0 => No. */
2040 has_vtable (struct type *dclass)
2042 /* In the HP ANSI C++ runtime model, a class has a vtable only if it
2043 has virtual functions or virtual bases. */
2047 if (TYPE_CODE (dclass) != TYPE_CODE_CLASS)
2050 /* First check for the presence of virtual bases */
2051 if (TYPE_FIELD_VIRTUAL_BITS (dclass))
2052 for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
2053 if (B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass), i))
2056 /* Next check for virtual functions */
2057 if (TYPE_FN_FIELDLISTS (dclass))
2058 for (i = 0; i < TYPE_NFN_FIELDS (dclass); i++)
2059 if (TYPE_FN_FIELD_VIRTUAL_P (TYPE_FN_FIELDLIST1 (dclass, i), 0))
2062 /* Recurse on non-virtual bases to see if any of them needs a vtable */
2063 if (TYPE_FIELD_VIRTUAL_BITS (dclass))
2064 for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
2065 if ((!B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass), i)) &&
2066 (has_vtable (TYPE_FIELD_TYPE (dclass, i))))
2069 /* Well, maybe we don't need a virtual table */
2073 /* Return a pointer to the "primary base class" of DCLASS.
2075 A NULL return indicates that DCLASS has no primary base, or that it
2076 couldn't be found (insufficient information).
2078 This routine is aimed at the HP/Taligent ANSI C++ runtime model,
2079 and may not work with other runtime models. */
2082 primary_base_class (struct type *dclass)
2084 /* In HP ANSI C++'s runtime model, a "primary base class" of a class
2085 is the first directly inherited, non-virtual base class that
2086 requires a virtual table */
2090 if (TYPE_CODE (dclass) != TYPE_CODE_CLASS)
2093 for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
2094 if (!TYPE_FIELD_VIRTUAL (dclass, i) &&
2095 has_vtable (TYPE_FIELD_TYPE (dclass, i)))
2096 return TYPE_FIELD_TYPE (dclass, i);
2101 /* Global manipulated by virtual_base_list[_aux]() */
2103 static struct vbase *current_vbase_list = NULL;
2105 /* Return a pointer to a null-terminated list of struct vbase
2106 items. The vbasetype pointer of each item in the list points to the
2107 type information for a virtual base of the argument DCLASS.
2109 Helper function for virtual_base_list().
2110 Note: the list goes backward, right-to-left. virtual_base_list()
2111 copies the items out in reverse order. */
2114 virtual_base_list_aux (struct type *dclass)
2116 struct vbase *tmp_vbase;
2119 if (TYPE_CODE (dclass) != TYPE_CODE_CLASS)
2122 for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
2124 /* Recurse on this ancestor, first */
2125 virtual_base_list_aux (TYPE_FIELD_TYPE (dclass, i));
2127 /* If this current base is itself virtual, add it to the list */
2128 if (BASETYPE_VIA_VIRTUAL (dclass, i))
2130 struct type *basetype = TYPE_FIELD_TYPE (dclass, i);
2132 /* Check if base already recorded */
2133 tmp_vbase = current_vbase_list;
2136 if (tmp_vbase->vbasetype == basetype)
2137 break; /* found it */
2138 tmp_vbase = tmp_vbase->next;
2141 if (!tmp_vbase) /* normal exit from loop */
2143 /* Allocate new item for this virtual base */
2144 tmp_vbase = (struct vbase *) xmalloc (sizeof (struct vbase));
2146 /* Stick it on at the end of the list */
2147 tmp_vbase->vbasetype = basetype;
2148 tmp_vbase->next = current_vbase_list;
2149 current_vbase_list = tmp_vbase;
2152 } /* for loop over bases */
2156 /* Compute the list of virtual bases in the right order. Virtual
2157 bases are laid out in the object's memory area in order of their
2158 occurrence in a depth-first, left-to-right search through the
2161 Argument DCLASS is the type whose virtual bases are required.
2162 Return value is the address of a null-terminated array of pointers
2163 to struct type items.
2165 This routine is aimed at the HP/Taligent ANSI C++ runtime model,
2166 and may not work with other runtime models.
2168 This routine merely hands off the argument to virtual_base_list_aux()
2169 and then copies the result into an array to save space. */
2172 virtual_base_list (struct type *dclass)
2174 register struct vbase *tmp_vbase;
2175 register struct vbase *tmp_vbase_2;
2178 struct type **vbase_array;
2180 current_vbase_list = NULL;
2181 virtual_base_list_aux (dclass);
2183 for (i = 0, tmp_vbase = current_vbase_list; tmp_vbase != NULL; i++, tmp_vbase = tmp_vbase->next)
2188 vbase_array = (struct type **) xmalloc ((count + 1) * sizeof (struct type *));
2190 for (i = count - 1, tmp_vbase = current_vbase_list; i >= 0; i--, tmp_vbase = tmp_vbase->next)
2191 vbase_array[i] = tmp_vbase->vbasetype;
2193 /* Get rid of constructed chain */
2194 tmp_vbase_2 = tmp_vbase = current_vbase_list;
2197 tmp_vbase = tmp_vbase->next;
2198 xfree (tmp_vbase_2);
2199 tmp_vbase_2 = tmp_vbase;
2202 vbase_array[count] = NULL;
2206 /* Return the length of the virtual base list of the type DCLASS. */
2209 virtual_base_list_length (struct type *dclass)
2212 register struct vbase *tmp_vbase;
2214 current_vbase_list = NULL;
2215 virtual_base_list_aux (dclass);
2217 for (i = 0, tmp_vbase = current_vbase_list; tmp_vbase != NULL; i++, tmp_vbase = tmp_vbase->next)
2222 /* Return the number of elements of the virtual base list of the type
2223 DCLASS, ignoring those appearing in the primary base (and its
2224 primary base, recursively). */
2227 virtual_base_list_length_skip_primaries (struct type *dclass)
2230 register struct vbase *tmp_vbase;
2231 struct type *primary;
2233 primary = TYPE_RUNTIME_PTR (dclass) ? TYPE_PRIMARY_BASE (dclass) : NULL;
2236 return virtual_base_list_length (dclass);
2238 current_vbase_list = NULL;
2239 virtual_base_list_aux (dclass);
2241 for (i = 0, tmp_vbase = current_vbase_list; tmp_vbase != NULL; tmp_vbase = tmp_vbase->next)
2243 if (virtual_base_index (tmp_vbase->vbasetype, primary) >= 0)
2251 /* Return the index (position) of type BASE, which is a virtual base
2252 class of DCLASS, in the latter's virtual base list. A return of -1
2253 indicates "not found" or a problem. */
2256 virtual_base_index (struct type *base, struct type *dclass)
2258 register struct type *vbase;
2261 if ((TYPE_CODE (dclass) != TYPE_CODE_CLASS) ||
2262 (TYPE_CODE (base) != TYPE_CODE_CLASS))
2266 vbase = virtual_base_list (dclass)[0];
2271 vbase = virtual_base_list (dclass)[++i];
2274 return vbase ? i : -1;
2279 /* Return the index (position) of type BASE, which is a virtual base
2280 class of DCLASS, in the latter's virtual base list. Skip over all
2281 bases that may appear in the virtual base list of the primary base
2282 class of DCLASS (recursively). A return of -1 indicates "not
2283 found" or a problem. */
2286 virtual_base_index_skip_primaries (struct type *base, struct type *dclass)
2288 register struct type *vbase;
2290 struct type *primary;
2292 if ((TYPE_CODE (dclass) != TYPE_CODE_CLASS) ||
2293 (TYPE_CODE (base) != TYPE_CODE_CLASS))
2296 primary = TYPE_RUNTIME_PTR (dclass) ? TYPE_PRIMARY_BASE (dclass) : NULL;
2300 vbase = virtual_base_list (dclass)[0];
2303 if (!primary || (virtual_base_index_skip_primaries (vbase, primary) < 0))
2307 vbase = virtual_base_list (dclass)[++i];
2310 return vbase ? j : -1;
2313 /* Return position of a derived class DCLASS in the list of
2314 * primary bases starting with the remotest ancestor.
2315 * Position returned is 0-based. */
2318 class_index_in_primary_list (struct type *dclass)
2320 struct type *pbc; /* primary base class */
2322 /* Simply recurse on primary base */
2323 pbc = TYPE_PRIMARY_BASE (dclass);
2325 return 1 + class_index_in_primary_list (pbc);
2330 /* Return a count of the number of virtual functions a type has.
2331 * This includes all the virtual functions it inherits from its
2335 /* pai: FIXME This doesn't do the right thing: count redefined virtual
2336 * functions only once (latest redefinition)
2340 count_virtual_fns (struct type *dclass)
2342 int fn, oi; /* function and overloaded instance indices */
2343 int vfuncs; /* count to return */
2345 /* recurse on bases that can share virtual table */
2346 struct type *pbc = primary_base_class (dclass);
2348 vfuncs = count_virtual_fns (pbc);
2352 for (fn = 0; fn < TYPE_NFN_FIELDS (dclass); fn++)
2353 for (oi = 0; oi < TYPE_FN_FIELDLIST_LENGTH (dclass, fn); oi++)
2354 if (TYPE_FN_FIELD_VIRTUAL_P (TYPE_FN_FIELDLIST1 (dclass, fn), oi))
2362 /* Functions for overload resolution begin here */
2364 /* Compare two badness vectors A and B and return the result.
2365 * 0 => A and B are identical
2366 * 1 => A and B are incomparable
2367 * 2 => A is better than B
2368 * 3 => A is worse than B */
2371 compare_badness (struct badness_vector *a, struct badness_vector *b)
2375 short found_pos = 0; /* any positives in c? */
2376 short found_neg = 0; /* any negatives in c? */
2378 /* differing lengths => incomparable */
2379 if (a->length != b->length)
2382 /* Subtract b from a */
2383 for (i = 0; i < a->length; i++)
2385 tmp = a->rank[i] - b->rank[i];
2395 return 1; /* incomparable */
2397 return 3; /* A > B */
2403 return 2; /* A < B */
2405 return 0; /* A == B */
2409 /* Rank a function by comparing its parameter types (PARMS, length NPARMS),
2410 * to the types of an argument list (ARGS, length NARGS).
2411 * Return a pointer to a badness vector. This has NARGS + 1 entries. */
2413 struct badness_vector *
2414 rank_function (struct type **parms, int nparms, struct type **args, int nargs)
2417 struct badness_vector *bv;
2418 int min_len = nparms < nargs ? nparms : nargs;
2420 bv = xmalloc (sizeof (struct badness_vector));
2421 bv->length = nargs + 1; /* add 1 for the length-match rank */
2422 bv->rank = xmalloc ((nargs + 1) * sizeof (int));
2424 /* First compare the lengths of the supplied lists.
2425 * If there is a mismatch, set it to a high value. */
2427 /* pai/1997-06-03 FIXME: when we have debug info about default
2428 * arguments and ellipsis parameter lists, we should consider those
2429 * and rank the length-match more finely. */
2431 LENGTH_MATCH (bv) = (nargs != nparms) ? LENGTH_MISMATCH_BADNESS : 0;
2433 /* Now rank all the parameters of the candidate function */
2434 for (i = 1; i <= min_len; i++)
2435 bv->rank[i] = rank_one_type (parms[i-1], args[i-1]);
2437 /* If more arguments than parameters, add dummy entries */
2438 for (i = min_len + 1; i <= nargs; i++)
2439 bv->rank[i] = TOO_FEW_PARAMS_BADNESS;
2444 /* Compare one type (PARM) for compatibility with another (ARG).
2445 * PARM is intended to be the parameter type of a function; and
2446 * ARG is the supplied argument's type. This function tests if
2447 * the latter can be converted to the former.
2449 * Return 0 if they are identical types;
2450 * Otherwise, return an integer which corresponds to how compatible
2451 * PARM is to ARG. The higher the return value, the worse the match.
2452 * Generally the "bad" conversions are all uniformly assigned a 100 */
2455 rank_one_type (struct type *parm, struct type *arg)
2457 /* Identical type pointers */
2458 /* However, this still doesn't catch all cases of same type for arg
2459 * and param. The reason is that builtin types are different from
2460 * the same ones constructed from the object. */
2464 /* Resolve typedefs */
2465 if (TYPE_CODE (parm) == TYPE_CODE_TYPEDEF)
2466 parm = check_typedef (parm);
2467 if (TYPE_CODE (arg) == TYPE_CODE_TYPEDEF)
2468 arg = check_typedef (arg);
2471 Well, damnit, if the names are exactly the same,
2472 i'll say they are exactly the same. This happens when we generate
2473 method stubs. The types won't point to the same address, but they
2474 really are the same.
2477 if (TYPE_NAME (parm) && TYPE_NAME (arg) &&
2478 !strcmp (TYPE_NAME (parm), TYPE_NAME (arg)))
2481 /* Check if identical after resolving typedefs */
2485 /* See through references, since we can almost make non-references
2487 if (TYPE_CODE (arg) == TYPE_CODE_REF)
2488 return (rank_one_type (parm, TYPE_TARGET_TYPE (arg))
2489 + REFERENCE_CONVERSION_BADNESS);
2490 if (TYPE_CODE (parm) == TYPE_CODE_REF)
2491 return (rank_one_type (TYPE_TARGET_TYPE (parm), arg)
2492 + REFERENCE_CONVERSION_BADNESS);
2494 /* Debugging only. */
2495 fprintf_filtered (gdb_stderr,"------ Arg is %s [%d], parm is %s [%d]\n",
2496 TYPE_NAME (arg), TYPE_CODE (arg), TYPE_NAME (parm), TYPE_CODE (parm));
2498 /* x -> y means arg of type x being supplied for parameter of type y */
2500 switch (TYPE_CODE (parm))
2503 switch (TYPE_CODE (arg))
2506 if (TYPE_CODE (TYPE_TARGET_TYPE (parm)) == TYPE_CODE_VOID)
2507 return VOID_PTR_CONVERSION_BADNESS;
2509 return rank_one_type (TYPE_TARGET_TYPE (parm), TYPE_TARGET_TYPE (arg));
2510 case TYPE_CODE_ARRAY:
2511 return rank_one_type (TYPE_TARGET_TYPE (parm), TYPE_TARGET_TYPE (arg));
2512 case TYPE_CODE_FUNC:
2513 return rank_one_type (TYPE_TARGET_TYPE (parm), arg);
2515 case TYPE_CODE_ENUM:
2516 case TYPE_CODE_CHAR:
2517 case TYPE_CODE_RANGE:
2518 case TYPE_CODE_BOOL:
2519 return POINTER_CONVERSION_BADNESS;
2521 return INCOMPATIBLE_TYPE_BADNESS;
2523 case TYPE_CODE_ARRAY:
2524 switch (TYPE_CODE (arg))
2527 case TYPE_CODE_ARRAY:
2528 return rank_one_type (TYPE_TARGET_TYPE (parm), TYPE_TARGET_TYPE (arg));
2530 return INCOMPATIBLE_TYPE_BADNESS;
2532 case TYPE_CODE_FUNC:
2533 switch (TYPE_CODE (arg))
2535 case TYPE_CODE_PTR: /* funcptr -> func */
2536 return rank_one_type (parm, TYPE_TARGET_TYPE (arg));
2538 return INCOMPATIBLE_TYPE_BADNESS;
2541 switch (TYPE_CODE (arg))
2544 if (TYPE_LENGTH (arg) == TYPE_LENGTH (parm))
2546 /* Deal with signed, unsigned, and plain chars and
2547 signed and unsigned ints */
2548 if (TYPE_NOSIGN (parm))
2550 /* This case only for character types */
2551 if (TYPE_NOSIGN (arg)) /* plain char -> plain char */
2554 return INTEGER_COERCION_BADNESS; /* signed/unsigned char -> plain char */
2556 else if (TYPE_UNSIGNED (parm))
2558 if (TYPE_UNSIGNED (arg))
2560 if (!strcmp_iw (TYPE_NAME (parm), TYPE_NAME (arg)))
2561 return 0; /* unsigned int -> unsigned int, or unsigned long -> unsigned long */
2562 else if (!strcmp_iw (TYPE_NAME (arg), "int") && !strcmp_iw (TYPE_NAME (parm), "long"))
2563 return INTEGER_PROMOTION_BADNESS; /* unsigned int -> unsigned long */
2565 return INTEGER_COERCION_BADNESS; /* unsigned long -> unsigned int */
2569 if (!strcmp_iw (TYPE_NAME (arg), "long") && !strcmp_iw (TYPE_NAME (parm), "int"))
2570 return INTEGER_COERCION_BADNESS; /* signed long -> unsigned int */
2572 return INTEGER_CONVERSION_BADNESS; /* signed int/long -> unsigned int/long */
2575 else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg))
2577 if (!strcmp_iw (TYPE_NAME (parm), TYPE_NAME (arg)))
2579 else if (!strcmp_iw (TYPE_NAME (arg), "int") && !strcmp_iw (TYPE_NAME (parm), "long"))
2580 return INTEGER_PROMOTION_BADNESS;
2582 return INTEGER_COERCION_BADNESS;
2585 return INTEGER_COERCION_BADNESS;
2587 else if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm))
2588 return INTEGER_PROMOTION_BADNESS;
2590 return INTEGER_COERCION_BADNESS;
2591 case TYPE_CODE_ENUM:
2592 case TYPE_CODE_CHAR:
2593 case TYPE_CODE_RANGE:
2594 case TYPE_CODE_BOOL:
2595 return INTEGER_PROMOTION_BADNESS;
2597 return INT_FLOAT_CONVERSION_BADNESS;
2599 return NS_POINTER_CONVERSION_BADNESS;
2601 return INCOMPATIBLE_TYPE_BADNESS;
2604 case TYPE_CODE_ENUM:
2605 switch (TYPE_CODE (arg))
2608 case TYPE_CODE_CHAR:
2609 case TYPE_CODE_RANGE:
2610 case TYPE_CODE_BOOL:
2611 case TYPE_CODE_ENUM:
2612 return INTEGER_COERCION_BADNESS;
2614 return INT_FLOAT_CONVERSION_BADNESS;
2616 return INCOMPATIBLE_TYPE_BADNESS;
2619 case TYPE_CODE_CHAR:
2620 switch (TYPE_CODE (arg))
2622 case TYPE_CODE_RANGE:
2623 case TYPE_CODE_BOOL:
2624 case TYPE_CODE_ENUM:
2625 return INTEGER_COERCION_BADNESS;
2627 return INT_FLOAT_CONVERSION_BADNESS;
2629 if (TYPE_LENGTH (arg) > TYPE_LENGTH (parm))
2630 return INTEGER_COERCION_BADNESS;
2631 else if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm))
2632 return INTEGER_PROMOTION_BADNESS;
2633 /* >>> !! else fall through !! <<< */
2634 case TYPE_CODE_CHAR:
2635 /* Deal with signed, unsigned, and plain chars for C++
2636 and with int cases falling through from previous case */
2637 if (TYPE_NOSIGN (parm))
2639 if (TYPE_NOSIGN (arg))
2642 return INTEGER_COERCION_BADNESS;
2644 else if (TYPE_UNSIGNED (parm))
2646 if (TYPE_UNSIGNED (arg))
2649 return INTEGER_PROMOTION_BADNESS;
2651 else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg))
2654 return INTEGER_COERCION_BADNESS;
2656 return INCOMPATIBLE_TYPE_BADNESS;
2659 case TYPE_CODE_RANGE:
2660 switch (TYPE_CODE (arg))
2663 case TYPE_CODE_CHAR:
2664 case TYPE_CODE_RANGE:
2665 case TYPE_CODE_BOOL:
2666 case TYPE_CODE_ENUM:
2667 return INTEGER_COERCION_BADNESS;
2669 return INT_FLOAT_CONVERSION_BADNESS;
2671 return INCOMPATIBLE_TYPE_BADNESS;
2674 case TYPE_CODE_BOOL:
2675 switch (TYPE_CODE (arg))
2678 case TYPE_CODE_CHAR:
2679 case TYPE_CODE_RANGE:
2680 case TYPE_CODE_ENUM:
2683 return BOOLEAN_CONVERSION_BADNESS;
2684 case TYPE_CODE_BOOL:
2687 return INCOMPATIBLE_TYPE_BADNESS;
2691 switch (TYPE_CODE (arg))
2694 if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm))
2695 return FLOAT_PROMOTION_BADNESS;
2696 else if (TYPE_LENGTH (arg) == TYPE_LENGTH (parm))
2699 return FLOAT_CONVERSION_BADNESS;
2701 case TYPE_CODE_BOOL:
2702 case TYPE_CODE_ENUM:
2703 case TYPE_CODE_RANGE:
2704 case TYPE_CODE_CHAR:
2705 return INT_FLOAT_CONVERSION_BADNESS;
2707 return INCOMPATIBLE_TYPE_BADNESS;
2710 case TYPE_CODE_COMPLEX:
2711 switch (TYPE_CODE (arg))
2712 { /* Strictly not needed for C++, but... */
2714 return FLOAT_PROMOTION_BADNESS;
2715 case TYPE_CODE_COMPLEX:
2718 return INCOMPATIBLE_TYPE_BADNESS;
2721 case TYPE_CODE_STRUCT:
2722 /* currently same as TYPE_CODE_CLASS */
2723 switch (TYPE_CODE (arg))
2725 case TYPE_CODE_STRUCT:
2726 /* Check for derivation */
2727 if (is_ancestor (parm, arg))
2728 return BASE_CONVERSION_BADNESS;
2729 /* else fall through */
2731 return INCOMPATIBLE_TYPE_BADNESS;
2734 case TYPE_CODE_UNION:
2735 switch (TYPE_CODE (arg))
2737 case TYPE_CODE_UNION:
2739 return INCOMPATIBLE_TYPE_BADNESS;
2742 case TYPE_CODE_MEMBER:
2743 switch (TYPE_CODE (arg))
2746 return INCOMPATIBLE_TYPE_BADNESS;
2749 case TYPE_CODE_METHOD:
2750 switch (TYPE_CODE (arg))
2754 return INCOMPATIBLE_TYPE_BADNESS;
2758 switch (TYPE_CODE (arg))
2762 return INCOMPATIBLE_TYPE_BADNESS;
2767 switch (TYPE_CODE (arg))
2771 return rank_one_type (TYPE_FIELD_TYPE (parm, 0), TYPE_FIELD_TYPE (arg, 0));
2773 return INCOMPATIBLE_TYPE_BADNESS;
2776 case TYPE_CODE_VOID:
2778 return INCOMPATIBLE_TYPE_BADNESS;
2779 } /* switch (TYPE_CODE (arg)) */
2783 /* End of functions for overload resolution */
2786 print_bit_vector (B_TYPE *bits, int nbits)
2790 for (bitno = 0; bitno < nbits; bitno++)
2792 if ((bitno % 8) == 0)
2794 puts_filtered (" ");
2796 if (B_TST (bits, bitno))
2798 printf_filtered ("1");
2802 printf_filtered ("0");
2807 /* Note the first arg should be the "this" pointer, we may not want to
2808 include it since we may get into a infinitely recursive situation. */
2811 print_arg_types (struct field *args, int nargs, int spaces)
2817 for (i = 0; i < nargs; i++)
2818 recursive_dump_type (args[i].type, spaces + 2);
2823 dump_fn_fieldlists (struct type *type, int spaces)
2829 printfi_filtered (spaces, "fn_fieldlists ");
2830 gdb_print_host_address (TYPE_FN_FIELDLISTS (type), gdb_stdout);
2831 printf_filtered ("\n");
2832 for (method_idx = 0; method_idx < TYPE_NFN_FIELDS (type); method_idx++)
2834 f = TYPE_FN_FIELDLIST1 (type, method_idx);
2835 printfi_filtered (spaces + 2, "[%d] name '%s' (",
2837 TYPE_FN_FIELDLIST_NAME (type, method_idx));
2838 gdb_print_host_address (TYPE_FN_FIELDLIST_NAME (type, method_idx),
2840 printf_filtered (") length %d\n",
2841 TYPE_FN_FIELDLIST_LENGTH (type, method_idx));
2842 for (overload_idx = 0;
2843 overload_idx < TYPE_FN_FIELDLIST_LENGTH (type, method_idx);
2846 printfi_filtered (spaces + 4, "[%d] physname '%s' (",
2848 TYPE_FN_FIELD_PHYSNAME (f, overload_idx));
2849 gdb_print_host_address (TYPE_FN_FIELD_PHYSNAME (f, overload_idx),
2851 printf_filtered (")\n");
2852 printfi_filtered (spaces + 8, "type ");
2853 gdb_print_host_address (TYPE_FN_FIELD_TYPE (f, overload_idx), gdb_stdout);
2854 printf_filtered ("\n");
2856 recursive_dump_type (TYPE_FN_FIELD_TYPE (f, overload_idx),
2859 printfi_filtered (spaces + 8, "args ");
2860 gdb_print_host_address (TYPE_FN_FIELD_ARGS (f, overload_idx), gdb_stdout);
2861 printf_filtered ("\n");
2863 print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx),
2864 TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, overload_idx)),
2866 printfi_filtered (spaces + 8, "fcontext ");
2867 gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx),
2869 printf_filtered ("\n");
2871 printfi_filtered (spaces + 8, "is_const %d\n",
2872 TYPE_FN_FIELD_CONST (f, overload_idx));
2873 printfi_filtered (spaces + 8, "is_volatile %d\n",
2874 TYPE_FN_FIELD_VOLATILE (f, overload_idx));
2875 printfi_filtered (spaces + 8, "is_private %d\n",
2876 TYPE_FN_FIELD_PRIVATE (f, overload_idx));
2877 printfi_filtered (spaces + 8, "is_protected %d\n",
2878 TYPE_FN_FIELD_PROTECTED (f, overload_idx));
2879 printfi_filtered (spaces + 8, "is_stub %d\n",
2880 TYPE_FN_FIELD_STUB (f, overload_idx));
2881 printfi_filtered (spaces + 8, "voffset %u\n",
2882 TYPE_FN_FIELD_VOFFSET (f, overload_idx));
2888 print_cplus_stuff (struct type *type, int spaces)
2890 printfi_filtered (spaces, "n_baseclasses %d\n",
2891 TYPE_N_BASECLASSES (type));
2892 printfi_filtered (spaces, "nfn_fields %d\n",
2893 TYPE_NFN_FIELDS (type));
2894 printfi_filtered (spaces, "nfn_fields_total %d\n",
2895 TYPE_NFN_FIELDS_TOTAL (type));
2896 if (TYPE_N_BASECLASSES (type) > 0)
2898 printfi_filtered (spaces, "virtual_field_bits (%d bits at *",
2899 TYPE_N_BASECLASSES (type));
2900 gdb_print_host_address (TYPE_FIELD_VIRTUAL_BITS (type), gdb_stdout);
2901 printf_filtered (")");
2903 print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type),
2904 TYPE_N_BASECLASSES (type));
2905 puts_filtered ("\n");
2907 if (TYPE_NFIELDS (type) > 0)
2909 if (TYPE_FIELD_PRIVATE_BITS (type) != NULL)
2911 printfi_filtered (spaces, "private_field_bits (%d bits at *",
2912 TYPE_NFIELDS (type));
2913 gdb_print_host_address (TYPE_FIELD_PRIVATE_BITS (type), gdb_stdout);
2914 printf_filtered (")");
2915 print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type),
2916 TYPE_NFIELDS (type));
2917 puts_filtered ("\n");
2919 if (TYPE_FIELD_PROTECTED_BITS (type) != NULL)
2921 printfi_filtered (spaces, "protected_field_bits (%d bits at *",
2922 TYPE_NFIELDS (type));
2923 gdb_print_host_address (TYPE_FIELD_PROTECTED_BITS (type), gdb_stdout);
2924 printf_filtered (")");
2925 print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type),
2926 TYPE_NFIELDS (type));
2927 puts_filtered ("\n");
2930 if (TYPE_NFN_FIELDS (type) > 0)
2932 dump_fn_fieldlists (type, spaces);
2937 print_bound_type (int bt)
2941 case BOUND_CANNOT_BE_DETERMINED:
2942 printf_filtered ("(BOUND_CANNOT_BE_DETERMINED)");
2944 case BOUND_BY_REF_ON_STACK:
2945 printf_filtered ("(BOUND_BY_REF_ON_STACK)");
2947 case BOUND_BY_VALUE_ON_STACK:
2948 printf_filtered ("(BOUND_BY_VALUE_ON_STACK)");
2950 case BOUND_BY_REF_IN_REG:
2951 printf_filtered ("(BOUND_BY_REF_IN_REG)");
2953 case BOUND_BY_VALUE_IN_REG:
2954 printf_filtered ("(BOUND_BY_VALUE_IN_REG)");
2957 printf_filtered ("(BOUND_SIMPLE)");
2960 printf_filtered ("(unknown bound type)");
2965 static struct obstack dont_print_type_obstack;
2968 recursive_dump_type (struct type *type, int spaces)
2973 obstack_begin (&dont_print_type_obstack, 0);
2975 if (TYPE_NFIELDS (type) > 0
2976 || (TYPE_CPLUS_SPECIFIC (type) && TYPE_NFN_FIELDS (type) > 0))
2978 struct type **first_dont_print
2979 = (struct type **) obstack_base (&dont_print_type_obstack);
2981 int i = (struct type **) obstack_next_free (&dont_print_type_obstack)
2986 if (type == first_dont_print[i])
2988 printfi_filtered (spaces, "type node ");
2989 gdb_print_host_address (type, gdb_stdout);
2990 printf_filtered (" <same as already seen type>\n");
2995 obstack_ptr_grow (&dont_print_type_obstack, type);
2998 printfi_filtered (spaces, "type node ");
2999 gdb_print_host_address (type, gdb_stdout);
3000 printf_filtered ("\n");
3001 printfi_filtered (spaces, "name '%s' (",
3002 TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>");
3003 gdb_print_host_address (TYPE_NAME (type), gdb_stdout);
3004 printf_filtered (")\n");
3005 printfi_filtered (spaces, "tagname '%s' (",
3006 TYPE_TAG_NAME (type) ? TYPE_TAG_NAME (type) : "<NULL>");
3007 gdb_print_host_address (TYPE_TAG_NAME (type), gdb_stdout);
3008 printf_filtered (")\n");
3009 printfi_filtered (spaces, "code 0x%x ", TYPE_CODE (type));
3010 switch (TYPE_CODE (type))
3012 case TYPE_CODE_UNDEF:
3013 printf_filtered ("(TYPE_CODE_UNDEF)");
3016 printf_filtered ("(TYPE_CODE_PTR)");
3018 case TYPE_CODE_ARRAY:
3019 printf_filtered ("(TYPE_CODE_ARRAY)");
3021 case TYPE_CODE_STRUCT:
3022 printf_filtered ("(TYPE_CODE_STRUCT)");
3024 case TYPE_CODE_UNION:
3025 printf_filtered ("(TYPE_CODE_UNION)");
3027 case TYPE_CODE_ENUM:
3028 printf_filtered ("(TYPE_CODE_ENUM)");
3030 case TYPE_CODE_FUNC:
3031 printf_filtered ("(TYPE_CODE_FUNC)");
3034 printf_filtered ("(TYPE_CODE_INT)");
3037 printf_filtered ("(TYPE_CODE_FLT)");
3039 case TYPE_CODE_VOID:
3040 printf_filtered ("(TYPE_CODE_VOID)");
3043 printf_filtered ("(TYPE_CODE_SET)");
3045 case TYPE_CODE_RANGE:
3046 printf_filtered ("(TYPE_CODE_RANGE)");
3048 case TYPE_CODE_STRING:
3049 printf_filtered ("(TYPE_CODE_STRING)");
3051 case TYPE_CODE_BITSTRING:
3052 printf_filtered ("(TYPE_CODE_BITSTRING)");
3054 case TYPE_CODE_ERROR:
3055 printf_filtered ("(TYPE_CODE_ERROR)");
3057 case TYPE_CODE_MEMBER:
3058 printf_filtered ("(TYPE_CODE_MEMBER)");
3060 case TYPE_CODE_METHOD:
3061 printf_filtered ("(TYPE_CODE_METHOD)");
3064 printf_filtered ("(TYPE_CODE_REF)");
3066 case TYPE_CODE_CHAR:
3067 printf_filtered ("(TYPE_CODE_CHAR)");
3069 case TYPE_CODE_BOOL:
3070 printf_filtered ("(TYPE_CODE_BOOL)");
3072 case TYPE_CODE_COMPLEX:
3073 printf_filtered ("(TYPE_CODE_COMPLEX)");
3075 case TYPE_CODE_TYPEDEF:
3076 printf_filtered ("(TYPE_CODE_TYPEDEF)");
3078 case TYPE_CODE_TEMPLATE:
3079 printf_filtered ("(TYPE_CODE_TEMPLATE)");
3081 case TYPE_CODE_TEMPLATE_ARG:
3082 printf_filtered ("(TYPE_CODE_TEMPLATE_ARG)");
3085 printf_filtered ("(UNKNOWN TYPE CODE)");
3088 puts_filtered ("\n");
3089 printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type));
3090 printfi_filtered (spaces, "upper_bound_type 0x%x ",
3091 TYPE_ARRAY_UPPER_BOUND_TYPE (type));
3092 print_bound_type (TYPE_ARRAY_UPPER_BOUND_TYPE (type));
3093 puts_filtered ("\n");
3094 printfi_filtered (spaces, "lower_bound_type 0x%x ",
3095 TYPE_ARRAY_LOWER_BOUND_TYPE (type));
3096 print_bound_type (TYPE_ARRAY_LOWER_BOUND_TYPE (type));
3097 puts_filtered ("\n");
3098 printfi_filtered (spaces, "objfile ");
3099 gdb_print_host_address (TYPE_OBJFILE (type), gdb_stdout);
3100 printf_filtered ("\n");
3101 printfi_filtered (spaces, "target_type ");
3102 gdb_print_host_address (TYPE_TARGET_TYPE (type), gdb_stdout);
3103 printf_filtered ("\n");
3104 if (TYPE_TARGET_TYPE (type) != NULL)
3106 recursive_dump_type (TYPE_TARGET_TYPE (type), spaces + 2);
3108 printfi_filtered (spaces, "pointer_type ");
3109 gdb_print_host_address (TYPE_POINTER_TYPE (type), gdb_stdout);
3110 printf_filtered ("\n");
3111 printfi_filtered (spaces, "reference_type ");
3112 gdb_print_host_address (TYPE_REFERENCE_TYPE (type), gdb_stdout);
3113 printf_filtered ("\n");
3114 printfi_filtered (spaces, "type_chain ");
3115 gdb_print_host_address (TYPE_CHAIN (type), gdb_stdout);
3116 printf_filtered ("\n");
3117 printfi_filtered (spaces, "instance_flags 0x%x", TYPE_INSTANCE_FLAGS (type));
3118 if (TYPE_CONST (type))
3120 puts_filtered (" TYPE_FLAG_CONST");
3122 if (TYPE_VOLATILE (type))
3124 puts_filtered (" TYPE_FLAG_VOLATILE");
3126 if (TYPE_CODE_SPACE (type))
3128 puts_filtered (" TYPE_FLAG_CODE_SPACE");
3130 if (TYPE_DATA_SPACE (type))
3132 puts_filtered (" TYPE_FLAG_DATA_SPACE");
3134 if (TYPE_ADDRESS_CLASS_1 (type))
3136 puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_1");
3138 if (TYPE_ADDRESS_CLASS_2 (type))
3140 puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_2");
3142 puts_filtered ("\n");
3143 printfi_filtered (spaces, "flags 0x%x", TYPE_FLAGS (type));
3144 if (TYPE_UNSIGNED (type))
3146 puts_filtered (" TYPE_FLAG_UNSIGNED");
3148 if (TYPE_NOSIGN (type))
3150 puts_filtered (" TYPE_FLAG_NOSIGN");
3152 if (TYPE_STUB (type))
3154 puts_filtered (" TYPE_FLAG_STUB");
3156 if (TYPE_TARGET_STUB (type))
3158 puts_filtered (" TYPE_FLAG_TARGET_STUB");
3160 if (TYPE_STATIC (type))
3162 puts_filtered (" TYPE_FLAG_STATIC");
3164 if (TYPE_PROTOTYPED (type))
3166 puts_filtered (" TYPE_FLAG_PROTOTYPED");
3168 if (TYPE_INCOMPLETE (type))
3170 puts_filtered (" TYPE_FLAG_INCOMPLETE");
3172 if (TYPE_VARARGS (type))
3174 puts_filtered (" TYPE_FLAG_VARARGS");
3176 /* This is used for things like AltiVec registers on ppc. Gcc emits
3177 an attribute for the array type, which tells whether or not we
3178 have a vector, instead of a regular array. */
3179 if (TYPE_VECTOR (type))
3181 puts_filtered (" TYPE_FLAG_VECTOR");
3183 puts_filtered ("\n");
3184 printfi_filtered (spaces, "nfields %d ", TYPE_NFIELDS (type));
3185 gdb_print_host_address (TYPE_FIELDS (type), gdb_stdout);
3186 puts_filtered ("\n");
3187 for (idx = 0; idx < TYPE_NFIELDS (type); idx++)
3189 printfi_filtered (spaces + 2,
3190 "[%d] bitpos %d bitsize %d type ",
3191 idx, TYPE_FIELD_BITPOS (type, idx),
3192 TYPE_FIELD_BITSIZE (type, idx));
3193 gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout);
3194 printf_filtered (" name '%s' (",
3195 TYPE_FIELD_NAME (type, idx) != NULL
3196 ? TYPE_FIELD_NAME (type, idx)
3198 gdb_print_host_address (TYPE_FIELD_NAME (type, idx), gdb_stdout);
3199 printf_filtered (")\n");
3200 if (TYPE_FIELD_TYPE (type, idx) != NULL)
3202 recursive_dump_type (TYPE_FIELD_TYPE (type, idx), spaces + 4);
3205 printfi_filtered (spaces, "vptr_basetype ");
3206 gdb_print_host_address (TYPE_VPTR_BASETYPE (type), gdb_stdout);
3207 puts_filtered ("\n");
3208 if (TYPE_VPTR_BASETYPE (type) != NULL)
3210 recursive_dump_type (TYPE_VPTR_BASETYPE (type), spaces + 2);
3212 printfi_filtered (spaces, "vptr_fieldno %d\n", TYPE_VPTR_FIELDNO (type));
3213 switch (TYPE_CODE (type))
3215 case TYPE_CODE_STRUCT:
3216 printfi_filtered (spaces, "cplus_stuff ");
3217 gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type), gdb_stdout);
3218 puts_filtered ("\n");
3219 print_cplus_stuff (type, spaces);
3223 printfi_filtered (spaces, "floatformat ");
3224 if (TYPE_FLOATFORMAT (type) == NULL
3225 || TYPE_FLOATFORMAT (type)->name == NULL)
3226 puts_filtered ("(null)");
3228 puts_filtered (TYPE_FLOATFORMAT (type)->name);
3229 puts_filtered ("\n");
3233 /* We have to pick one of the union types to be able print and test
3234 the value. Pick cplus_struct_type, even though we know it isn't
3235 any particular one. */
3236 printfi_filtered (spaces, "type_specific ");
3237 gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type), gdb_stdout);
3238 if (TYPE_CPLUS_SPECIFIC (type) != NULL)
3240 printf_filtered (" (unknown data form)");
3242 printf_filtered ("\n");
3247 obstack_free (&dont_print_type_obstack, NULL);
3250 static void build_gdbtypes (void);
3252 build_gdbtypes (void)
3255 init_type (TYPE_CODE_VOID, 1,
3257 "void", (struct objfile *) NULL);
3259 init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
3261 | (TARGET_CHAR_SIGNED ? 0 : TYPE_FLAG_UNSIGNED)),
3262 "char", (struct objfile *) NULL);
3263 builtin_type_true_char =
3264 init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
3266 "true character", (struct objfile *) NULL);
3267 builtin_type_signed_char =
3268 init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
3270 "signed char", (struct objfile *) NULL);
3271 builtin_type_unsigned_char =
3272 init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
3274 "unsigned char", (struct objfile *) NULL);
3275 builtin_type_short =
3276 init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
3278 "short", (struct objfile *) NULL);
3279 builtin_type_unsigned_short =
3280 init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
3282 "unsigned short", (struct objfile *) NULL);
3284 init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
3286 "int", (struct objfile *) NULL);
3287 builtin_type_unsigned_int =
3288 init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
3290 "unsigned int", (struct objfile *) NULL);
3292 init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
3294 "long", (struct objfile *) NULL);
3295 builtin_type_unsigned_long =
3296 init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
3298 "unsigned long", (struct objfile *) NULL);
3299 builtin_type_long_long =
3300 init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
3302 "long long", (struct objfile *) NULL);
3303 builtin_type_unsigned_long_long =
3304 init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
3306 "unsigned long long", (struct objfile *) NULL);
3307 builtin_type_float =
3308 init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
3310 "float", (struct objfile *) NULL);
3312 The below lines are disabled since they are doing the wrong
3313 thing for non-multiarch targets. They are setting the correct
3314 type of floats for the target but while on multiarch targets
3315 this is done everytime the architecture changes, it's done on
3316 non-multiarch targets only on startup, leaving the wrong values
3317 in even if the architecture changes (eg. from big-endian to
3320 TYPE_FLOATFORMAT (builtin_type_float) = TARGET_FLOAT_FORMAT;
3322 builtin_type_double =
3323 init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
3325 "double", (struct objfile *) NULL);
3327 TYPE_FLOATFORMAT (builtin_type_double) = TARGET_DOUBLE_FORMAT;
3329 builtin_type_long_double =
3330 init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
3332 "long double", (struct objfile *) NULL);
3334 TYPE_FLOATFORMAT (builtin_type_long_double) = TARGET_LONG_DOUBLE_FORMAT;
3336 builtin_type_complex =
3337 init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
3339 "complex", (struct objfile *) NULL);
3340 TYPE_TARGET_TYPE (builtin_type_complex) = builtin_type_float;
3341 builtin_type_double_complex =
3342 init_type (TYPE_CODE_COMPLEX, 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
3344 "double complex", (struct objfile *) NULL);
3345 TYPE_TARGET_TYPE (builtin_type_double_complex) = builtin_type_double;
3346 builtin_type_string =
3347 init_type (TYPE_CODE_STRING, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
3349 "string", (struct objfile *) NULL);
3351 init_type (TYPE_CODE_INT, 8 / 8,
3353 "int8_t", (struct objfile *) NULL);
3354 builtin_type_uint8 =
3355 init_type (TYPE_CODE_INT, 8 / 8,
3357 "uint8_t", (struct objfile *) NULL);
3358 builtin_type_int16 =
3359 init_type (TYPE_CODE_INT, 16 / 8,
3361 "int16_t", (struct objfile *) NULL);
3362 builtin_type_uint16 =
3363 init_type (TYPE_CODE_INT, 16 / 8,
3365 "uint16_t", (struct objfile *) NULL);
3366 builtin_type_int32 =
3367 init_type (TYPE_CODE_INT, 32 / 8,
3369 "int32_t", (struct objfile *) NULL);
3370 builtin_type_uint32 =
3371 init_type (TYPE_CODE_INT, 32 / 8,
3373 "uint32_t", (struct objfile *) NULL);
3374 builtin_type_int64 =
3375 init_type (TYPE_CODE_INT, 64 / 8,
3377 "int64_t", (struct objfile *) NULL);
3378 builtin_type_uint64 =
3379 init_type (TYPE_CODE_INT, 64 / 8,
3381 "uint64_t", (struct objfile *) NULL);
3382 builtin_type_int128 =
3383 init_type (TYPE_CODE_INT, 128 / 8,
3385 "int128_t", (struct objfile *) NULL);
3386 builtin_type_uint128 =
3387 init_type (TYPE_CODE_INT, 128 / 8,
3389 "uint128_t", (struct objfile *) NULL);
3391 init_type (TYPE_CODE_BOOL, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
3393 "bool", (struct objfile *) NULL);
3395 /* Add user knob for controlling resolution of opaque types */
3397 (add_set_cmd ("opaque-type-resolution", class_support, var_boolean, (char *) &opaque_type_resolution,
3398 "Set resolution of opaque struct/class/union types (if set before loading symbols).",
3401 opaque_type_resolution = 1;
3403 /* Build SIMD types. */
3405 = init_simd_type ("__builtin_v4sf", builtin_type_float, "f", 4);
3407 = init_simd_type ("__builtin_v4si", builtin_type_int32, "f", 4);
3409 = init_simd_type ("__builtin_v16qi", builtin_type_int8, "f", 16);
3411 = init_simd_type ("__builtin_v8qi", builtin_type_int8, "f", 8);
3413 = init_simd_type ("__builtin_v8hi", builtin_type_int16, "f", 8);
3415 = init_simd_type ("__builtin_v4hi", builtin_type_int16, "f", 4);
3417 = init_simd_type ("__builtin_v2si", builtin_type_int32, "f", 2);
3419 /* 128 bit vectors. */
3420 builtin_type_v2_double = init_vector_type (builtin_type_double, 2);
3421 builtin_type_v4_float = init_vector_type (builtin_type_float, 4);
3422 builtin_type_v2_int64 = init_vector_type (builtin_type_int64, 2);
3423 builtin_type_v4_int32 = init_vector_type (builtin_type_int32, 4);
3424 builtin_type_v8_int16 = init_vector_type (builtin_type_int16, 8);
3425 builtin_type_v16_int8 = init_vector_type (builtin_type_int8, 16);
3426 /* 64 bit vectors. */
3427 builtin_type_v2_float = init_vector_type (builtin_type_float, 2);
3428 builtin_type_v2_int32 = init_vector_type (builtin_type_int32, 2);
3429 builtin_type_v4_int16 = init_vector_type (builtin_type_int16, 4);
3430 builtin_type_v8_int8 = init_vector_type (builtin_type_int8, 8);
3433 builtin_type_vec64 = build_builtin_type_vec64 ();
3434 builtin_type_vec64i = build_builtin_type_vec64i ();
3435 builtin_type_vec128 = build_builtin_type_vec128 ();
3436 builtin_type_vec128i = build_builtin_type_vec128i ();
3438 /* Pointer/Address types. */
3440 /* NOTE: on some targets, addresses and pointers are not necessarily
3441 the same --- for example, on the D10V, pointers are 16 bits long,
3442 but addresses are 32 bits long. See doc/gdbint.texinfo,
3443 ``Pointers Are Not Always Addresses''.
3446 - gdb's `struct type' always describes the target's
3448 - gdb's `struct value' objects should always hold values in
3450 - gdb's CORE_ADDR values are addresses in the unified virtual
3451 address space that the assembler and linker work with. Thus,
3452 since target_read_memory takes a CORE_ADDR as an argument, it
3453 can access any memory on the target, even if the processor has
3454 separate code and data address spaces.
3457 - If v is a value holding a D10V code pointer, its contents are
3458 in target form: a big-endian address left-shifted two bits.
3459 - If p is a D10V pointer type, TYPE_LENGTH (p) == 2, just as
3460 sizeof (void *) == 2 on the target.
3462 In this context, builtin_type_CORE_ADDR is a bit odd: it's a
3463 target type for a value the target will never see. It's only
3464 used to hold the values of (typeless) linker symbols, which are
3465 indeed in the unified virtual address space. */
3466 builtin_type_void_data_ptr = make_pointer_type (builtin_type_void, NULL);
3467 builtin_type_void_func_ptr
3468 = lookup_pointer_type (lookup_function_type (builtin_type_void));
3469 builtin_type_CORE_ADDR =
3470 init_type (TYPE_CODE_INT, TARGET_ADDR_BIT / 8,
3472 "__CORE_ADDR", (struct objfile *) NULL);
3473 builtin_type_bfd_vma =
3474 init_type (TYPE_CODE_INT, TARGET_BFD_VMA_BIT / 8,
3476 "__bfd_vma", (struct objfile *) NULL);
3479 extern void _initialize_gdbtypes (void);
3481 _initialize_gdbtypes (void)
3483 struct cmd_list_element *c;
3486 /* FIXME - For the moment, handle types by swapping them in and out.
3487 Should be using the per-architecture data-pointer and a large
3489 register_gdbarch_swap (&builtin_type_void, sizeof (struct type *), NULL);
3490 register_gdbarch_swap (&builtin_type_char, sizeof (struct type *), NULL);
3491 register_gdbarch_swap (&builtin_type_short, sizeof (struct type *), NULL);
3492 register_gdbarch_swap (&builtin_type_int, sizeof (struct type *), NULL);
3493 register_gdbarch_swap (&builtin_type_long, sizeof (struct type *), NULL);
3494 register_gdbarch_swap (&builtin_type_long_long, sizeof (struct type *), NULL);
3495 register_gdbarch_swap (&builtin_type_signed_char, sizeof (struct type *), NULL);
3496 register_gdbarch_swap (&builtin_type_unsigned_char, sizeof (struct type *), NULL);
3497 register_gdbarch_swap (&builtin_type_unsigned_short, sizeof (struct type *), NULL);
3498 register_gdbarch_swap (&builtin_type_unsigned_int, sizeof (struct type *), NULL);
3499 register_gdbarch_swap (&builtin_type_unsigned_long, sizeof (struct type *), NULL);
3500 register_gdbarch_swap (&builtin_type_unsigned_long_long, sizeof (struct type *), NULL);
3501 register_gdbarch_swap (&builtin_type_float, sizeof (struct type *), NULL);
3502 register_gdbarch_swap (&builtin_type_double, sizeof (struct type *), NULL);
3503 register_gdbarch_swap (&builtin_type_long_double, sizeof (struct type *), NULL);
3504 register_gdbarch_swap (&builtin_type_complex, sizeof (struct type *), NULL);
3505 register_gdbarch_swap (&builtin_type_double_complex, sizeof (struct type *), NULL);
3506 register_gdbarch_swap (&builtin_type_string, sizeof (struct type *), NULL);
3507 register_gdbarch_swap (&builtin_type_int8, sizeof (struct type *), NULL);
3508 register_gdbarch_swap (&builtin_type_uint8, sizeof (struct type *), NULL);
3509 register_gdbarch_swap (&builtin_type_int16, sizeof (struct type *), NULL);
3510 register_gdbarch_swap (&builtin_type_uint16, sizeof (struct type *), NULL);
3511 register_gdbarch_swap (&builtin_type_int32, sizeof (struct type *), NULL);
3512 register_gdbarch_swap (&builtin_type_uint32, sizeof (struct type *), NULL);
3513 register_gdbarch_swap (&builtin_type_int64, sizeof (struct type *), NULL);
3514 register_gdbarch_swap (&builtin_type_uint64, sizeof (struct type *), NULL);
3515 register_gdbarch_swap (&builtin_type_int128, sizeof (struct type *), NULL);
3516 register_gdbarch_swap (&builtin_type_uint128, sizeof (struct type *), NULL);
3517 register_gdbarch_swap (&builtin_type_v4sf, sizeof (struct type *), NULL);
3518 register_gdbarch_swap (&builtin_type_v4si, sizeof (struct type *), NULL);
3519 register_gdbarch_swap (&builtin_type_v16qi, sizeof (struct type *), NULL);
3520 register_gdbarch_swap (&builtin_type_v8qi, sizeof (struct type *), NULL);
3521 register_gdbarch_swap (&builtin_type_v8hi, sizeof (struct type *), NULL);
3522 register_gdbarch_swap (&builtin_type_v4hi, sizeof (struct type *), NULL);
3523 register_gdbarch_swap (&builtin_type_v2si, sizeof (struct type *), NULL);
3524 register_gdbarch_swap (&builtin_type_v2_double, sizeof (struct type *), NULL);
3525 register_gdbarch_swap (&builtin_type_v4_float, sizeof (struct type *), NULL);
3526 register_gdbarch_swap (&builtin_type_v2_int64, sizeof (struct type *), NULL);
3527 register_gdbarch_swap (&builtin_type_v4_int32, sizeof (struct type *), NULL);
3528 register_gdbarch_swap (&builtin_type_v8_int16, sizeof (struct type *), NULL);
3529 register_gdbarch_swap (&builtin_type_v16_int8, sizeof (struct type *), NULL);
3530 register_gdbarch_swap (&builtin_type_v2_float, sizeof (struct type *), NULL);
3531 register_gdbarch_swap (&builtin_type_v2_int32, sizeof (struct type *), NULL);
3532 register_gdbarch_swap (&builtin_type_v8_int8, sizeof (struct type *), NULL);
3533 register_gdbarch_swap (&builtin_type_v4_int16, sizeof (struct type *), NULL);
3534 register_gdbarch_swap (&builtin_type_vec128, sizeof (struct type *), NULL);
3535 register_gdbarch_swap (&builtin_type_vec128i, sizeof (struct type *), NULL);
3536 REGISTER_GDBARCH_SWAP (builtin_type_void_data_ptr);
3537 REGISTER_GDBARCH_SWAP (builtin_type_void_func_ptr);
3538 REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR);
3539 REGISTER_GDBARCH_SWAP (builtin_type_bfd_vma);
3540 register_gdbarch_swap (NULL, 0, build_gdbtypes);
3542 /* Note: These types do not need to be swapped - they are target
3544 builtin_type_ieee_single_big =
3545 init_type (TYPE_CODE_FLT, floatformat_ieee_single_big.totalsize / 8,
3546 0, "builtin_type_ieee_single_big", NULL);
3547 TYPE_FLOATFORMAT (builtin_type_ieee_single_big) = &floatformat_ieee_single_big;
3548 builtin_type_ieee_single_little =
3549 init_type (TYPE_CODE_FLT, floatformat_ieee_single_little.totalsize / 8,
3550 0, "builtin_type_ieee_single_little", NULL);
3551 TYPE_FLOATFORMAT (builtin_type_ieee_single_little) = &floatformat_ieee_single_little;
3552 builtin_type_ieee_double_big =
3553 init_type (TYPE_CODE_FLT, floatformat_ieee_double_big.totalsize / 8,
3554 0, "builtin_type_ieee_double_big", NULL);
3555 TYPE_FLOATFORMAT (builtin_type_ieee_double_big) = &floatformat_ieee_double_big;
3556 builtin_type_ieee_double_little =
3557 init_type (TYPE_CODE_FLT, floatformat_ieee_double_little.totalsize / 8,
3558 0, "builtin_type_ieee_double_little", NULL);
3559 TYPE_FLOATFORMAT (builtin_type_ieee_double_little) = &floatformat_ieee_double_little;
3560 builtin_type_ieee_double_littlebyte_bigword =
3561 init_type (TYPE_CODE_FLT, floatformat_ieee_double_littlebyte_bigword.totalsize / 8,
3562 0, "builtin_type_ieee_double_littlebyte_bigword", NULL);
3563 TYPE_FLOATFORMAT (builtin_type_ieee_double_littlebyte_bigword) = &floatformat_ieee_double_littlebyte_bigword;
3564 builtin_type_i387_ext =
3565 init_type (TYPE_CODE_FLT, floatformat_i387_ext.totalsize / 8,
3566 0, "builtin_type_i387_ext", NULL);
3567 TYPE_FLOATFORMAT (builtin_type_i387_ext) = &floatformat_i387_ext;
3568 builtin_type_m68881_ext =
3569 init_type (TYPE_CODE_FLT, floatformat_m68881_ext.totalsize / 8,
3570 0, "builtin_type_m68881_ext", NULL);
3571 TYPE_FLOATFORMAT (builtin_type_m68881_ext) = &floatformat_m68881_ext;
3572 builtin_type_i960_ext =
3573 init_type (TYPE_CODE_FLT, floatformat_i960_ext.totalsize / 8,
3574 0, "builtin_type_i960_ext", NULL);
3575 TYPE_FLOATFORMAT (builtin_type_i960_ext) = &floatformat_i960_ext;
3576 builtin_type_m88110_ext =
3577 init_type (TYPE_CODE_FLT, floatformat_m88110_ext.totalsize / 8,
3578 0, "builtin_type_m88110_ext", NULL);
3579 TYPE_FLOATFORMAT (builtin_type_m88110_ext) = &floatformat_m88110_ext;
3580 builtin_type_m88110_harris_ext =
3581 init_type (TYPE_CODE_FLT, floatformat_m88110_harris_ext.totalsize / 8,
3582 0, "builtin_type_m88110_harris_ext", NULL);
3583 TYPE_FLOATFORMAT (builtin_type_m88110_harris_ext) = &floatformat_m88110_harris_ext;
3584 builtin_type_arm_ext_big =
3585 init_type (TYPE_CODE_FLT, floatformat_arm_ext_big.totalsize / 8,
3586 0, "builtin_type_arm_ext_big", NULL);
3587 TYPE_FLOATFORMAT (builtin_type_arm_ext_big) = &floatformat_arm_ext_big;
3588 builtin_type_arm_ext_littlebyte_bigword =
3589 init_type (TYPE_CODE_FLT, floatformat_arm_ext_littlebyte_bigword.totalsize / 8,
3590 0, "builtin_type_arm_ext_littlebyte_bigword", NULL);
3591 TYPE_FLOATFORMAT (builtin_type_arm_ext_littlebyte_bigword) = &floatformat_arm_ext_littlebyte_bigword;
3592 builtin_type_ia64_spill_big =
3593 init_type (TYPE_CODE_FLT, floatformat_ia64_spill_big.totalsize / 8,
3594 0, "builtin_type_ia64_spill_big", NULL);
3595 TYPE_FLOATFORMAT (builtin_type_ia64_spill_big) = &floatformat_ia64_spill_big;
3596 builtin_type_ia64_spill_little =
3597 init_type (TYPE_CODE_FLT, floatformat_ia64_spill_little.totalsize / 8,
3598 0, "builtin_type_ia64_spill_little", NULL);
3599 TYPE_FLOATFORMAT (builtin_type_ia64_spill_little) = &floatformat_ia64_spill_little;
3600 builtin_type_ia64_quad_big =
3601 init_type (TYPE_CODE_FLT, floatformat_ia64_quad_big.totalsize / 8,
3602 0, "builtin_type_ia64_quad_big", NULL);
3603 TYPE_FLOATFORMAT (builtin_type_ia64_quad_big) = &floatformat_ia64_quad_big;
3604 builtin_type_ia64_quad_little =
3605 init_type (TYPE_CODE_FLT, floatformat_ia64_quad_little.totalsize / 8,
3606 0, "builtin_type_ia64_quad_little", NULL);
3607 TYPE_FLOATFORMAT (builtin_type_ia64_quad_little) = &floatformat_ia64_quad_little;
3610 add_set_cmd ("overload", no_class, var_zinteger, (char *) &overload_debug,
3611 "Set debugging of C++ overloading.\n\
3612 When enabled, ranking of the functions\n\
3613 is displayed.", &setdebuglist),