1 /* Support routines for manipulating internal types for GDB.
2 Copyright (C) 1992, 93, 94, 95, 96, 1998 Free Software Foundation, Inc.
3 Contributed by Cygnus Support, using pieces from other GDB modules.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 #include "gdb_string.h"
29 #include "expression.h"
34 #include "complaints.h"
38 /* These variables point to the objects
39 representing the predefined C data types. */
41 struct type
*builtin_type_void
;
42 struct type
*builtin_type_char
;
43 struct type
*builtin_type_true_char
;
44 struct type
*builtin_type_short
;
45 struct type
*builtin_type_int
;
46 struct type
*builtin_type_long
;
47 struct type
*builtin_type_long_long
;
48 struct type
*builtin_type_signed_char
;
49 struct type
*builtin_type_unsigned_char
;
50 struct type
*builtin_type_unsigned_short
;
51 struct type
*builtin_type_unsigned_int
;
52 struct type
*builtin_type_unsigned_long
;
53 struct type
*builtin_type_unsigned_long_long
;
54 struct type
*builtin_type_float
;
55 struct type
*builtin_type_double
;
56 struct type
*builtin_type_long_double
;
57 struct type
*builtin_type_complex
;
58 struct type
*builtin_type_double_complex
;
59 struct type
*builtin_type_string
;
60 struct type
*builtin_type_int8
;
61 struct type
*builtin_type_uint8
;
62 struct type
*builtin_type_int16
;
63 struct type
*builtin_type_uint16
;
64 struct type
*builtin_type_int32
;
65 struct type
*builtin_type_uint32
;
66 struct type
*builtin_type_int64
;
67 struct type
*builtin_type_uint64
;
68 struct type
*builtin_type_bool
;
69 struct type
*builtin_type_v4sf
;
70 struct type
*builtin_type_v4si
;
71 struct type
*builtin_type_v8qi
;
72 struct type
*builtin_type_v4hi
;
73 struct type
*builtin_type_v2si
;
74 struct type
*builtin_type_ptr
;
75 struct type
*builtin_type_CORE_ADDR
;
76 struct type
*builtin_type_bfd_vma
;
78 int opaque_type_resolution
= 1;
79 int overload_debug
= 0;
85 }; /* maximum extention is 128! FIXME */
87 static void add_name (struct extra
*, char *);
88 static void add_mangled_type (struct extra
*, struct type
*);
90 static void cfront_mangle_name (struct type
*, int, int);
92 static void print_bit_vector (B_TYPE
*, int);
93 static void print_arg_types (struct type
**, int);
94 static void dump_fn_fieldlists (struct type
*, int);
95 static void print_cplus_stuff (struct type
*, int);
96 static void virtual_base_list_aux (struct type
*dclass
);
99 /* Alloc a new type structure and fill it with some defaults. If
100 OBJFILE is non-NULL, then allocate the space for the type structure
101 in that objfile's type_obstack. */
105 struct objfile
*objfile
;
107 register struct type
*type
;
109 /* Alloc the structure and start off with all fields zeroed. */
113 type
= (struct type
*) xmalloc (sizeof (struct type
));
117 type
= (struct type
*) obstack_alloc (&objfile
->type_obstack
,
118 sizeof (struct type
));
119 OBJSTAT (objfile
, n_types
++);
121 memset ((char *) type
, 0, sizeof (struct type
));
123 /* Initialize the fields that might not be zero. */
125 TYPE_CODE (type
) = TYPE_CODE_UNDEF
;
126 TYPE_OBJFILE (type
) = objfile
;
127 TYPE_VPTR_FIELDNO (type
) = -1;
128 TYPE_CV_TYPE (type
) = type
; /* chain back to itself */
133 /* Lookup a pointer to a type TYPE. TYPEPTR, if nonzero, points
134 to a pointer to memory where the pointer type should be stored.
135 If *TYPEPTR is zero, update it to point to the pointer type we return.
136 We allocate new memory if needed. */
139 make_pointer_type (type
, typeptr
)
141 struct type
**typeptr
;
143 register struct type
*ntype
; /* New type */
144 struct objfile
*objfile
;
146 ntype
= TYPE_POINTER_TYPE (type
);
151 return ntype
; /* Don't care about alloc, and have new type. */
152 else if (*typeptr
== 0)
154 *typeptr
= ntype
; /* Tracking alloc, and we have new type. */
159 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
161 ntype
= alloc_type (TYPE_OBJFILE (type
));
166 /* We have storage, but need to reset it. */
169 objfile
= TYPE_OBJFILE (ntype
);
170 memset ((char *) ntype
, 0, sizeof (struct type
));
171 TYPE_OBJFILE (ntype
) = objfile
;
174 TYPE_TARGET_TYPE (ntype
) = type
;
175 TYPE_POINTER_TYPE (type
) = ntype
;
177 /* FIXME! Assume the machine has only one representation for pointers! */
179 TYPE_LENGTH (ntype
) = TARGET_PTR_BIT
/ TARGET_CHAR_BIT
;
180 TYPE_CODE (ntype
) = TYPE_CODE_PTR
;
182 /* pointers are unsigned */
183 TYPE_FLAGS (ntype
) |= TYPE_FLAG_UNSIGNED
;
185 if (!TYPE_POINTER_TYPE (type
)) /* Remember it, if don't have one. */
186 TYPE_POINTER_TYPE (type
) = ntype
;
191 /* Given a type TYPE, return a type of pointers to that type.
192 May need to construct such a type if this is the first use. */
195 lookup_pointer_type (type
)
198 return make_pointer_type (type
, (struct type
**) 0);
201 /* Lookup a C++ `reference' to a type TYPE. TYPEPTR, if nonzero, points
202 to a pointer to memory where the reference type should be stored.
203 If *TYPEPTR is zero, update it to point to the reference type we return.
204 We allocate new memory if needed. */
207 make_reference_type (type
, typeptr
)
209 struct type
**typeptr
;
211 register struct type
*ntype
; /* New type */
212 struct objfile
*objfile
;
214 ntype
= TYPE_REFERENCE_TYPE (type
);
219 return ntype
; /* Don't care about alloc, and have new type. */
220 else if (*typeptr
== 0)
222 *typeptr
= ntype
; /* Tracking alloc, and we have new type. */
227 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
229 ntype
= alloc_type (TYPE_OBJFILE (type
));
234 /* We have storage, but need to reset it. */
237 objfile
= TYPE_OBJFILE (ntype
);
238 memset ((char *) ntype
, 0, sizeof (struct type
));
239 TYPE_OBJFILE (ntype
) = objfile
;
242 TYPE_TARGET_TYPE (ntype
) = type
;
243 TYPE_REFERENCE_TYPE (type
) = ntype
;
245 /* FIXME! Assume the machine has only one representation for references,
246 and that it matches the (only) representation for pointers! */
248 TYPE_LENGTH (ntype
) = TARGET_PTR_BIT
/ TARGET_CHAR_BIT
;
249 TYPE_CODE (ntype
) = TYPE_CODE_REF
;
251 if (!TYPE_REFERENCE_TYPE (type
)) /* Remember it, if don't have one. */
252 TYPE_REFERENCE_TYPE (type
) = ntype
;
257 /* Same as above, but caller doesn't care about memory allocation details. */
260 lookup_reference_type (type
)
263 return make_reference_type (type
, (struct type
**) 0);
266 /* Lookup a function type that returns type TYPE. TYPEPTR, if nonzero, points
267 to a pointer to memory where the function type should be stored.
268 If *TYPEPTR is zero, update it to point to the function type we return.
269 We allocate new memory if needed. */
272 make_function_type (type
, typeptr
)
274 struct type
**typeptr
;
276 register struct type
*ntype
; /* New type */
277 struct objfile
*objfile
;
279 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
281 ntype
= alloc_type (TYPE_OBJFILE (type
));
286 /* We have storage, but need to reset it. */
289 objfile
= TYPE_OBJFILE (ntype
);
290 memset ((char *) ntype
, 0, sizeof (struct type
));
291 TYPE_OBJFILE (ntype
) = objfile
;
294 TYPE_TARGET_TYPE (ntype
) = type
;
296 TYPE_LENGTH (ntype
) = 1;
297 TYPE_CODE (ntype
) = TYPE_CODE_FUNC
;
303 /* Given a type TYPE, return a type of functions that return that type.
304 May need to construct such a type if this is the first use. */
307 lookup_function_type (type
)
310 return make_function_type (type
, (struct type
**) 0);
314 /* Make a "c-v" variant of a type -- a type that is identical to the
315 one supplied except that it may have const or volatile attributes
316 CNST is a flag for setting the const attribute
317 VOLTL is a flag for setting the volatile attribute
318 TYPE is the base type whose variant we are creating.
319 TYPEPTR, if nonzero, points
320 to a pointer to memory where the reference type should be stored.
321 If *TYPEPTR is zero, update it to point to the reference type we return.
322 We allocate new memory if needed. */
325 make_cv_type (cnst
, voltl
, type
, typeptr
)
329 struct type
**typeptr
;
331 register struct type
*ntype
; /* New type */
332 register struct type
*tmp_type
= type
; /* tmp type */
333 struct objfile
*objfile
;
335 ntype
= TYPE_CV_TYPE (type
);
337 while (ntype
!= type
)
339 if ((TYPE_CONST (ntype
) == cnst
) &&
340 (TYPE_VOLATILE (ntype
) == voltl
))
344 else if (*typeptr
== 0)
346 *typeptr
= ntype
; /* Tracking alloc, and we have new type. */
351 ntype
= TYPE_CV_TYPE (ntype
);
354 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
356 ntype
= alloc_type (TYPE_OBJFILE (type
));
361 /* We have storage, but need to reset it. */
364 objfile
= TYPE_OBJFILE (ntype
);
365 /* memset ((char *) ntype, 0, sizeof (struct type)); */
366 TYPE_OBJFILE (ntype
) = objfile
;
369 /* Copy original type */
370 memcpy ((char *) ntype
, (char *) type
, sizeof (struct type
));
371 /* But zero out fields that shouldn't be copied */
372 TYPE_POINTER_TYPE (ntype
) = (struct type
*) 0; /* Need new pointer kind */
373 TYPE_REFERENCE_TYPE (ntype
) = (struct type
*) 0; /* Need new referene kind */
374 /* Note: TYPE_TARGET_TYPE can be left as is */
376 /* Set flags appropriately */
378 TYPE_FLAGS (ntype
) |= TYPE_FLAG_CONST
;
380 TYPE_FLAGS (ntype
) &= ~TYPE_FLAG_CONST
;
383 TYPE_FLAGS (ntype
) |= TYPE_FLAG_VOLATILE
;
385 TYPE_FLAGS (ntype
) &= ~TYPE_FLAG_VOLATILE
;
387 /* Fix the chain of cv variants */
388 TYPE_CV_TYPE (ntype
) = type
;
389 TYPE_CV_TYPE (tmp_type
) = ntype
;
397 /* Implement direct support for MEMBER_TYPE in GNU C++.
398 May need to construct such a type if this is the first use.
399 The TYPE is the type of the member. The DOMAIN is the type
400 of the aggregate that the member belongs to. */
403 lookup_member_type (type
, domain
)
407 register struct type
*mtype
;
409 mtype
= alloc_type (TYPE_OBJFILE (type
));
410 smash_to_member_type (mtype
, domain
, type
);
414 /* Allocate a stub method whose return type is TYPE.
415 This apparently happens for speed of symbol reading, since parsing
416 out the arguments to the method is cpu-intensive, the way we are doing
417 it. So, we will fill in arguments later.
418 This always returns a fresh type. */
421 allocate_stub_method (type
)
426 mtype
= alloc_type (TYPE_OBJFILE (type
));
427 TYPE_TARGET_TYPE (mtype
) = type
;
428 /* _DOMAIN_TYPE (mtype) = unknown yet */
429 /* _ARG_TYPES (mtype) = unknown yet */
430 TYPE_FLAGS (mtype
) = TYPE_FLAG_STUB
;
431 TYPE_CODE (mtype
) = TYPE_CODE_METHOD
;
432 TYPE_LENGTH (mtype
) = 1;
436 /* Create a range type using either a blank type supplied in RESULT_TYPE,
437 or creating a new type, inheriting the objfile from INDEX_TYPE.
439 Indices will be of type INDEX_TYPE, and will range from LOW_BOUND to
440 HIGH_BOUND, inclusive.
442 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
443 sure it is TYPE_CODE_UNDEF before we bash it into a range type? */
446 create_range_type (result_type
, index_type
, low_bound
, high_bound
)
447 struct type
*result_type
;
448 struct type
*index_type
;
452 if (result_type
== NULL
)
454 result_type
= alloc_type (TYPE_OBJFILE (index_type
));
456 TYPE_CODE (result_type
) = TYPE_CODE_RANGE
;
457 TYPE_TARGET_TYPE (result_type
) = index_type
;
458 if (TYPE_FLAGS (index_type
) & TYPE_FLAG_STUB
)
459 TYPE_FLAGS (result_type
) |= TYPE_FLAG_TARGET_STUB
;
461 TYPE_LENGTH (result_type
) = TYPE_LENGTH (check_typedef (index_type
));
462 TYPE_NFIELDS (result_type
) = 2;
463 TYPE_FIELDS (result_type
) = (struct field
*)
464 TYPE_ALLOC (result_type
, 2 * sizeof (struct field
));
465 memset (TYPE_FIELDS (result_type
), 0, 2 * sizeof (struct field
));
466 TYPE_FIELD_BITPOS (result_type
, 0) = low_bound
;
467 TYPE_FIELD_BITPOS (result_type
, 1) = high_bound
;
468 TYPE_FIELD_TYPE (result_type
, 0) = builtin_type_int
; /* FIXME */
469 TYPE_FIELD_TYPE (result_type
, 1) = builtin_type_int
; /* FIXME */
472 TYPE_FLAGS (result_type
) |= TYPE_FLAG_UNSIGNED
;
474 return (result_type
);
477 /* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type TYPE.
478 Return 1 of type is a range type, 0 if it is discrete (and bounds
479 will fit in LONGEST), or -1 otherwise. */
482 get_discrete_bounds (type
, lowp
, highp
)
484 LONGEST
*lowp
, *highp
;
486 CHECK_TYPEDEF (type
);
487 switch (TYPE_CODE (type
))
489 case TYPE_CODE_RANGE
:
490 *lowp
= TYPE_LOW_BOUND (type
);
491 *highp
= TYPE_HIGH_BOUND (type
);
494 if (TYPE_NFIELDS (type
) > 0)
496 /* The enums may not be sorted by value, so search all
500 *lowp
= *highp
= TYPE_FIELD_BITPOS (type
, 0);
501 for (i
= 0; i
< TYPE_NFIELDS (type
); i
++)
503 if (TYPE_FIELD_BITPOS (type
, i
) < *lowp
)
504 *lowp
= TYPE_FIELD_BITPOS (type
, i
);
505 if (TYPE_FIELD_BITPOS (type
, i
) > *highp
)
506 *highp
= TYPE_FIELD_BITPOS (type
, i
);
509 /* Set unsigned indicator if warranted. */
512 TYPE_FLAGS (type
) |= TYPE_FLAG_UNSIGNED
;
526 if (TYPE_LENGTH (type
) > sizeof (LONGEST
)) /* Too big */
528 if (!TYPE_UNSIGNED (type
))
530 *lowp
= -(1 << (TYPE_LENGTH (type
) * TARGET_CHAR_BIT
- 1));
534 /* ... fall through for unsigned ints ... */
537 /* This round-about calculation is to avoid shifting by
538 TYPE_LENGTH (type) * TARGET_CHAR_BIT, which will not work
539 if TYPE_LENGTH (type) == sizeof (LONGEST). */
540 *highp
= 1 << (TYPE_LENGTH (type
) * TARGET_CHAR_BIT
- 1);
541 *highp
= (*highp
- 1) | *highp
;
548 /* Create an array type using either a blank type supplied in RESULT_TYPE,
549 or creating a new type, inheriting the objfile from RANGE_TYPE.
551 Elements will be of type ELEMENT_TYPE, the indices will be of type
554 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
555 sure it is TYPE_CODE_UNDEF before we bash it into an array type? */
558 create_array_type (result_type
, element_type
, range_type
)
559 struct type
*result_type
;
560 struct type
*element_type
;
561 struct type
*range_type
;
563 LONGEST low_bound
, high_bound
;
565 if (result_type
== NULL
)
567 result_type
= alloc_type (TYPE_OBJFILE (range_type
));
569 TYPE_CODE (result_type
) = TYPE_CODE_ARRAY
;
570 TYPE_TARGET_TYPE (result_type
) = element_type
;
571 if (get_discrete_bounds (range_type
, &low_bound
, &high_bound
) < 0)
572 low_bound
= high_bound
= 0;
573 CHECK_TYPEDEF (element_type
);
574 TYPE_LENGTH (result_type
) =
575 TYPE_LENGTH (element_type
) * (high_bound
- low_bound
+ 1);
576 TYPE_NFIELDS (result_type
) = 1;
577 TYPE_FIELDS (result_type
) =
578 (struct field
*) TYPE_ALLOC (result_type
, sizeof (struct field
));
579 memset (TYPE_FIELDS (result_type
), 0, sizeof (struct field
));
580 TYPE_FIELD_TYPE (result_type
, 0) = range_type
;
581 TYPE_VPTR_FIELDNO (result_type
) = -1;
583 /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays */
584 if (TYPE_LENGTH (result_type
) == 0)
585 TYPE_FLAGS (result_type
) |= TYPE_FLAG_TARGET_STUB
;
587 return (result_type
);
590 /* Create a string type using either a blank type supplied in RESULT_TYPE,
591 or creating a new type. String types are similar enough to array of
592 char types that we can use create_array_type to build the basic type
593 and then bash it into a string type.
595 For fixed length strings, the range type contains 0 as the lower
596 bound and the length of the string minus one as the upper bound.
598 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
599 sure it is TYPE_CODE_UNDEF before we bash it into a string type? */
602 create_string_type (result_type
, range_type
)
603 struct type
*result_type
;
604 struct type
*range_type
;
606 result_type
= create_array_type (result_type
,
607 *current_language
->string_char_type
,
609 TYPE_CODE (result_type
) = TYPE_CODE_STRING
;
610 return (result_type
);
614 create_set_type (result_type
, domain_type
)
615 struct type
*result_type
;
616 struct type
*domain_type
;
618 LONGEST low_bound
, high_bound
, bit_length
;
619 if (result_type
== NULL
)
621 result_type
= alloc_type (TYPE_OBJFILE (domain_type
));
623 TYPE_CODE (result_type
) = TYPE_CODE_SET
;
624 TYPE_NFIELDS (result_type
) = 1;
625 TYPE_FIELDS (result_type
) = (struct field
*)
626 TYPE_ALLOC (result_type
, 1 * sizeof (struct field
));
627 memset (TYPE_FIELDS (result_type
), 0, sizeof (struct field
));
629 if (!(TYPE_FLAGS (domain_type
) & TYPE_FLAG_STUB
))
631 if (get_discrete_bounds (domain_type
, &low_bound
, &high_bound
) < 0)
632 low_bound
= high_bound
= 0;
633 bit_length
= high_bound
- low_bound
+ 1;
634 TYPE_LENGTH (result_type
)
635 = (bit_length
+ TARGET_CHAR_BIT
- 1) / TARGET_CHAR_BIT
;
637 TYPE_FIELD_TYPE (result_type
, 0) = domain_type
;
640 TYPE_FLAGS (result_type
) |= TYPE_FLAG_UNSIGNED
;
642 return (result_type
);
646 /* Construct and return a type of the form:
647 struct NAME { ELT_TYPE ELT_NAME[N]; }
648 We use these types for SIMD registers. For example, the type of
649 the SSE registers on the late x86-family processors is:
650 struct __builtin_v4sf { float f[4]; }
651 built by the function call:
652 init_simd_type ("__builtin_v4sf", builtin_type_float, "f", 4)
653 The type returned is a permanent type, allocated using malloc; it
654 doesn't live in any objfile's obstack. */
656 init_simd_type (char *name
,
657 struct type
*elt_type
,
664 /* Build the field structure. */
665 f
= xmalloc (sizeof (*f
));
666 memset (f
, 0, sizeof (*f
));
668 f
->type
= create_array_type (0, elt_type
,
669 create_range_type (0, builtin_type_int
,
673 /* Build a struct type with that field. */
674 t
= init_type (TYPE_CODE_STRUCT
, n
* TYPE_LENGTH (elt_type
), 0, 0, 0);
683 /* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE.
684 A MEMBER is a wierd thing -- it amounts to a typed offset into
685 a struct, e.g. "an int at offset 8". A MEMBER TYPE doesn't
686 include the offset (that's the value of the MEMBER itself), but does
687 include the structure type into which it points (for some reason).
689 When "smashing" the type, we preserve the objfile that the
690 old type pointed to, since we aren't changing where the type is actually
694 smash_to_member_type (type
, domain
, to_type
)
697 struct type
*to_type
;
699 struct objfile
*objfile
;
701 objfile
= TYPE_OBJFILE (type
);
703 memset ((char *) type
, 0, sizeof (struct type
));
704 TYPE_OBJFILE (type
) = objfile
;
705 TYPE_TARGET_TYPE (type
) = to_type
;
706 TYPE_DOMAIN_TYPE (type
) = domain
;
707 TYPE_LENGTH (type
) = 1; /* In practice, this is never needed. */
708 TYPE_CODE (type
) = TYPE_CODE_MEMBER
;
711 /* Smash TYPE to be a type of method of DOMAIN with type TO_TYPE.
712 METHOD just means `function that gets an extra "this" argument'.
714 When "smashing" the type, we preserve the objfile that the
715 old type pointed to, since we aren't changing where the type is actually
719 smash_to_method_type (type
, domain
, to_type
, args
)
722 struct type
*to_type
;
725 struct objfile
*objfile
;
727 objfile
= TYPE_OBJFILE (type
);
729 memset ((char *) type
, 0, sizeof (struct type
));
730 TYPE_OBJFILE (type
) = objfile
;
731 TYPE_TARGET_TYPE (type
) = to_type
;
732 TYPE_DOMAIN_TYPE (type
) = domain
;
733 TYPE_ARG_TYPES (type
) = args
;
734 TYPE_LENGTH (type
) = 1; /* In practice, this is never needed. */
735 TYPE_CODE (type
) = TYPE_CODE_METHOD
;
738 /* Return a typename for a struct/union/enum type without "struct ",
739 "union ", or "enum ". If the type has a NULL name, return NULL. */
742 type_name_no_tag (type
)
743 register const struct type
*type
;
745 if (TYPE_TAG_NAME (type
) != NULL
)
746 return TYPE_TAG_NAME (type
);
748 /* Is there code which expects this to return the name if there is no
749 tag name? My guess is that this is mainly used for C++ in cases where
750 the two will always be the same. */
751 return TYPE_NAME (type
);
754 /* Lookup a primitive type named NAME.
755 Return zero if NAME is not a primitive type. */
758 lookup_primitive_typename (name
)
761 struct type
**const *p
;
763 for (p
= current_language
->la_builtin_type_vector
; *p
!= NULL
; p
++)
765 if (STREQ ((**p
)->name
, name
))
773 /* Lookup a typedef or primitive type named NAME,
774 visible in lexical block BLOCK.
775 If NOERR is nonzero, return zero if NAME is not suitably defined. */
778 lookup_typename (name
, block
, noerr
)
783 register struct symbol
*sym
;
784 register struct type
*tmp
;
786 sym
= lookup_symbol (name
, block
, VAR_NAMESPACE
, 0, (struct symtab
**) NULL
);
787 if (sym
== NULL
|| SYMBOL_CLASS (sym
) != LOC_TYPEDEF
)
789 tmp
= lookup_primitive_typename (name
);
794 else if (!tmp
&& noerr
)
800 error ("No type named %s.", name
);
803 return (SYMBOL_TYPE (sym
));
807 lookup_unsigned_typename (name
)
810 char *uns
= alloca (strlen (name
) + 10);
812 strcpy (uns
, "unsigned ");
813 strcpy (uns
+ 9, name
);
814 return (lookup_typename (uns
, (struct block
*) NULL
, 0));
818 lookup_signed_typename (name
)
822 char *uns
= alloca (strlen (name
) + 8);
824 strcpy (uns
, "signed ");
825 strcpy (uns
+ 7, name
);
826 t
= lookup_typename (uns
, (struct block
*) NULL
, 1);
827 /* If we don't find "signed FOO" just try again with plain "FOO". */
830 return lookup_typename (name
, (struct block
*) NULL
, 0);
833 /* Lookup a structure type named "struct NAME",
834 visible in lexical block BLOCK. */
837 lookup_struct (name
, block
)
841 register struct symbol
*sym
;
843 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
844 (struct symtab
**) NULL
);
848 error ("No struct type named %s.", name
);
850 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
852 error ("This context has class, union or enum %s, not a struct.", name
);
854 return (SYMBOL_TYPE (sym
));
857 /* Lookup a union type named "union NAME",
858 visible in lexical block BLOCK. */
861 lookup_union (name
, block
)
865 register struct symbol
*sym
;
868 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
869 (struct symtab
**) NULL
);
872 error ("No union type named %s.", name
);
874 t
= SYMBOL_TYPE (sym
);
876 if (TYPE_CODE (t
) == TYPE_CODE_UNION
)
879 /* C++ unions may come out with TYPE_CODE_CLASS, but we look at
880 * a further "declared_type" field to discover it is really a union.
882 if (HAVE_CPLUS_STRUCT (t
))
883 if (TYPE_DECLARED_TYPE (t
) == DECLARED_TYPE_UNION
)
886 /* If we get here, it's not a union */
887 error ("This context has class, struct or enum %s, not a union.", name
);
891 /* Lookup an enum type named "enum NAME",
892 visible in lexical block BLOCK. */
895 lookup_enum (name
, block
)
899 register struct symbol
*sym
;
901 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
902 (struct symtab
**) NULL
);
905 error ("No enum type named %s.", name
);
907 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_ENUM
)
909 error ("This context has class, struct or union %s, not an enum.", name
);
911 return (SYMBOL_TYPE (sym
));
914 /* Lookup a template type named "template NAME<TYPE>",
915 visible in lexical block BLOCK. */
918 lookup_template_type (name
, type
, block
)
924 char *nam
= (char *) alloca (strlen (name
) + strlen (type
->name
) + 4);
927 strcat (nam
, type
->name
);
928 strcat (nam
, " >"); /* FIXME, extra space still introduced in gcc? */
930 sym
= lookup_symbol (nam
, block
, VAR_NAMESPACE
, 0, (struct symtab
**) NULL
);
934 error ("No template type named %s.", name
);
936 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
938 error ("This context has class, union or enum %s, not a struct.", name
);
940 return (SYMBOL_TYPE (sym
));
943 /* Given a type TYPE, lookup the type of the component of type named NAME.
945 TYPE can be either a struct or union, or a pointer or reference to a struct or
946 union. If it is a pointer or reference, its target type is automatically used.
947 Thus '.' and '->' are interchangable, as specified for the definitions of the
948 expression element types STRUCTOP_STRUCT and STRUCTOP_PTR.
950 If NOERR is nonzero, return zero if NAME is not suitably defined.
951 If NAME is the name of a baseclass type, return that type. */
954 lookup_struct_elt_type (type
, name
, noerr
)
963 CHECK_TYPEDEF (type
);
964 if (TYPE_CODE (type
) != TYPE_CODE_PTR
965 && TYPE_CODE (type
) != TYPE_CODE_REF
)
967 type
= TYPE_TARGET_TYPE (type
);
970 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
&&
971 TYPE_CODE (type
) != TYPE_CODE_UNION
)
973 target_terminal_ours ();
974 gdb_flush (gdb_stdout
);
975 fprintf_unfiltered (gdb_stderr
, "Type ");
976 type_print (type
, "", gdb_stderr
, -1);
977 error (" is not a structure or union type.");
981 /* FIXME: This change put in by Michael seems incorrect for the case where
982 the structure tag name is the same as the member name. I.E. when doing
983 "ptype bell->bar" for "struct foo { int bar; int foo; } bell;"
988 typename
= type_name_no_tag (type
);
989 if (typename
!= NULL
&& STREQ (typename
, name
))
994 for (i
= TYPE_NFIELDS (type
) - 1; i
>= TYPE_N_BASECLASSES (type
); i
--)
996 char *t_field_name
= TYPE_FIELD_NAME (type
, i
);
998 if (t_field_name
&& (strcmp_iw (t_field_name
, name
) == 0))
1000 return TYPE_FIELD_TYPE (type
, i
);
1004 /* OK, it's not in this class. Recursively check the baseclasses. */
1005 for (i
= TYPE_N_BASECLASSES (type
) - 1; i
>= 0; i
--)
1009 t
= lookup_struct_elt_type (TYPE_BASECLASS (type
, i
), name
, noerr
);
1021 target_terminal_ours ();
1022 gdb_flush (gdb_stdout
);
1023 fprintf_unfiltered (gdb_stderr
, "Type ");
1024 type_print (type
, "", gdb_stderr
, -1);
1025 fprintf_unfiltered (gdb_stderr
, " has no component named ");
1026 fputs_filtered (name
, gdb_stderr
);
1028 return (struct type
*) -1; /* For lint */
1031 /* If possible, make the vptr_fieldno and vptr_basetype fields of TYPE
1032 valid. Callers should be aware that in some cases (for example,
1033 the type or one of its baseclasses is a stub type and we are
1034 debugging a .o file), this function will not be able to find the virtual
1035 function table pointer, and vptr_fieldno will remain -1 and vptr_basetype
1036 will remain NULL. */
1039 fill_in_vptr_fieldno (type
)
1042 CHECK_TYPEDEF (type
);
1044 if (TYPE_VPTR_FIELDNO (type
) < 0)
1048 /* We must start at zero in case the first (and only) baseclass is
1049 virtual (and hence we cannot share the table pointer). */
1050 for (i
= 0; i
< TYPE_N_BASECLASSES (type
); i
++)
1052 fill_in_vptr_fieldno (TYPE_BASECLASS (type
, i
));
1053 if (TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type
, i
)) >= 0)
1055 TYPE_VPTR_FIELDNO (type
)
1056 = TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type
, i
));
1057 TYPE_VPTR_BASETYPE (type
)
1058 = TYPE_VPTR_BASETYPE (TYPE_BASECLASS (type
, i
));
1065 /* Find the method and field indices for the destructor in class type T.
1066 Return 1 if the destructor was found, otherwise, return 0. */
1069 get_destructor_fn_field (t
, method_indexp
, field_indexp
)
1076 for (i
= 0; i
< TYPE_NFN_FIELDS (t
); i
++)
1079 struct fn_field
*f
= TYPE_FN_FIELDLIST1 (t
, i
);
1081 for (j
= 0; j
< TYPE_FN_FIELDLIST_LENGTH (t
, i
); j
++)
1083 if (DESTRUCTOR_PREFIX_P (TYPE_FN_FIELD_PHYSNAME (f
, j
)))
1094 /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989.
1096 If this is a stubbed struct (i.e. declared as struct foo *), see if
1097 we can find a full definition in some other file. If so, copy this
1098 definition, so we can use it in future. There used to be a comment (but
1099 not any code) that if we don't find a full definition, we'd set a flag
1100 so we don't spend time in the future checking the same type. That would
1101 be a mistake, though--we might load in more symbols which contain a
1102 full definition for the type.
1104 This used to be coded as a macro, but I don't think it is called
1105 often enough to merit such treatment. */
1107 struct complaint stub_noname_complaint
=
1108 {"stub type has NULL name", 0, 0};
1111 check_typedef (type
)
1112 register struct type
*type
;
1114 struct type
*orig_type
= type
;
1115 while (TYPE_CODE (type
) == TYPE_CODE_TYPEDEF
)
1117 if (!TYPE_TARGET_TYPE (type
))
1122 /* It is dangerous to call lookup_symbol if we are currently
1123 reading a symtab. Infinite recursion is one danger. */
1124 if (currently_reading_symtab
)
1127 name
= type_name_no_tag (type
);
1128 /* FIXME: shouldn't we separately check the TYPE_NAME and the
1129 TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE
1130 as appropriate? (this code was written before TYPE_NAME and
1131 TYPE_TAG_NAME were separate). */
1134 complain (&stub_noname_complaint
);
1137 sym
= lookup_symbol (name
, 0, STRUCT_NAMESPACE
, 0,
1138 (struct symtab
**) NULL
);
1140 TYPE_TARGET_TYPE (type
) = SYMBOL_TYPE (sym
);
1142 TYPE_TARGET_TYPE (type
) = alloc_type (NULL
); /* TYPE_CODE_UNDEF */
1144 type
= TYPE_TARGET_TYPE (type
);
1147 /* If this is a struct/class/union with no fields, then check whether a
1148 full definition exists somewhere else. This is for systems where a
1149 type definition with no fields is issued for such types, instead of
1150 identifying them as stub types in the first place */
1152 if (TYPE_IS_OPAQUE (type
) && opaque_type_resolution
&& !currently_reading_symtab
)
1154 char *name
= type_name_no_tag (type
);
1155 struct type
*newtype
;
1158 complain (&stub_noname_complaint
);
1161 newtype
= lookup_transparent_type (name
);
1164 memcpy ((char *) type
, (char *) newtype
, sizeof (struct type
));
1167 /* Otherwise, rely on the stub flag being set for opaque/stubbed types */
1168 else if ((TYPE_FLAGS (type
) & TYPE_FLAG_STUB
) && !currently_reading_symtab
)
1170 char *name
= type_name_no_tag (type
);
1171 /* FIXME: shouldn't we separately check the TYPE_NAME and the
1172 TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE
1173 as appropriate? (this code was written before TYPE_NAME and
1174 TYPE_TAG_NAME were separate). */
1178 complain (&stub_noname_complaint
);
1181 sym
= lookup_symbol (name
, 0, STRUCT_NAMESPACE
, 0, (struct symtab
**) NULL
);
1184 memcpy ((char *) type
, (char *) SYMBOL_TYPE (sym
), sizeof (struct type
));
1188 if (TYPE_FLAGS (type
) & TYPE_FLAG_TARGET_STUB
)
1190 struct type
*range_type
;
1191 struct type
*target_type
= check_typedef (TYPE_TARGET_TYPE (type
));
1193 if (TYPE_FLAGS (target_type
) & (TYPE_FLAG_STUB
| TYPE_FLAG_TARGET_STUB
))
1196 else if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
1197 && TYPE_NFIELDS (type
) == 1
1198 && (TYPE_CODE (range_type
= TYPE_FIELD_TYPE (type
, 0))
1199 == TYPE_CODE_RANGE
))
1201 /* Now recompute the length of the array type, based on its
1202 number of elements and the target type's length. */
1203 TYPE_LENGTH (type
) =
1204 ((TYPE_FIELD_BITPOS (range_type
, 1)
1205 - TYPE_FIELD_BITPOS (range_type
, 0)
1207 * TYPE_LENGTH (target_type
));
1208 TYPE_FLAGS (type
) &= ~TYPE_FLAG_TARGET_STUB
;
1210 else if (TYPE_CODE (type
) == TYPE_CODE_RANGE
)
1212 TYPE_LENGTH (type
) = TYPE_LENGTH (target_type
);
1213 TYPE_FLAGS (type
) &= ~TYPE_FLAG_TARGET_STUB
;
1216 /* Cache TYPE_LENGTH for future use. */
1217 TYPE_LENGTH (orig_type
) = TYPE_LENGTH (type
);
1221 /* New code added to support parsing of Cfront stabs strings */
1223 #define INIT_EXTRA { pextras->len=0; pextras->str[0]='\0'; }
1224 #define ADD_EXTRA(c) { pextras->str[pextras->len++]=c; }
1227 add_name (pextras
, n
)
1228 struct extra
*pextras
;
1233 if ((nlen
= (n
? strlen (n
) : 0)) == 0)
1235 sprintf (pextras
->str
+ pextras
->len
, "%d%s", nlen
, n
);
1236 pextras
->len
= strlen (pextras
->str
);
1240 add_mangled_type (pextras
, t
)
1241 struct extra
*pextras
;
1244 enum type_code tcode
;
1248 tcode
= TYPE_CODE (t
);
1249 tlen
= TYPE_LENGTH (t
);
1250 tflags
= TYPE_FLAGS (t
);
1251 tname
= TYPE_NAME (t
);
1252 /* args of "..." seem to get mangled as "e" */
1270 if ((pname
= strrchr (tname
, 'l'), pname
) && !strcmp (pname
, "long"))
1283 static struct complaint msg
=
1284 {"Bad int type code length x%x\n", 0, 0};
1286 complain (&msg
, tlen
);
1305 static struct complaint msg
=
1306 {"Bad float type code length x%x\n", 0, 0};
1307 complain (&msg
, tlen
);
1313 /* followed by what it's a ref to */
1317 /* followed by what it's a ptr to */
1319 case TYPE_CODE_TYPEDEF
:
1321 static struct complaint msg
=
1322 {"Typedefs in overloaded functions not yet supported\n", 0, 0};
1325 /* followed by type bytes & name */
1327 case TYPE_CODE_FUNC
:
1329 /* followed by func's arg '_' & ret types */
1331 case TYPE_CODE_VOID
:
1334 case TYPE_CODE_METHOD
:
1336 /* followed by name of class and func's arg '_' & ret types */
1337 add_name (pextras
, tname
);
1338 ADD_EXTRA ('F'); /* then mangle function */
1340 case TYPE_CODE_STRUCT
: /* C struct */
1341 case TYPE_CODE_UNION
: /* C union */
1342 case TYPE_CODE_ENUM
: /* Enumeration type */
1343 /* followed by name of type */
1344 add_name (pextras
, tname
);
1347 /* errors possible types/not supported */
1348 case TYPE_CODE_CHAR
:
1349 case TYPE_CODE_ARRAY
: /* Array type */
1350 case TYPE_CODE_MEMBER
: /* Member type */
1351 case TYPE_CODE_BOOL
:
1352 case TYPE_CODE_COMPLEX
: /* Complex float */
1353 case TYPE_CODE_UNDEF
:
1354 case TYPE_CODE_SET
: /* Pascal sets */
1355 case TYPE_CODE_RANGE
:
1356 case TYPE_CODE_STRING
:
1357 case TYPE_CODE_BITSTRING
:
1358 case TYPE_CODE_ERROR
:
1361 static struct complaint msg
=
1362 {"Unknown type code x%x\n", 0, 0};
1363 complain (&msg
, tcode
);
1367 add_mangled_type (pextras
, t
->target_type
);
1372 cfront_mangle_name (type
, i
, j
)
1378 char *mangled_name
= gdb_mangle_name (type
, i
, j
);
1380 f
= TYPE_FN_FIELDLIST1 (type
, i
); /* moved from below */
1382 /* kludge to support cfront methods - gdb expects to find "F" for
1383 ARM_mangled names, so when we mangle, we have to add it here */
1387 char *arm_mangled_name
;
1388 struct fn_field
*method
= &f
[j
];
1389 char *field_name
= TYPE_FN_FIELDLIST_NAME (type
, i
);
1390 char *physname
= TYPE_FN_FIELD_PHYSNAME (f
, j
);
1391 char *newname
= type_name_no_tag (type
);
1393 struct type
*ftype
= TYPE_FN_FIELD_TYPE (f
, j
);
1394 int nargs
= TYPE_NFIELDS (ftype
); /* number of args */
1395 struct extra extras
, *pextras
= &extras
;
1398 if (TYPE_FN_FIELD_STATIC_P (f
, j
)) /* j for sublist within this list */
1401 /* add args here! */
1402 if (nargs
<= 1) /* no args besides this */
1406 for (k
= 1; k
< nargs
; k
++)
1409 t
= TYPE_FIELD_TYPE (ftype
, k
);
1410 add_mangled_type (pextras
, t
);
1414 printf ("add_mangled_type: %s\n", extras
.str
); /* FIXME */
1415 arm_mangled_name
= malloc (strlen (mangled_name
) + extras
.len
);
1416 sprintf (arm_mangled_name
, "%s%s", mangled_name
, extras
.str
);
1417 free (mangled_name
);
1418 mangled_name
= arm_mangled_name
;
1424 /* End of new code added to support parsing of Cfront stabs strings */
1426 /* Parse a type expression in the string [P..P+LENGTH). If an error occurs,
1427 silently return builtin_type_void. */
1430 safe_parse_type (char *p
, int length
)
1432 struct ui_file
*saved_gdb_stderr
;
1435 /* Suppress error messages. */
1436 saved_gdb_stderr
= gdb_stderr
;
1437 gdb_stderr
= ui_file_new ();
1439 /* Call parse_and_eval_type() without fear of longjmp()s. */
1440 if (!gdb_parse_and_eval_type (p
, length
, &type
))
1441 type
= builtin_type_void
;
1443 /* Stop suppressing error messages. */
1444 ui_file_delete (gdb_stderr
);
1445 gdb_stderr
= saved_gdb_stderr
;
1450 /* Ugly hack to convert method stubs into method types.
1452 He ain't kiddin'. This demangles the name of the method into a string
1453 including argument types, parses out each argument type, generates
1454 a string casting a zero to that type, evaluates the string, and stuffs
1455 the resulting type into an argtype vector!!! Then it knows the type
1456 of the whole function (including argument types for overloading),
1457 which info used to be in the stab's but was removed to hack back
1458 the space required for them. */
1461 check_stub_method (type
, method_id
, signature_id
)
1467 char *mangled_name
= gdb_mangle_name (type
, method_id
, signature_id
);
1468 char *demangled_name
= cplus_demangle (mangled_name
,
1469 DMGL_PARAMS
| DMGL_ANSI
);
1470 char *argtypetext
, *p
;
1471 int depth
= 0, argcount
= 1;
1472 struct type
**argtypes
;
1475 /* Make sure we got back a function string that we can use. */
1477 p
= strchr (demangled_name
, '(');
1479 if (demangled_name
== NULL
|| p
== NULL
)
1480 error ("Internal: Cannot demangle mangled name `%s'.", mangled_name
);
1482 /* Now, read in the parameters that define this type. */
1487 if (*p
== '(' || *p
== '<')
1491 else if (*p
== ')' || *p
== '>')
1495 else if (*p
== ',' && depth
== 0)
1503 /* We need two more slots: one for the THIS pointer, and one for the
1504 NULL [...] or void [end of arglist]. */
1506 argtypes
= (struct type
**)
1507 TYPE_ALLOC (type
, (argcount
+ 2) * sizeof (struct type
*));
1509 /* FIXME: This is wrong for static member functions. */
1510 argtypes
[0] = lookup_pointer_type (type
);
1513 if (*p
!= ')') /* () means no args, skip while */
1518 if (depth
<= 0 && (*p
== ',' || *p
== ')'))
1520 /* Avoid parsing of ellipsis, they will be handled below. */
1521 if (strncmp (argtypetext
, "...", p
- argtypetext
) != 0)
1523 argtypes
[argcount
] =
1524 safe_parse_type (argtypetext
, p
- argtypetext
);
1527 argtypetext
= p
+ 1;
1530 if (*p
== '(' || *p
== '<')
1534 else if (*p
== ')' || *p
== '>')
1543 if (p
[-2] != '.') /* Not '...' */
1545 argtypes
[argcount
] = builtin_type_void
; /* List terminator */
1549 argtypes
[argcount
] = NULL
; /* Ellist terminator */
1552 free (demangled_name
);
1554 f
= TYPE_FN_FIELDLIST1 (type
, method_id
);
1556 TYPE_FN_FIELD_PHYSNAME (f
, signature_id
) = mangled_name
;
1558 /* Now update the old "stub" type into a real type. */
1559 mtype
= TYPE_FN_FIELD_TYPE (f
, signature_id
);
1560 TYPE_DOMAIN_TYPE (mtype
) = type
;
1561 TYPE_ARG_TYPES (mtype
) = argtypes
;
1562 TYPE_FLAGS (mtype
) &= ~TYPE_FLAG_STUB
;
1563 TYPE_FN_FIELD_STUB (f
, signature_id
) = 0;
1566 const struct cplus_struct_type cplus_struct_default
;
1569 allocate_cplus_struct_type (type
)
1572 if (!HAVE_CPLUS_STRUCT (type
))
1574 TYPE_CPLUS_SPECIFIC (type
) = (struct cplus_struct_type
*)
1575 TYPE_ALLOC (type
, sizeof (struct cplus_struct_type
));
1576 *(TYPE_CPLUS_SPECIFIC (type
)) = cplus_struct_default
;
1580 /* Helper function to initialize the standard scalar types.
1582 If NAME is non-NULL and OBJFILE is non-NULL, then we make a copy
1583 of the string pointed to by name in the type_obstack for that objfile,
1584 and initialize the type name to that copy. There are places (mipsread.c
1585 in particular, where init_type is called with a NULL value for NAME). */
1588 init_type (code
, length
, flags
, name
, objfile
)
1589 enum type_code code
;
1593 struct objfile
*objfile
;
1595 register struct type
*type
;
1597 type
= alloc_type (objfile
);
1598 TYPE_CODE (type
) = code
;
1599 TYPE_LENGTH (type
) = length
;
1600 TYPE_FLAGS (type
) |= flags
;
1601 if ((name
!= NULL
) && (objfile
!= NULL
))
1604 obsavestring (name
, strlen (name
), &objfile
->type_obstack
);
1608 TYPE_NAME (type
) = name
;
1613 if (code
== TYPE_CODE_STRUCT
|| code
== TYPE_CODE_UNION
)
1615 INIT_CPLUS_SPECIFIC (type
);
1620 /* Look up a fundamental type for the specified objfile.
1621 May need to construct such a type if this is the first use.
1623 Some object file formats (ELF, COFF, etc) do not define fundamental
1624 types such as "int" or "double". Others (stabs for example), do
1625 define fundamental types.
1627 For the formats which don't provide fundamental types, gdb can create
1628 such types, using defaults reasonable for the current language and
1629 the current target machine.
1631 NOTE: This routine is obsolescent. Each debugging format reader
1632 should manage it's own fundamental types, either creating them from
1633 suitable defaults or reading them from the debugging information,
1634 whichever is appropriate. The DWARF reader has already been
1635 fixed to do this. Once the other readers are fixed, this routine
1636 will go away. Also note that fundamental types should be managed
1637 on a compilation unit basis in a multi-language environment, not
1638 on a linkage unit basis as is done here. */
1642 lookup_fundamental_type (objfile
, typeid)
1643 struct objfile
*objfile
;
1646 register struct type
**typep
;
1647 register int nbytes
;
1649 if (typeid < 0 || typeid >= FT_NUM_MEMBERS
)
1651 error ("internal error - invalid fundamental type id %d", typeid);
1654 /* If this is the first time we need a fundamental type for this objfile
1655 then we need to initialize the vector of type pointers. */
1657 if (objfile
->fundamental_types
== NULL
)
1659 nbytes
= FT_NUM_MEMBERS
* sizeof (struct type
*);
1660 objfile
->fundamental_types
= (struct type
**)
1661 obstack_alloc (&objfile
->type_obstack
, nbytes
);
1662 memset ((char *) objfile
->fundamental_types
, 0, nbytes
);
1663 OBJSTAT (objfile
, n_types
+= FT_NUM_MEMBERS
);
1666 /* Look for this particular type in the fundamental type vector. If one is
1667 not found, create and install one appropriate for the current language. */
1669 typep
= objfile
->fundamental_types
+ typeid;
1672 *typep
= create_fundamental_type (objfile
, typeid);
1682 /* FIXME: Should we return true for references as well as pointers? */
1686 && TYPE_CODE (t
) == TYPE_CODE_PTR
1687 && TYPE_CODE (TYPE_TARGET_TYPE (t
)) != TYPE_CODE_VOID
);
1691 is_integral_type (t
)
1697 && ((TYPE_CODE (t
) == TYPE_CODE_INT
)
1698 || (TYPE_CODE (t
) == TYPE_CODE_ENUM
)
1699 || (TYPE_CODE (t
) == TYPE_CODE_CHAR
)
1700 || (TYPE_CODE (t
) == TYPE_CODE_RANGE
)
1701 || (TYPE_CODE (t
) == TYPE_CODE_BOOL
)));
1704 /* Chill varying string and arrays are represented as follows:
1706 struct { int __var_length; ELEMENT_TYPE[MAX_SIZE] __var_data};
1708 Return true if TYPE is such a Chill varying type. */
1711 chill_varying_type (type
)
1714 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
1715 || TYPE_NFIELDS (type
) != 2
1716 || strcmp (TYPE_FIELD_NAME (type
, 0), "__var_length") != 0)
1721 /* Check whether BASE is an ancestor or base class or DCLASS
1722 Return 1 if so, and 0 if not.
1723 Note: callers may want to check for identity of the types before
1724 calling this function -- identical types are considered to satisfy
1725 the ancestor relationship even if they're identical */
1728 is_ancestor (base
, dclass
)
1730 struct type
*dclass
;
1734 CHECK_TYPEDEF (base
);
1735 CHECK_TYPEDEF (dclass
);
1740 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1741 if (is_ancestor (base
, TYPE_BASECLASS (dclass
, i
)))
1749 /* See whether DCLASS has a virtual table. This routine is aimed at
1750 the HP/Taligent ANSI C++ runtime model, and may not work with other
1751 runtime models. Return 1 => Yes, 0 => No. */
1755 struct type
*dclass
;
1757 /* In the HP ANSI C++ runtime model, a class has a vtable only if it
1758 has virtual functions or virtual bases. */
1762 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
1765 /* First check for the presence of virtual bases */
1766 if (TYPE_FIELD_VIRTUAL_BITS (dclass
))
1767 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1768 if (B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass
), i
))
1771 /* Next check for virtual functions */
1772 if (TYPE_FN_FIELDLISTS (dclass
))
1773 for (i
= 0; i
< TYPE_NFN_FIELDS (dclass
); i
++)
1774 if (TYPE_FN_FIELD_VIRTUAL_P (TYPE_FN_FIELDLIST1 (dclass
, i
), 0))
1777 /* Recurse on non-virtual bases to see if any of them needs a vtable */
1778 if (TYPE_FIELD_VIRTUAL_BITS (dclass
))
1779 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1780 if ((!B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass
), i
)) &&
1781 (has_vtable (TYPE_FIELD_TYPE (dclass
, i
))))
1784 /* Well, maybe we don't need a virtual table */
1788 /* Return a pointer to the "primary base class" of DCLASS.
1790 A NULL return indicates that DCLASS has no primary base, or that it
1791 couldn't be found (insufficient information).
1793 This routine is aimed at the HP/Taligent ANSI C++ runtime model,
1794 and may not work with other runtime models. */
1797 primary_base_class (dclass
)
1798 struct type
*dclass
;
1800 /* In HP ANSI C++'s runtime model, a "primary base class" of a class
1801 is the first directly inherited, non-virtual base class that
1802 requires a virtual table */
1806 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
1809 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1810 if (!TYPE_FIELD_VIRTUAL (dclass
, i
) &&
1811 has_vtable (TYPE_FIELD_TYPE (dclass
, i
)))
1812 return TYPE_FIELD_TYPE (dclass
, i
);
1817 /* Global manipulated by virtual_base_list[_aux]() */
1819 static struct vbase
*current_vbase_list
= NULL
;
1821 /* Return a pointer to a null-terminated list of struct vbase
1822 items. The vbasetype pointer of each item in the list points to the
1823 type information for a virtual base of the argument DCLASS.
1825 Helper function for virtual_base_list().
1826 Note: the list goes backward, right-to-left. virtual_base_list()
1827 copies the items out in reverse order. */
1830 virtual_base_list_aux (dclass
)
1831 struct type
*dclass
;
1833 struct vbase
*tmp_vbase
;
1836 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
1839 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1841 /* Recurse on this ancestor, first */
1842 virtual_base_list_aux (TYPE_FIELD_TYPE (dclass
, i
));
1844 /* If this current base is itself virtual, add it to the list */
1845 if (BASETYPE_VIA_VIRTUAL (dclass
, i
))
1847 struct type
*basetype
= TYPE_FIELD_TYPE (dclass
, i
);
1849 /* Check if base already recorded */
1850 tmp_vbase
= current_vbase_list
;
1853 if (tmp_vbase
->vbasetype
== basetype
)
1854 break; /* found it */
1855 tmp_vbase
= tmp_vbase
->next
;
1858 if (!tmp_vbase
) /* normal exit from loop */
1860 /* Allocate new item for this virtual base */
1861 tmp_vbase
= (struct vbase
*) xmalloc (sizeof (struct vbase
));
1863 /* Stick it on at the end of the list */
1864 tmp_vbase
->vbasetype
= basetype
;
1865 tmp_vbase
->next
= current_vbase_list
;
1866 current_vbase_list
= tmp_vbase
;
1869 } /* for loop over bases */
1873 /* Compute the list of virtual bases in the right order. Virtual
1874 bases are laid out in the object's memory area in order of their
1875 occurrence in a depth-first, left-to-right search through the
1878 Argument DCLASS is the type whose virtual bases are required.
1879 Return value is the address of a null-terminated array of pointers
1880 to struct type items.
1882 This routine is aimed at the HP/Taligent ANSI C++ runtime model,
1883 and may not work with other runtime models.
1885 This routine merely hands off the argument to virtual_base_list_aux()
1886 and then copies the result into an array to save space. */
1889 virtual_base_list (dclass
)
1890 struct type
*dclass
;
1892 register struct vbase
*tmp_vbase
;
1893 register struct vbase
*tmp_vbase_2
;
1896 struct type
**vbase_array
;
1898 current_vbase_list
= NULL
;
1899 virtual_base_list_aux (dclass
);
1901 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; i
++, tmp_vbase
= tmp_vbase
->next
)
1906 vbase_array
= (struct type
**) xmalloc ((count
+ 1) * sizeof (struct type
*));
1908 for (i
= count
- 1, tmp_vbase
= current_vbase_list
; i
>= 0; i
--, tmp_vbase
= tmp_vbase
->next
)
1909 vbase_array
[i
] = tmp_vbase
->vbasetype
;
1911 /* Get rid of constructed chain */
1912 tmp_vbase_2
= tmp_vbase
= current_vbase_list
;
1915 tmp_vbase
= tmp_vbase
->next
;
1917 tmp_vbase_2
= tmp_vbase
;
1920 vbase_array
[count
] = NULL
;
1924 /* Return the length of the virtual base list of the type DCLASS. */
1927 virtual_base_list_length (dclass
)
1928 struct type
*dclass
;
1931 register struct vbase
*tmp_vbase
;
1933 current_vbase_list
= NULL
;
1934 virtual_base_list_aux (dclass
);
1936 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; i
++, tmp_vbase
= tmp_vbase
->next
)
1941 /* Return the number of elements of the virtual base list of the type
1942 DCLASS, ignoring those appearing in the primary base (and its
1943 primary base, recursively). */
1946 virtual_base_list_length_skip_primaries (dclass
)
1947 struct type
*dclass
;
1950 register struct vbase
*tmp_vbase
;
1951 struct type
*primary
;
1953 primary
= TYPE_RUNTIME_PTR (dclass
) ? TYPE_PRIMARY_BASE (dclass
) : NULL
;
1956 return virtual_base_list_length (dclass
);
1958 current_vbase_list
= NULL
;
1959 virtual_base_list_aux (dclass
);
1961 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; tmp_vbase
= tmp_vbase
->next
)
1963 if (virtual_base_index (tmp_vbase
->vbasetype
, primary
) >= 0)
1971 /* Return the index (position) of type BASE, which is a virtual base
1972 class of DCLASS, in the latter's virtual base list. A return of -1
1973 indicates "not found" or a problem. */
1976 virtual_base_index (base
, dclass
)
1978 struct type
*dclass
;
1980 register struct type
*vbase
;
1983 if ((TYPE_CODE (dclass
) != TYPE_CODE_CLASS
) ||
1984 (TYPE_CODE (base
) != TYPE_CODE_CLASS
))
1988 vbase
= TYPE_VIRTUAL_BASE_LIST (dclass
)[0];
1993 vbase
= TYPE_VIRTUAL_BASE_LIST (dclass
)[++i
];
1996 return vbase
? i
: -1;
2001 /* Return the index (position) of type BASE, which is a virtual base
2002 class of DCLASS, in the latter's virtual base list. Skip over all
2003 bases that may appear in the virtual base list of the primary base
2004 class of DCLASS (recursively). A return of -1 indicates "not
2005 found" or a problem. */
2008 virtual_base_index_skip_primaries (base
, dclass
)
2010 struct type
*dclass
;
2012 register struct type
*vbase
;
2014 struct type
*primary
;
2016 if ((TYPE_CODE (dclass
) != TYPE_CODE_CLASS
) ||
2017 (TYPE_CODE (base
) != TYPE_CODE_CLASS
))
2020 primary
= TYPE_RUNTIME_PTR (dclass
) ? TYPE_PRIMARY_BASE (dclass
) : NULL
;
2024 vbase
= TYPE_VIRTUAL_BASE_LIST (dclass
)[0];
2027 if (!primary
|| (virtual_base_index_skip_primaries (vbase
, primary
) < 0))
2031 vbase
= TYPE_VIRTUAL_BASE_LIST (dclass
)[++i
];
2034 return vbase
? j
: -1;
2037 /* Return position of a derived class DCLASS in the list of
2038 * primary bases starting with the remotest ancestor.
2039 * Position returned is 0-based. */
2042 class_index_in_primary_list (dclass
)
2043 struct type
*dclass
;
2045 struct type
*pbc
; /* primary base class */
2047 /* Simply recurse on primary base */
2048 pbc
= TYPE_PRIMARY_BASE (dclass
);
2050 return 1 + class_index_in_primary_list (pbc
);
2055 /* Return a count of the number of virtual functions a type has.
2056 * This includes all the virtual functions it inherits from its
2060 /* pai: FIXME This doesn't do the right thing: count redefined virtual
2061 * functions only once (latest redefinition)
2065 count_virtual_fns (dclass
)
2066 struct type
*dclass
;
2068 int fn
, oi
; /* function and overloaded instance indices */
2069 int vfuncs
; /* count to return */
2071 /* recurse on bases that can share virtual table */
2072 struct type
*pbc
= primary_base_class (dclass
);
2074 vfuncs
= count_virtual_fns (pbc
);
2076 for (fn
= 0; fn
< TYPE_NFN_FIELDS (dclass
); fn
++)
2077 for (oi
= 0; oi
< TYPE_FN_FIELDLIST_LENGTH (dclass
, fn
); oi
++)
2078 if (TYPE_FN_FIELD_VIRTUAL_P (TYPE_FN_FIELDLIST1 (dclass
, fn
), oi
))
2086 /* Functions for overload resolution begin here */
2088 /* Compare two badness vectors A and B and return the result.
2089 * 0 => A and B are identical
2090 * 1 => A and B are incomparable
2091 * 2 => A is better than B
2092 * 3 => A is worse than B */
2095 compare_badness (a
, b
)
2096 struct badness_vector
*a
;
2097 struct badness_vector
*b
;
2101 short found_pos
= 0; /* any positives in c? */
2102 short found_neg
= 0; /* any negatives in c? */
2104 /* differing lengths => incomparable */
2105 if (a
->length
!= b
->length
)
2108 /* Subtract b from a */
2109 for (i
= 0; i
< a
->length
; i
++)
2111 tmp
= a
->rank
[i
] - b
->rank
[i
];
2121 return 1; /* incomparable */
2123 return 3; /* A > B */
2129 return 2; /* A < B */
2131 return 0; /* A == B */
2135 /* Rank a function by comparing its parameter types (PARMS, length NPARMS),
2136 * to the types of an argument list (ARGS, length NARGS).
2137 * Return a pointer to a badness vector. This has NARGS + 1 entries. */
2139 struct badness_vector
*
2140 rank_function (parms
, nparms
, args
, nargs
)
2141 struct type
**parms
;
2147 struct badness_vector
*bv
;
2148 int min_len
= nparms
< nargs
? nparms
: nargs
;
2150 bv
= xmalloc (sizeof (struct badness_vector
));
2151 bv
->length
= nargs
+ 1; /* add 1 for the length-match rank */
2152 bv
->rank
= xmalloc ((nargs
+ 1) * sizeof (int));
2154 /* First compare the lengths of the supplied lists.
2155 * If there is a mismatch, set it to a high value. */
2157 /* pai/1997-06-03 FIXME: when we have debug info about default
2158 * arguments and ellipsis parameter lists, we should consider those
2159 * and rank the length-match more finely. */
2161 LENGTH_MATCH (bv
) = (nargs
!= nparms
) ? LENGTH_MISMATCH_BADNESS
: 0;
2163 /* Now rank all the parameters of the candidate function */
2164 for (i
= 1; i
<= min_len
; i
++)
2165 bv
->rank
[i
] = rank_one_type (parms
[i
-1], args
[i
-1]);
2167 /* If more arguments than parameters, add dummy entries */
2168 for (i
= min_len
+ 1; i
<= nargs
; i
++)
2169 bv
->rank
[i
] = TOO_FEW_PARAMS_BADNESS
;
2174 /* Compare one type (PARM) for compatibility with another (ARG).
2175 * PARM is intended to be the parameter type of a function; and
2176 * ARG is the supplied argument's type. This function tests if
2177 * the latter can be converted to the former.
2179 * Return 0 if they are identical types;
2180 * Otherwise, return an integer which corresponds to how compatible
2181 * PARM is to ARG. The higher the return value, the worse the match.
2182 * Generally the "bad" conversions are all uniformly assigned a 100 */
2185 rank_one_type (parm
, arg
)
2189 /* Identical type pointers */
2190 /* However, this still doesn't catch all cases of same type for arg
2191 * and param. The reason is that builtin types are different from
2192 * the same ones constructed from the object. */
2196 /* Resolve typedefs */
2197 if (TYPE_CODE (parm
) == TYPE_CODE_TYPEDEF
)
2198 parm
= check_typedef (parm
);
2199 if (TYPE_CODE (arg
) == TYPE_CODE_TYPEDEF
)
2200 arg
= check_typedef (arg
);
2203 Well, damnit, if the names are exactly the same,
2204 i'll say they are exactly the same. This happens when we generate
2205 method stubs. The types won't point to the same address, but they
2206 really are the same.
2209 if (TYPE_NAME (parm
) == TYPE_NAME (arg
))
2212 /* Check if identical after resolving typedefs */
2216 /* See through references, since we can almost make non-references
2218 if (TYPE_CODE (arg
) == TYPE_CODE_REF
)
2219 return (rank_one_type (TYPE_TARGET_TYPE (arg
), parm
)
2220 + REFERENCE_CONVERSION_BADNESS
);
2221 if (TYPE_CODE (parm
) == TYPE_CODE_REF
)
2222 return (rank_one_type (arg
, TYPE_TARGET_TYPE (parm
))
2223 + REFERENCE_CONVERSION_BADNESS
);
2225 /* Debugging only. */
2226 fprintf_filtered (gdb_stderr
,"------ Arg is %s [%d], parm is %s [%d]\n",
2227 TYPE_NAME (arg
), TYPE_CODE (arg
), TYPE_NAME (parm
), TYPE_CODE (parm
));
2229 /* x -> y means arg of type x being supplied for parameter of type y */
2231 switch (TYPE_CODE (parm
))
2234 switch (TYPE_CODE (arg
))
2237 if (TYPE_CODE (TYPE_TARGET_TYPE (parm
)) == TYPE_CODE_VOID
)
2238 return VOID_PTR_CONVERSION_BADNESS
;
2240 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2241 case TYPE_CODE_ARRAY
:
2242 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2243 case TYPE_CODE_FUNC
:
2244 return rank_one_type (TYPE_TARGET_TYPE (parm
), arg
);
2246 case TYPE_CODE_ENUM
:
2247 case TYPE_CODE_CHAR
:
2248 case TYPE_CODE_RANGE
:
2249 case TYPE_CODE_BOOL
:
2250 return POINTER_CONVERSION_BADNESS
;
2252 return INCOMPATIBLE_TYPE_BADNESS
;
2254 case TYPE_CODE_ARRAY
:
2255 switch (TYPE_CODE (arg
))
2258 case TYPE_CODE_ARRAY
:
2259 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2261 return INCOMPATIBLE_TYPE_BADNESS
;
2263 case TYPE_CODE_FUNC
:
2264 switch (TYPE_CODE (arg
))
2266 case TYPE_CODE_PTR
: /* funcptr -> func */
2267 return rank_one_type (parm
, TYPE_TARGET_TYPE (arg
));
2269 return INCOMPATIBLE_TYPE_BADNESS
;
2272 switch (TYPE_CODE (arg
))
2275 if (TYPE_LENGTH (arg
) == TYPE_LENGTH (parm
))
2277 /* Deal with signed, unsigned, and plain chars and
2278 signed and unsigned ints */
2279 if (TYPE_NOSIGN (parm
))
2281 /* This case only for character types */
2282 if (TYPE_NOSIGN (arg
)) /* plain char -> plain char */
2285 return INTEGER_COERCION_BADNESS
; /* signed/unsigned char -> plain char */
2287 else if (TYPE_UNSIGNED (parm
))
2289 if (TYPE_UNSIGNED (arg
))
2291 if (!strcmp_iw (TYPE_NAME (parm
), TYPE_NAME (arg
)))
2292 return 0; /* unsigned int -> unsigned int, or unsigned long -> unsigned long */
2293 else if (!strcmp_iw (TYPE_NAME (arg
), "int") && !strcmp_iw (TYPE_NAME (parm
), "long"))
2294 return INTEGER_PROMOTION_BADNESS
; /* unsigned int -> unsigned long */
2296 return INTEGER_COERCION_BADNESS
; /* unsigned long -> unsigned int */
2300 if (!strcmp_iw (TYPE_NAME (arg
), "long") && !strcmp_iw (TYPE_NAME (parm
), "int"))
2301 return INTEGER_COERCION_BADNESS
; /* signed long -> unsigned int */
2303 return INTEGER_CONVERSION_BADNESS
; /* signed int/long -> unsigned int/long */
2306 else if (!TYPE_NOSIGN (arg
) && !TYPE_UNSIGNED (arg
))
2308 if (!strcmp_iw (TYPE_NAME (parm
), TYPE_NAME (arg
)))
2310 else if (!strcmp_iw (TYPE_NAME (arg
), "int") && !strcmp_iw (TYPE_NAME (parm
), "long"))
2311 return INTEGER_PROMOTION_BADNESS
;
2313 return INTEGER_COERCION_BADNESS
;
2316 return INTEGER_COERCION_BADNESS
;
2318 else if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2319 return INTEGER_PROMOTION_BADNESS
;
2321 return INTEGER_COERCION_BADNESS
;
2322 case TYPE_CODE_ENUM
:
2323 case TYPE_CODE_CHAR
:
2324 case TYPE_CODE_RANGE
:
2325 case TYPE_CODE_BOOL
:
2326 return INTEGER_PROMOTION_BADNESS
;
2328 return INT_FLOAT_CONVERSION_BADNESS
;
2330 return NS_POINTER_CONVERSION_BADNESS
;
2332 return INCOMPATIBLE_TYPE_BADNESS
;
2335 case TYPE_CODE_ENUM
:
2336 switch (TYPE_CODE (arg
))
2339 case TYPE_CODE_CHAR
:
2340 case TYPE_CODE_RANGE
:
2341 case TYPE_CODE_BOOL
:
2342 case TYPE_CODE_ENUM
:
2343 return INTEGER_COERCION_BADNESS
;
2345 return INT_FLOAT_CONVERSION_BADNESS
;
2347 return INCOMPATIBLE_TYPE_BADNESS
;
2350 case TYPE_CODE_CHAR
:
2351 switch (TYPE_CODE (arg
))
2353 case TYPE_CODE_RANGE
:
2354 case TYPE_CODE_BOOL
:
2355 case TYPE_CODE_ENUM
:
2356 return INTEGER_COERCION_BADNESS
;
2358 return INT_FLOAT_CONVERSION_BADNESS
;
2360 if (TYPE_LENGTH (arg
) > TYPE_LENGTH (parm
))
2361 return INTEGER_COERCION_BADNESS
;
2362 else if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2363 return INTEGER_PROMOTION_BADNESS
;
2364 /* >>> !! else fall through !! <<< */
2365 case TYPE_CODE_CHAR
:
2366 /* Deal with signed, unsigned, and plain chars for C++
2367 and with int cases falling through from previous case */
2368 if (TYPE_NOSIGN (parm
))
2370 if (TYPE_NOSIGN (arg
))
2373 return INTEGER_COERCION_BADNESS
;
2375 else if (TYPE_UNSIGNED (parm
))
2377 if (TYPE_UNSIGNED (arg
))
2380 return INTEGER_PROMOTION_BADNESS
;
2382 else if (!TYPE_NOSIGN (arg
) && !TYPE_UNSIGNED (arg
))
2385 return INTEGER_COERCION_BADNESS
;
2387 return INCOMPATIBLE_TYPE_BADNESS
;
2390 case TYPE_CODE_RANGE
:
2391 switch (TYPE_CODE (arg
))
2394 case TYPE_CODE_CHAR
:
2395 case TYPE_CODE_RANGE
:
2396 case TYPE_CODE_BOOL
:
2397 case TYPE_CODE_ENUM
:
2398 return INTEGER_COERCION_BADNESS
;
2400 return INT_FLOAT_CONVERSION_BADNESS
;
2402 return INCOMPATIBLE_TYPE_BADNESS
;
2405 case TYPE_CODE_BOOL
:
2406 switch (TYPE_CODE (arg
))
2409 case TYPE_CODE_CHAR
:
2410 case TYPE_CODE_RANGE
:
2411 case TYPE_CODE_ENUM
:
2414 return BOOLEAN_CONVERSION_BADNESS
;
2415 case TYPE_CODE_BOOL
:
2418 return INCOMPATIBLE_TYPE_BADNESS
;
2422 switch (TYPE_CODE (arg
))
2425 if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2426 return FLOAT_PROMOTION_BADNESS
;
2427 else if (TYPE_LENGTH (arg
) == TYPE_LENGTH (parm
))
2430 return FLOAT_CONVERSION_BADNESS
;
2432 case TYPE_CODE_BOOL
:
2433 case TYPE_CODE_ENUM
:
2434 case TYPE_CODE_RANGE
:
2435 case TYPE_CODE_CHAR
:
2436 return INT_FLOAT_CONVERSION_BADNESS
;
2438 return INCOMPATIBLE_TYPE_BADNESS
;
2441 case TYPE_CODE_COMPLEX
:
2442 switch (TYPE_CODE (arg
))
2443 { /* Strictly not needed for C++, but... */
2445 return FLOAT_PROMOTION_BADNESS
;
2446 case TYPE_CODE_COMPLEX
:
2449 return INCOMPATIBLE_TYPE_BADNESS
;
2452 case TYPE_CODE_STRUCT
:
2453 /* currently same as TYPE_CODE_CLASS */
2454 switch (TYPE_CODE (arg
))
2456 case TYPE_CODE_STRUCT
:
2457 /* Check for derivation */
2458 if (is_ancestor (parm
, arg
))
2459 return BASE_CONVERSION_BADNESS
;
2460 /* else fall through */
2462 return INCOMPATIBLE_TYPE_BADNESS
;
2465 case TYPE_CODE_UNION
:
2466 switch (TYPE_CODE (arg
))
2468 case TYPE_CODE_UNION
:
2470 return INCOMPATIBLE_TYPE_BADNESS
;
2473 case TYPE_CODE_MEMBER
:
2474 switch (TYPE_CODE (arg
))
2477 return INCOMPATIBLE_TYPE_BADNESS
;
2480 case TYPE_CODE_METHOD
:
2481 switch (TYPE_CODE (arg
))
2485 return INCOMPATIBLE_TYPE_BADNESS
;
2489 switch (TYPE_CODE (arg
))
2493 return INCOMPATIBLE_TYPE_BADNESS
;
2498 switch (TYPE_CODE (arg
))
2502 return rank_one_type (TYPE_FIELD_TYPE (parm
, 0), TYPE_FIELD_TYPE (arg
, 0));
2504 return INCOMPATIBLE_TYPE_BADNESS
;
2507 case TYPE_CODE_VOID
:
2509 return INCOMPATIBLE_TYPE_BADNESS
;
2510 } /* switch (TYPE_CODE (arg)) */
2514 /* End of functions for overload resolution */
2517 print_bit_vector (bits
, nbits
)
2523 for (bitno
= 0; bitno
< nbits
; bitno
++)
2525 if ((bitno
% 8) == 0)
2527 puts_filtered (" ");
2529 if (B_TST (bits
, bitno
))
2531 printf_filtered ("1");
2535 printf_filtered ("0");
2540 /* The args list is a strange beast. It is either terminated by a NULL
2541 pointer for varargs functions, or by a pointer to a TYPE_CODE_VOID
2542 type for normal fixed argcount functions. (FIXME someday)
2543 Also note the first arg should be the "this" pointer, we may not want to
2544 include it since we may get into a infinitely recursive situation. */
2547 print_arg_types (args
, spaces
)
2553 while (*args
!= NULL
)
2555 recursive_dump_type (*args
, spaces
+ 2);
2556 if ((*args
++)->code
== TYPE_CODE_VOID
)
2565 dump_fn_fieldlists (type
, spaces
)
2573 printfi_filtered (spaces
, "fn_fieldlists ");
2574 gdb_print_host_address (TYPE_FN_FIELDLISTS (type
), gdb_stdout
);
2575 printf_filtered ("\n");
2576 for (method_idx
= 0; method_idx
< TYPE_NFN_FIELDS (type
); method_idx
++)
2578 f
= TYPE_FN_FIELDLIST1 (type
, method_idx
);
2579 printfi_filtered (spaces
+ 2, "[%d] name '%s' (",
2581 TYPE_FN_FIELDLIST_NAME (type
, method_idx
));
2582 gdb_print_host_address (TYPE_FN_FIELDLIST_NAME (type
, method_idx
),
2584 printf_filtered (") length %d\n",
2585 TYPE_FN_FIELDLIST_LENGTH (type
, method_idx
));
2586 for (overload_idx
= 0;
2587 overload_idx
< TYPE_FN_FIELDLIST_LENGTH (type
, method_idx
);
2590 printfi_filtered (spaces
+ 4, "[%d] physname '%s' (",
2592 TYPE_FN_FIELD_PHYSNAME (f
, overload_idx
));
2593 gdb_print_host_address (TYPE_FN_FIELD_PHYSNAME (f
, overload_idx
),
2595 printf_filtered (")\n");
2596 printfi_filtered (spaces
+ 8, "type ");
2597 gdb_print_host_address (TYPE_FN_FIELD_TYPE (f
, overload_idx
), gdb_stdout
);
2598 printf_filtered ("\n");
2600 recursive_dump_type (TYPE_FN_FIELD_TYPE (f
, overload_idx
),
2603 printfi_filtered (spaces
+ 8, "args ");
2604 gdb_print_host_address (TYPE_FN_FIELD_ARGS (f
, overload_idx
), gdb_stdout
);
2605 printf_filtered ("\n");
2607 print_arg_types (TYPE_FN_FIELD_ARGS (f
, overload_idx
), spaces
);
2608 printfi_filtered (spaces
+ 8, "fcontext ");
2609 gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f
, overload_idx
),
2611 printf_filtered ("\n");
2613 printfi_filtered (spaces
+ 8, "is_const %d\n",
2614 TYPE_FN_FIELD_CONST (f
, overload_idx
));
2615 printfi_filtered (spaces
+ 8, "is_volatile %d\n",
2616 TYPE_FN_FIELD_VOLATILE (f
, overload_idx
));
2617 printfi_filtered (spaces
+ 8, "is_private %d\n",
2618 TYPE_FN_FIELD_PRIVATE (f
, overload_idx
));
2619 printfi_filtered (spaces
+ 8, "is_protected %d\n",
2620 TYPE_FN_FIELD_PROTECTED (f
, overload_idx
));
2621 printfi_filtered (spaces
+ 8, "is_stub %d\n",
2622 TYPE_FN_FIELD_STUB (f
, overload_idx
));
2623 printfi_filtered (spaces
+ 8, "voffset %u\n",
2624 TYPE_FN_FIELD_VOFFSET (f
, overload_idx
));
2630 print_cplus_stuff (type
, spaces
)
2634 printfi_filtered (spaces
, "n_baseclasses %d\n",
2635 TYPE_N_BASECLASSES (type
));
2636 printfi_filtered (spaces
, "nfn_fields %d\n",
2637 TYPE_NFN_FIELDS (type
));
2638 printfi_filtered (spaces
, "nfn_fields_total %d\n",
2639 TYPE_NFN_FIELDS_TOTAL (type
));
2640 if (TYPE_N_BASECLASSES (type
) > 0)
2642 printfi_filtered (spaces
, "virtual_field_bits (%d bits at *",
2643 TYPE_N_BASECLASSES (type
));
2644 gdb_print_host_address (TYPE_FIELD_VIRTUAL_BITS (type
), gdb_stdout
);
2645 printf_filtered (")");
2647 print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type
),
2648 TYPE_N_BASECLASSES (type
));
2649 puts_filtered ("\n");
2651 if (TYPE_NFIELDS (type
) > 0)
2653 if (TYPE_FIELD_PRIVATE_BITS (type
) != NULL
)
2655 printfi_filtered (spaces
, "private_field_bits (%d bits at *",
2656 TYPE_NFIELDS (type
));
2657 gdb_print_host_address (TYPE_FIELD_PRIVATE_BITS (type
), gdb_stdout
);
2658 printf_filtered (")");
2659 print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type
),
2660 TYPE_NFIELDS (type
));
2661 puts_filtered ("\n");
2663 if (TYPE_FIELD_PROTECTED_BITS (type
) != NULL
)
2665 printfi_filtered (spaces
, "protected_field_bits (%d bits at *",
2666 TYPE_NFIELDS (type
));
2667 gdb_print_host_address (TYPE_FIELD_PROTECTED_BITS (type
), gdb_stdout
);
2668 printf_filtered (")");
2669 print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type
),
2670 TYPE_NFIELDS (type
));
2671 puts_filtered ("\n");
2674 if (TYPE_NFN_FIELDS (type
) > 0)
2676 dump_fn_fieldlists (type
, spaces
);
2680 static struct obstack dont_print_type_obstack
;
2683 recursive_dump_type (type
, spaces
)
2690 obstack_begin (&dont_print_type_obstack
, 0);
2692 if (TYPE_NFIELDS (type
) > 0
2693 || (TYPE_CPLUS_SPECIFIC (type
) && TYPE_NFN_FIELDS (type
) > 0))
2695 struct type
**first_dont_print
2696 = (struct type
**) obstack_base (&dont_print_type_obstack
);
2698 int i
= (struct type
**) obstack_next_free (&dont_print_type_obstack
)
2703 if (type
== first_dont_print
[i
])
2705 printfi_filtered (spaces
, "type node ");
2706 gdb_print_host_address (type
, gdb_stdout
);
2707 printf_filtered (" <same as already seen type>\n");
2712 obstack_ptr_grow (&dont_print_type_obstack
, type
);
2715 printfi_filtered (spaces
, "type node ");
2716 gdb_print_host_address (type
, gdb_stdout
);
2717 printf_filtered ("\n");
2718 printfi_filtered (spaces
, "name '%s' (",
2719 TYPE_NAME (type
) ? TYPE_NAME (type
) : "<NULL>");
2720 gdb_print_host_address (TYPE_NAME (type
), gdb_stdout
);
2721 printf_filtered (")\n");
2722 if (TYPE_TAG_NAME (type
) != NULL
)
2724 printfi_filtered (spaces
, "tagname '%s' (",
2725 TYPE_TAG_NAME (type
));
2726 gdb_print_host_address (TYPE_TAG_NAME (type
), gdb_stdout
);
2727 printf_filtered (")\n");
2729 printfi_filtered (spaces
, "code 0x%x ", TYPE_CODE (type
));
2730 switch (TYPE_CODE (type
))
2732 case TYPE_CODE_UNDEF
:
2733 printf_filtered ("(TYPE_CODE_UNDEF)");
2736 printf_filtered ("(TYPE_CODE_PTR)");
2738 case TYPE_CODE_ARRAY
:
2739 printf_filtered ("(TYPE_CODE_ARRAY)");
2741 case TYPE_CODE_STRUCT
:
2742 printf_filtered ("(TYPE_CODE_STRUCT)");
2744 case TYPE_CODE_UNION
:
2745 printf_filtered ("(TYPE_CODE_UNION)");
2747 case TYPE_CODE_ENUM
:
2748 printf_filtered ("(TYPE_CODE_ENUM)");
2750 case TYPE_CODE_FUNC
:
2751 printf_filtered ("(TYPE_CODE_FUNC)");
2754 printf_filtered ("(TYPE_CODE_INT)");
2757 printf_filtered ("(TYPE_CODE_FLT)");
2759 case TYPE_CODE_VOID
:
2760 printf_filtered ("(TYPE_CODE_VOID)");
2763 printf_filtered ("(TYPE_CODE_SET)");
2765 case TYPE_CODE_RANGE
:
2766 printf_filtered ("(TYPE_CODE_RANGE)");
2768 case TYPE_CODE_STRING
:
2769 printf_filtered ("(TYPE_CODE_STRING)");
2771 case TYPE_CODE_ERROR
:
2772 printf_filtered ("(TYPE_CODE_ERROR)");
2774 case TYPE_CODE_MEMBER
:
2775 printf_filtered ("(TYPE_CODE_MEMBER)");
2777 case TYPE_CODE_METHOD
:
2778 printf_filtered ("(TYPE_CODE_METHOD)");
2781 printf_filtered ("(TYPE_CODE_REF)");
2783 case TYPE_CODE_CHAR
:
2784 printf_filtered ("(TYPE_CODE_CHAR)");
2786 case TYPE_CODE_BOOL
:
2787 printf_filtered ("(TYPE_CODE_BOOL)");
2789 case TYPE_CODE_TYPEDEF
:
2790 printf_filtered ("(TYPE_CODE_TYPEDEF)");
2793 printf_filtered ("(UNKNOWN TYPE CODE)");
2796 puts_filtered ("\n");
2797 printfi_filtered (spaces
, "length %d\n", TYPE_LENGTH (type
));
2798 printfi_filtered (spaces
, "objfile ");
2799 gdb_print_host_address (TYPE_OBJFILE (type
), gdb_stdout
);
2800 printf_filtered ("\n");
2801 printfi_filtered (spaces
, "target_type ");
2802 gdb_print_host_address (TYPE_TARGET_TYPE (type
), gdb_stdout
);
2803 printf_filtered ("\n");
2804 if (TYPE_TARGET_TYPE (type
) != NULL
)
2806 recursive_dump_type (TYPE_TARGET_TYPE (type
), spaces
+ 2);
2808 printfi_filtered (spaces
, "pointer_type ");
2809 gdb_print_host_address (TYPE_POINTER_TYPE (type
), gdb_stdout
);
2810 printf_filtered ("\n");
2811 printfi_filtered (spaces
, "reference_type ");
2812 gdb_print_host_address (TYPE_REFERENCE_TYPE (type
), gdb_stdout
);
2813 printf_filtered ("\n");
2814 printfi_filtered (spaces
, "flags 0x%x", TYPE_FLAGS (type
));
2815 if (TYPE_FLAGS (type
) & TYPE_FLAG_UNSIGNED
)
2817 puts_filtered (" TYPE_FLAG_UNSIGNED");
2819 if (TYPE_FLAGS (type
) & TYPE_FLAG_STUB
)
2821 puts_filtered (" TYPE_FLAG_STUB");
2823 puts_filtered ("\n");
2824 printfi_filtered (spaces
, "nfields %d ", TYPE_NFIELDS (type
));
2825 gdb_print_host_address (TYPE_FIELDS (type
), gdb_stdout
);
2826 puts_filtered ("\n");
2827 for (idx
= 0; idx
< TYPE_NFIELDS (type
); idx
++)
2829 printfi_filtered (spaces
+ 2,
2830 "[%d] bitpos %d bitsize %d type ",
2831 idx
, TYPE_FIELD_BITPOS (type
, idx
),
2832 TYPE_FIELD_BITSIZE (type
, idx
));
2833 gdb_print_host_address (TYPE_FIELD_TYPE (type
, idx
), gdb_stdout
);
2834 printf_filtered (" name '%s' (",
2835 TYPE_FIELD_NAME (type
, idx
) != NULL
2836 ? TYPE_FIELD_NAME (type
, idx
)
2838 gdb_print_host_address (TYPE_FIELD_NAME (type
, idx
), gdb_stdout
);
2839 printf_filtered (")\n");
2840 if (TYPE_FIELD_TYPE (type
, idx
) != NULL
)
2842 recursive_dump_type (TYPE_FIELD_TYPE (type
, idx
), spaces
+ 4);
2845 printfi_filtered (spaces
, "vptr_basetype ");
2846 gdb_print_host_address (TYPE_VPTR_BASETYPE (type
), gdb_stdout
);
2847 puts_filtered ("\n");
2848 if (TYPE_VPTR_BASETYPE (type
) != NULL
)
2850 recursive_dump_type (TYPE_VPTR_BASETYPE (type
), spaces
+ 2);
2852 printfi_filtered (spaces
, "vptr_fieldno %d\n", TYPE_VPTR_FIELDNO (type
));
2853 switch (TYPE_CODE (type
))
2855 case TYPE_CODE_METHOD
:
2856 case TYPE_CODE_FUNC
:
2857 printfi_filtered (spaces
, "arg_types ");
2858 gdb_print_host_address (TYPE_ARG_TYPES (type
), gdb_stdout
);
2859 puts_filtered ("\n");
2860 print_arg_types (TYPE_ARG_TYPES (type
), spaces
);
2863 case TYPE_CODE_STRUCT
:
2864 printfi_filtered (spaces
, "cplus_stuff ");
2865 gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type
), gdb_stdout
);
2866 puts_filtered ("\n");
2867 print_cplus_stuff (type
, spaces
);
2871 /* We have to pick one of the union types to be able print and test
2872 the value. Pick cplus_struct_type, even though we know it isn't
2873 any particular one. */
2874 printfi_filtered (spaces
, "type_specific ");
2875 gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type
), gdb_stdout
);
2876 if (TYPE_CPLUS_SPECIFIC (type
) != NULL
)
2878 printf_filtered (" (unknown data form)");
2880 printf_filtered ("\n");
2885 obstack_free (&dont_print_type_obstack
, NULL
);
2888 static void build_gdbtypes (void);
2893 init_type (TYPE_CODE_VOID
, 1,
2895 "void", (struct objfile
*) NULL
);
2897 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
2899 "char", (struct objfile
*) NULL
);
2900 TYPE_FLAGS (builtin_type_char
) |= TYPE_FLAG_NOSIGN
;
2901 builtin_type_true_char
=
2902 init_type (TYPE_CODE_CHAR
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
2904 "true character", (struct objfile
*) NULL
);
2905 builtin_type_signed_char
=
2906 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
2908 "signed char", (struct objfile
*) NULL
);
2909 builtin_type_unsigned_char
=
2910 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
2912 "unsigned char", (struct objfile
*) NULL
);
2913 builtin_type_short
=
2914 init_type (TYPE_CODE_INT
, TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
2916 "short", (struct objfile
*) NULL
);
2917 builtin_type_unsigned_short
=
2918 init_type (TYPE_CODE_INT
, TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
2920 "unsigned short", (struct objfile
*) NULL
);
2922 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
2924 "int", (struct objfile
*) NULL
);
2925 builtin_type_unsigned_int
=
2926 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
2928 "unsigned int", (struct objfile
*) NULL
);
2930 init_type (TYPE_CODE_INT
, TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
2932 "long", (struct objfile
*) NULL
);
2933 builtin_type_unsigned_long
=
2934 init_type (TYPE_CODE_INT
, TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
2936 "unsigned long", (struct objfile
*) NULL
);
2937 builtin_type_long_long
=
2938 init_type (TYPE_CODE_INT
, TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
2940 "long long", (struct objfile
*) NULL
);
2941 builtin_type_unsigned_long_long
=
2942 init_type (TYPE_CODE_INT
, TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
2944 "unsigned long long", (struct objfile
*) NULL
);
2945 builtin_type_float
=
2946 init_type (TYPE_CODE_FLT
, TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
2948 "float", (struct objfile
*) NULL
);
2949 builtin_type_double
=
2950 init_type (TYPE_CODE_FLT
, TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
2952 "double", (struct objfile
*) NULL
);
2953 builtin_type_long_double
=
2954 init_type (TYPE_CODE_FLT
, TARGET_LONG_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
2956 "long double", (struct objfile
*) NULL
);
2957 builtin_type_complex
=
2958 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
2960 "complex", (struct objfile
*) NULL
);
2961 TYPE_TARGET_TYPE (builtin_type_complex
) = builtin_type_float
;
2962 builtin_type_double_complex
=
2963 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
2965 "double complex", (struct objfile
*) NULL
);
2966 TYPE_TARGET_TYPE (builtin_type_double_complex
) = builtin_type_double
;
2967 builtin_type_string
=
2968 init_type (TYPE_CODE_STRING
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
2970 "string", (struct objfile
*) NULL
);
2972 init_type (TYPE_CODE_INT
, 8 / 8,
2974 "int8_t", (struct objfile
*) NULL
);
2975 builtin_type_uint8
=
2976 init_type (TYPE_CODE_INT
, 8 / 8,
2978 "uint8_t", (struct objfile
*) NULL
);
2979 builtin_type_int16
=
2980 init_type (TYPE_CODE_INT
, 16 / 8,
2982 "int16_t", (struct objfile
*) NULL
);
2983 builtin_type_uint16
=
2984 init_type (TYPE_CODE_INT
, 16 / 8,
2986 "uint16_t", (struct objfile
*) NULL
);
2987 builtin_type_int32
=
2988 init_type (TYPE_CODE_INT
, 32 / 8,
2990 "int32_t", (struct objfile
*) NULL
);
2991 builtin_type_uint32
=
2992 init_type (TYPE_CODE_INT
, 32 / 8,
2994 "uint32_t", (struct objfile
*) NULL
);
2995 builtin_type_int64
=
2996 init_type (TYPE_CODE_INT
, 64 / 8,
2998 "int64_t", (struct objfile
*) NULL
);
2999 builtin_type_uint64
=
3000 init_type (TYPE_CODE_INT
, 64 / 8,
3002 "uint64_t", (struct objfile
*) NULL
);
3004 init_type (TYPE_CODE_BOOL
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3006 "bool", (struct objfile
*) NULL
);
3008 /* Add user knob for controlling resolution of opaque types */
3010 (add_set_cmd ("opaque-type-resolution", class_support
, var_boolean
, (char *) &opaque_type_resolution
,
3011 "Set resolution of opaque struct/class/union types (if set before loading symbols).",
3014 opaque_type_resolution
= 1;
3017 /* Build SIMD types. */
3019 = init_simd_type ("__builtin_v4sf", builtin_type_float
, "f", 4);
3021 = init_simd_type ("__builtin_v4si", builtin_type_int32
, "f", 4);
3023 = init_simd_type ("__builtin_v8qi", builtin_type_int8
, "f", 8);
3025 = init_simd_type ("__builtin_v4hi", builtin_type_int16
, "f", 4);
3027 = init_simd_type ("__builtin_v2si", builtin_type_int32
, "f", 2);
3029 /* Pointer/Address types. */
3030 /* NOTE: At present there is no way of differentiating between at
3031 target address and the target C language pointer type type even
3032 though the two can be different (cf d10v) */
3034 init_type (TYPE_CODE_INT
, TARGET_PTR_BIT
/ 8,
3036 "__ptr", (struct objfile
*) NULL
);
3037 builtin_type_CORE_ADDR
=
3038 init_type (TYPE_CODE_INT
, TARGET_PTR_BIT
/ 8,
3040 "__CORE_ADDR", (struct objfile
*) NULL
);
3041 builtin_type_bfd_vma
=
3042 init_type (TYPE_CODE_INT
, TARGET_BFD_VMA_BIT
/ 8,
3044 "__bfd_vma", (struct objfile
*) NULL
);
3048 extern void _initialize_gdbtypes (void);
3050 _initialize_gdbtypes ()
3052 struct cmd_list_element
*c
;
3055 /* FIXME - For the moment, handle types by swapping them in and out.
3056 Should be using the per-architecture data-pointer and a large
3058 register_gdbarch_swap (&builtin_type_void
, sizeof (struct type
*), NULL
);
3059 register_gdbarch_swap (&builtin_type_char
, sizeof (struct type
*), NULL
);
3060 register_gdbarch_swap (&builtin_type_short
, sizeof (struct type
*), NULL
);
3061 register_gdbarch_swap (&builtin_type_int
, sizeof (struct type
*), NULL
);
3062 register_gdbarch_swap (&builtin_type_long
, sizeof (struct type
*), NULL
);
3063 register_gdbarch_swap (&builtin_type_long_long
, sizeof (struct type
*), NULL
);
3064 register_gdbarch_swap (&builtin_type_signed_char
, sizeof (struct type
*), NULL
);
3065 register_gdbarch_swap (&builtin_type_unsigned_char
, sizeof (struct type
*), NULL
);
3066 register_gdbarch_swap (&builtin_type_unsigned_short
, sizeof (struct type
*), NULL
);
3067 register_gdbarch_swap (&builtin_type_unsigned_int
, sizeof (struct type
*), NULL
);
3068 register_gdbarch_swap (&builtin_type_unsigned_long
, sizeof (struct type
*), NULL
);
3069 register_gdbarch_swap (&builtin_type_unsigned_long_long
, sizeof (struct type
*), NULL
);
3070 register_gdbarch_swap (&builtin_type_float
, sizeof (struct type
*), NULL
);
3071 register_gdbarch_swap (&builtin_type_double
, sizeof (struct type
*), NULL
);
3072 register_gdbarch_swap (&builtin_type_long_double
, sizeof (struct type
*), NULL
);
3073 register_gdbarch_swap (&builtin_type_complex
, sizeof (struct type
*), NULL
);
3074 register_gdbarch_swap (&builtin_type_double_complex
, sizeof (struct type
*), NULL
);
3075 register_gdbarch_swap (&builtin_type_string
, sizeof (struct type
*), NULL
);
3076 register_gdbarch_swap (&builtin_type_int8
, sizeof (struct type
*), NULL
);
3077 register_gdbarch_swap (&builtin_type_uint8
, sizeof (struct type
*), NULL
);
3078 register_gdbarch_swap (&builtin_type_int16
, sizeof (struct type
*), NULL
);
3079 register_gdbarch_swap (&builtin_type_uint16
, sizeof (struct type
*), NULL
);
3080 register_gdbarch_swap (&builtin_type_int32
, sizeof (struct type
*), NULL
);
3081 register_gdbarch_swap (&builtin_type_uint32
, sizeof (struct type
*), NULL
);
3082 register_gdbarch_swap (&builtin_type_int64
, sizeof (struct type
*), NULL
);
3083 register_gdbarch_swap (&builtin_type_uint64
, sizeof (struct type
*), NULL
);
3084 register_gdbarch_swap (&builtin_type_v4sf
, sizeof (struct type
*), NULL
);
3085 register_gdbarch_swap (&builtin_type_v4si
, sizeof (struct type
*), NULL
);
3086 register_gdbarch_swap (&builtin_type_v8qi
, sizeof (struct type
*), NULL
);
3087 register_gdbarch_swap (&builtin_type_v4hi
, sizeof (struct type
*), NULL
);
3088 register_gdbarch_swap (&builtin_type_v2si
, sizeof (struct type
*), NULL
);
3089 REGISTER_GDBARCH_SWAP (builtin_type_ptr
);
3090 REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR
);
3091 REGISTER_GDBARCH_SWAP (builtin_type_bfd_vma
);
3092 register_gdbarch_swap (NULL
, 0, build_gdbtypes
);
3095 add_set_cmd ("overload", no_class
, var_zinteger
, (char *) &overload_debug
,
3096 "Set debugging of C++ overloading.\n\
3097 When enabled, ranking of the functions\n\
3098 is displayed.", &setdebuglist
),