1 /* Support routines for manipulating internal types for GDB.
2 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
4 Contributed by Cygnus Support, using pieces from other GDB modules.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 #include "gdb_string.h"
30 #include "expression.h"
35 #include "complaints.h"
39 #include "gdb_assert.h"
41 /* These variables point to the objects
42 representing the predefined C data types. */
44 struct type
*builtin_type_void
;
45 struct type
*builtin_type_char
;
46 struct type
*builtin_type_true_char
;
47 struct type
*builtin_type_short
;
48 struct type
*builtin_type_int
;
49 struct type
*builtin_type_long
;
50 struct type
*builtin_type_long_long
;
51 struct type
*builtin_type_signed_char
;
52 struct type
*builtin_type_unsigned_char
;
53 struct type
*builtin_type_unsigned_short
;
54 struct type
*builtin_type_unsigned_int
;
55 struct type
*builtin_type_unsigned_long
;
56 struct type
*builtin_type_unsigned_long_long
;
57 struct type
*builtin_type_float
;
58 struct type
*builtin_type_double
;
59 struct type
*builtin_type_long_double
;
60 struct type
*builtin_type_complex
;
61 struct type
*builtin_type_double_complex
;
62 struct type
*builtin_type_string
;
63 struct type
*builtin_type_int8
;
64 struct type
*builtin_type_uint8
;
65 struct type
*builtin_type_int16
;
66 struct type
*builtin_type_uint16
;
67 struct type
*builtin_type_int32
;
68 struct type
*builtin_type_uint32
;
69 struct type
*builtin_type_int64
;
70 struct type
*builtin_type_uint64
;
71 struct type
*builtin_type_int128
;
72 struct type
*builtin_type_uint128
;
73 struct type
*builtin_type_bool
;
74 struct type
*builtin_type_v4sf
;
75 struct type
*builtin_type_v4si
;
76 struct type
*builtin_type_v16qi
;
77 struct type
*builtin_type_v8qi
;
78 struct type
*builtin_type_v8hi
;
79 struct type
*builtin_type_v4hi
;
80 struct type
*builtin_type_v2si
;
81 struct type
*builtin_type_vec128
;
82 struct type
*builtin_type_ieee_single_big
;
83 struct type
*builtin_type_ieee_single_little
;
84 struct type
*builtin_type_ieee_double_big
;
85 struct type
*builtin_type_ieee_double_little
;
86 struct type
*builtin_type_ieee_double_littlebyte_bigword
;
87 struct type
*builtin_type_i387_ext
;
88 struct type
*builtin_type_m68881_ext
;
89 struct type
*builtin_type_i960_ext
;
90 struct type
*builtin_type_m88110_ext
;
91 struct type
*builtin_type_m88110_harris_ext
;
92 struct type
*builtin_type_arm_ext_big
;
93 struct type
*builtin_type_arm_ext_littlebyte_bigword
;
94 struct type
*builtin_type_ia64_spill_big
;
95 struct type
*builtin_type_ia64_spill_little
;
96 struct type
*builtin_type_ia64_quad_big
;
97 struct type
*builtin_type_ia64_quad_little
;
98 struct type
*builtin_type_void_data_ptr
;
99 struct type
*builtin_type_void_func_ptr
;
100 struct type
*builtin_type_CORE_ADDR
;
101 struct type
*builtin_type_bfd_vma
;
103 int opaque_type_resolution
= 1;
104 int overload_debug
= 0;
110 }; /* maximum extension is 128! FIXME */
112 static void add_name (struct extra
*, char *);
113 static void add_mangled_type (struct extra
*, struct type
*);
115 static void cfront_mangle_name (struct type
*, int, int);
117 static void print_bit_vector (B_TYPE
*, int);
118 static void print_arg_types (struct type
**, int);
119 static void dump_fn_fieldlists (struct type
*, int);
120 static void print_cplus_stuff (struct type
*, int);
121 static void virtual_base_list_aux (struct type
*dclass
);
124 /* Alloc a new type structure and fill it with some defaults. If
125 OBJFILE is non-NULL, then allocate the space for the type structure
126 in that objfile's type_obstack. */
129 alloc_type (struct objfile
*objfile
)
131 register struct type
*type
;
133 /* Alloc the structure and start off with all fields zeroed. */
137 type
= (struct type
*) xmalloc (sizeof (struct type
));
141 type
= (struct type
*) obstack_alloc (&objfile
->type_obstack
,
142 sizeof (struct type
));
143 OBJSTAT (objfile
, n_types
++);
145 memset ((char *) type
, 0, sizeof (struct type
));
147 /* Initialize the fields that might not be zero. */
149 TYPE_CODE (type
) = TYPE_CODE_UNDEF
;
150 TYPE_OBJFILE (type
) = objfile
;
151 TYPE_VPTR_FIELDNO (type
) = -1;
152 TYPE_CV_TYPE (type
) = type
; /* chain back to itself */
153 TYPE_AS_TYPE (type
) = type
; /* ditto */
158 /* Lookup a pointer to a type TYPE. TYPEPTR, if nonzero, points
159 to a pointer to memory where the pointer type should be stored.
160 If *TYPEPTR is zero, update it to point to the pointer type we return.
161 We allocate new memory if needed. */
164 make_pointer_type (struct type
*type
, struct type
**typeptr
)
166 register struct type
*ntype
; /* New type */
167 struct objfile
*objfile
;
169 ntype
= TYPE_POINTER_TYPE (type
);
174 return ntype
; /* Don't care about alloc, and have new type. */
175 else if (*typeptr
== 0)
177 *typeptr
= ntype
; /* Tracking alloc, and we have new type. */
182 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
184 ntype
= alloc_type (TYPE_OBJFILE (type
));
189 /* We have storage, but need to reset it. */
192 objfile
= TYPE_OBJFILE (ntype
);
193 memset ((char *) ntype
, 0, sizeof (struct type
));
194 TYPE_OBJFILE (ntype
) = objfile
;
197 TYPE_TARGET_TYPE (ntype
) = type
;
198 TYPE_POINTER_TYPE (type
) = ntype
;
200 /* FIXME! Assume the machine has only one representation for pointers! */
202 TYPE_LENGTH (ntype
) = TARGET_PTR_BIT
/ TARGET_CHAR_BIT
;
203 TYPE_CODE (ntype
) = TYPE_CODE_PTR
;
205 /* Mark pointers as unsigned. The target converts between pointers
206 and addresses (CORE_ADDRs) using POINTER_TO_ADDRESS() and
207 ADDRESS_TO_POINTER(). */
208 TYPE_FLAGS (ntype
) |= TYPE_FLAG_UNSIGNED
;
210 if (!TYPE_POINTER_TYPE (type
)) /* Remember it, if don't have one. */
211 TYPE_POINTER_TYPE (type
) = ntype
;
216 /* Given a type TYPE, return a type of pointers to that type.
217 May need to construct such a type if this is the first use. */
220 lookup_pointer_type (struct type
*type
)
222 return make_pointer_type (type
, (struct type
**) 0);
225 /* Lookup a C++ `reference' to a type TYPE. TYPEPTR, if nonzero, points
226 to a pointer to memory where the reference type should be stored.
227 If *TYPEPTR is zero, update it to point to the reference type we return.
228 We allocate new memory if needed. */
231 make_reference_type (struct type
*type
, struct type
**typeptr
)
233 register struct type
*ntype
; /* New type */
234 struct objfile
*objfile
;
236 ntype
= TYPE_REFERENCE_TYPE (type
);
241 return ntype
; /* Don't care about alloc, and have new type. */
242 else if (*typeptr
== 0)
244 *typeptr
= ntype
; /* Tracking alloc, and we have new type. */
249 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
251 ntype
= alloc_type (TYPE_OBJFILE (type
));
256 /* We have storage, but need to reset it. */
259 objfile
= TYPE_OBJFILE (ntype
);
260 memset ((char *) ntype
, 0, sizeof (struct type
));
261 TYPE_OBJFILE (ntype
) = objfile
;
264 TYPE_TARGET_TYPE (ntype
) = type
;
265 TYPE_REFERENCE_TYPE (type
) = ntype
;
267 /* FIXME! Assume the machine has only one representation for references,
268 and that it matches the (only) representation for pointers! */
270 TYPE_LENGTH (ntype
) = TARGET_PTR_BIT
/ TARGET_CHAR_BIT
;
271 TYPE_CODE (ntype
) = TYPE_CODE_REF
;
273 if (!TYPE_REFERENCE_TYPE (type
)) /* Remember it, if don't have one. */
274 TYPE_REFERENCE_TYPE (type
) = ntype
;
279 /* Same as above, but caller doesn't care about memory allocation details. */
282 lookup_reference_type (struct type
*type
)
284 return make_reference_type (type
, (struct type
**) 0);
287 /* Lookup a function type that returns type TYPE. TYPEPTR, if nonzero, points
288 to a pointer to memory where the function type should be stored.
289 If *TYPEPTR is zero, update it to point to the function type we return.
290 We allocate new memory if needed. */
293 make_function_type (struct type
*type
, struct type
**typeptr
)
295 register struct type
*ntype
; /* New type */
296 struct objfile
*objfile
;
298 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
300 ntype
= alloc_type (TYPE_OBJFILE (type
));
305 /* We have storage, but need to reset it. */
308 objfile
= TYPE_OBJFILE (ntype
);
309 memset ((char *) ntype
, 0, sizeof (struct type
));
310 TYPE_OBJFILE (ntype
) = objfile
;
313 TYPE_TARGET_TYPE (ntype
) = type
;
315 TYPE_LENGTH (ntype
) = 1;
316 TYPE_CODE (ntype
) = TYPE_CODE_FUNC
;
322 /* Given a type TYPE, return a type of functions that return that type.
323 May need to construct such a type if this is the first use. */
326 lookup_function_type (struct type
*type
)
328 return make_function_type (type
, (struct type
**) 0);
331 /* Identify address space identifier by name --
332 return the integer flag defined in gdbtypes.h. */
334 address_space_name_to_int (char *space_identifier
)
336 /* Check for known address space delimiters. */
337 if (!strcmp (space_identifier
, "code"))
338 return TYPE_FLAG_CODE_SPACE
;
339 else if (!strcmp (space_identifier
, "data"))
340 return TYPE_FLAG_DATA_SPACE
;
342 error ("Unknown address space specifier: \"%s\"", space_identifier
);
345 /* Identify address space identifier by integer flag as defined in
346 gdbtypes.h -- return the string version of the adress space name. */
349 address_space_int_to_name (int space_flag
)
351 if (space_flag
& TYPE_FLAG_CODE_SPACE
)
353 else if (space_flag
& TYPE_FLAG_DATA_SPACE
)
359 /* Make an address-space-delimited variant of a type -- a type that
360 is identical to the one supplied except that it has an address
361 space attribute attached to it (such as "code" or "data").
363 This is for Harvard architectures. */
366 make_type_with_address_space (struct type
*type
, int space_flag
)
372 if ((ntype
->flags
& space_flag
) != 0)
374 ntype
= TYPE_AS_TYPE (ntype
);
375 } while (ntype
!= type
);
377 /* Create a new, duplicate type. */
378 ntype
= alloc_type (TYPE_OBJFILE (type
));
379 /* Copy original type. */
380 memcpy ((char *) ntype
, (char *) type
, sizeof (struct type
));
382 /* Pointers or references to the original type are not relevant to
383 the new type; but if the original type is a pointer, the new type
384 points to the same thing (so TYPE_TARGET_TYPE remains unchanged). */
385 TYPE_POINTER_TYPE (ntype
) = (struct type
*) 0;
386 TYPE_REFERENCE_TYPE (ntype
) = (struct type
*) 0;
387 TYPE_CV_TYPE (ntype
) = ntype
;
389 /* Chain the new address-space-specific type to the old type. */
390 ntype
->as_type
= type
->as_type
;
391 type
->as_type
= ntype
;
393 /* Now set the address-space flag, and return the new type. */
394 ntype
->flags
|= space_flag
;
399 /* Make a "c-v" variant of a type -- a type that is identical to the
400 one supplied except that it may have const or volatile attributes
401 CNST is a flag for setting the const attribute
402 VOLTL is a flag for setting the volatile attribute
403 TYPE is the base type whose variant we are creating.
404 TYPEPTR, if nonzero, points
405 to a pointer to memory where the reference type should be stored.
406 If *TYPEPTR is zero, update it to point to the reference type we return.
407 We allocate new memory if needed. */
410 make_cv_type (int cnst
, int voltl
, struct type
*type
, struct type
**typeptr
)
412 register struct type
*ntype
; /* New type */
413 register struct type
*tmp_type
= type
; /* tmp type */
414 struct objfile
*objfile
;
416 ntype
= TYPE_CV_TYPE (type
);
418 while (ntype
!= type
)
420 if ((TYPE_CONST (ntype
) == cnst
) &&
421 (TYPE_VOLATILE (ntype
) == voltl
))
425 else if (*typeptr
== 0)
427 *typeptr
= ntype
; /* Tracking alloc, and we have new type. */
432 ntype
= TYPE_CV_TYPE (ntype
);
435 if (typeptr
== 0 || *typeptr
== 0) /* We'll need to allocate one. */
437 ntype
= alloc_type (TYPE_OBJFILE (type
));
442 /* We have storage, but need to reset it. */
445 objfile
= TYPE_OBJFILE (ntype
);
446 /* memset ((char *) ntype, 0, sizeof (struct type)); */
447 TYPE_OBJFILE (ntype
) = objfile
;
450 /* Copy original type */
451 memcpy ((char *) ntype
, (char *) type
, sizeof (struct type
));
452 /* But zero out fields that shouldn't be copied */
453 TYPE_POINTER_TYPE (ntype
) = (struct type
*) 0; /* Need new pointer kind */
454 TYPE_REFERENCE_TYPE (ntype
) = (struct type
*) 0; /* Need new referene kind */
455 TYPE_AS_TYPE (ntype
) = ntype
; /* Need new address-space kind. */
456 /* Note: TYPE_TARGET_TYPE can be left as is */
458 /* Set flags appropriately */
460 TYPE_FLAGS (ntype
) |= TYPE_FLAG_CONST
;
462 TYPE_FLAGS (ntype
) &= ~TYPE_FLAG_CONST
;
465 TYPE_FLAGS (ntype
) |= TYPE_FLAG_VOLATILE
;
467 TYPE_FLAGS (ntype
) &= ~TYPE_FLAG_VOLATILE
;
469 /* Fix the chain of cv variants */
470 TYPE_CV_TYPE (ntype
) = type
;
471 TYPE_CV_TYPE (tmp_type
) = ntype
;
476 /* When reading in a class type, we may have created references to
477 cv-qualified versions of the type (in method arguments, for
478 instance). Update everything on the cv ring from the primary
481 The only reason we do not need to do the same thing for address
482 spaces is that type readers do not create address space qualified
485 finish_cv_type (struct type
*type
)
487 struct type
*ntype
, *cv_type
, *ptr_type
, *ref_type
;
490 gdb_assert (!TYPE_CONST (type
) && !TYPE_VOLATILE (type
));
493 while ((ntype
= TYPE_CV_TYPE (ntype
)) != type
)
496 cv_flags
= TYPE_FLAGS (ntype
) & (TYPE_FLAG_VOLATILE
| TYPE_FLAG_CONST
);
498 /* If any reference or pointer types were created, save them too. */
499 ptr_type
= TYPE_POINTER_TYPE (ntype
);
500 ref_type
= TYPE_REFERENCE_TYPE (ntype
);
502 /* Don't disturb the CV chain. */
503 cv_type
= TYPE_CV_TYPE (ntype
);
505 /* Verify that we haven't added any address-space qualified types,
507 gdb_assert (ntype
== TYPE_AS_TYPE (ntype
));
509 /* Copy original type */
510 memcpy ((char *) ntype
, (char *) type
, sizeof (struct type
));
512 /* Restore everything. */
513 TYPE_POINTER_TYPE (ntype
) = ptr_type
;
514 TYPE_REFERENCE_TYPE (ntype
) = ref_type
;
515 TYPE_CV_TYPE (ntype
) = cv_type
;
516 TYPE_FLAGS (ntype
) = TYPE_FLAGS (ntype
) | cv_flags
;
518 TYPE_AS_TYPE (ntype
) = ntype
;
522 /* Replace the contents of ntype with the type *type.
524 This function should not be necessary, but is due to quirks in the stabs
525 reader. This should go away. It does not handle the replacement type
526 being cv-qualified; it could be easily fixed to, but it should go away,
529 replace_type (struct type
*ntype
, struct type
*type
)
531 struct type
*cv_chain
, *as_chain
, *ptr
, *ref
;
533 cv_chain
= TYPE_CV_TYPE (ntype
);
534 as_chain
= TYPE_AS_TYPE (ntype
);
535 ptr
= TYPE_POINTER_TYPE (ntype
);
536 ref
= TYPE_REFERENCE_TYPE (ntype
);
540 TYPE_POINTER_TYPE (ntype
) = ptr
;
541 TYPE_REFERENCE_TYPE (ntype
) = ref
;
542 TYPE_CV_TYPE (ntype
) = cv_chain
;
543 TYPE_AS_TYPE (ntype
) = as_chain
;
545 finish_cv_type (ntype
);
548 /* Implement direct support for MEMBER_TYPE in GNU C++.
549 May need to construct such a type if this is the first use.
550 The TYPE is the type of the member. The DOMAIN is the type
551 of the aggregate that the member belongs to. */
554 lookup_member_type (struct type
*type
, struct type
*domain
)
556 register struct type
*mtype
;
558 mtype
= alloc_type (TYPE_OBJFILE (type
));
559 smash_to_member_type (mtype
, domain
, type
);
563 /* Allocate a stub method whose return type is TYPE.
564 This apparently happens for speed of symbol reading, since parsing
565 out the arguments to the method is cpu-intensive, the way we are doing
566 it. So, we will fill in arguments later.
567 This always returns a fresh type. */
570 allocate_stub_method (struct type
*type
)
574 mtype
= init_type (TYPE_CODE_METHOD
, 1, TYPE_FLAG_STUB
, NULL
,
575 TYPE_OBJFILE (type
));
576 TYPE_TARGET_TYPE (mtype
) = type
;
577 /* _DOMAIN_TYPE (mtype) = unknown yet */
578 /* _ARG_TYPES (mtype) = unknown yet */
582 /* Create a range type using either a blank type supplied in RESULT_TYPE,
583 or creating a new type, inheriting the objfile from INDEX_TYPE.
585 Indices will be of type INDEX_TYPE, and will range from LOW_BOUND to
586 HIGH_BOUND, inclusive.
588 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
589 sure it is TYPE_CODE_UNDEF before we bash it into a range type? */
592 create_range_type (struct type
*result_type
, struct type
*index_type
,
593 int low_bound
, int high_bound
)
595 if (result_type
== NULL
)
597 result_type
= alloc_type (TYPE_OBJFILE (index_type
));
599 TYPE_CODE (result_type
) = TYPE_CODE_RANGE
;
600 TYPE_TARGET_TYPE (result_type
) = index_type
;
601 if (TYPE_STUB (index_type
))
602 TYPE_FLAGS (result_type
) |= TYPE_FLAG_TARGET_STUB
;
604 TYPE_LENGTH (result_type
) = TYPE_LENGTH (check_typedef (index_type
));
605 TYPE_NFIELDS (result_type
) = 2;
606 TYPE_FIELDS (result_type
) = (struct field
*)
607 TYPE_ALLOC (result_type
, 2 * sizeof (struct field
));
608 memset (TYPE_FIELDS (result_type
), 0, 2 * sizeof (struct field
));
609 TYPE_FIELD_BITPOS (result_type
, 0) = low_bound
;
610 TYPE_FIELD_BITPOS (result_type
, 1) = high_bound
;
611 TYPE_FIELD_TYPE (result_type
, 0) = builtin_type_int
; /* FIXME */
612 TYPE_FIELD_TYPE (result_type
, 1) = builtin_type_int
; /* FIXME */
615 TYPE_FLAGS (result_type
) |= TYPE_FLAG_UNSIGNED
;
617 return (result_type
);
620 /* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type TYPE.
621 Return 1 of type is a range type, 0 if it is discrete (and bounds
622 will fit in LONGEST), or -1 otherwise. */
625 get_discrete_bounds (struct type
*type
, LONGEST
*lowp
, LONGEST
*highp
)
627 CHECK_TYPEDEF (type
);
628 switch (TYPE_CODE (type
))
630 case TYPE_CODE_RANGE
:
631 *lowp
= TYPE_LOW_BOUND (type
);
632 *highp
= TYPE_HIGH_BOUND (type
);
635 if (TYPE_NFIELDS (type
) > 0)
637 /* The enums may not be sorted by value, so search all
641 *lowp
= *highp
= TYPE_FIELD_BITPOS (type
, 0);
642 for (i
= 0; i
< TYPE_NFIELDS (type
); i
++)
644 if (TYPE_FIELD_BITPOS (type
, i
) < *lowp
)
645 *lowp
= TYPE_FIELD_BITPOS (type
, i
);
646 if (TYPE_FIELD_BITPOS (type
, i
) > *highp
)
647 *highp
= TYPE_FIELD_BITPOS (type
, i
);
650 /* Set unsigned indicator if warranted. */
653 TYPE_FLAGS (type
) |= TYPE_FLAG_UNSIGNED
;
667 if (TYPE_LENGTH (type
) > sizeof (LONGEST
)) /* Too big */
669 if (!TYPE_UNSIGNED (type
))
671 *lowp
= -(1 << (TYPE_LENGTH (type
) * TARGET_CHAR_BIT
- 1));
675 /* ... fall through for unsigned ints ... */
678 /* This round-about calculation is to avoid shifting by
679 TYPE_LENGTH (type) * TARGET_CHAR_BIT, which will not work
680 if TYPE_LENGTH (type) == sizeof (LONGEST). */
681 *highp
= 1 << (TYPE_LENGTH (type
) * TARGET_CHAR_BIT
- 1);
682 *highp
= (*highp
- 1) | *highp
;
689 /* Create an array type using either a blank type supplied in RESULT_TYPE,
690 or creating a new type, inheriting the objfile from RANGE_TYPE.
692 Elements will be of type ELEMENT_TYPE, the indices will be of type
695 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
696 sure it is TYPE_CODE_UNDEF before we bash it into an array type? */
699 create_array_type (struct type
*result_type
, struct type
*element_type
,
700 struct type
*range_type
)
702 LONGEST low_bound
, high_bound
;
704 if (result_type
== NULL
)
706 result_type
= alloc_type (TYPE_OBJFILE (range_type
));
708 TYPE_CODE (result_type
) = TYPE_CODE_ARRAY
;
709 TYPE_TARGET_TYPE (result_type
) = element_type
;
710 if (get_discrete_bounds (range_type
, &low_bound
, &high_bound
) < 0)
711 low_bound
= high_bound
= 0;
712 CHECK_TYPEDEF (element_type
);
713 TYPE_LENGTH (result_type
) =
714 TYPE_LENGTH (element_type
) * (high_bound
- low_bound
+ 1);
715 TYPE_NFIELDS (result_type
) = 1;
716 TYPE_FIELDS (result_type
) =
717 (struct field
*) TYPE_ALLOC (result_type
, sizeof (struct field
));
718 memset (TYPE_FIELDS (result_type
), 0, sizeof (struct field
));
719 TYPE_FIELD_TYPE (result_type
, 0) = range_type
;
720 TYPE_VPTR_FIELDNO (result_type
) = -1;
722 /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays */
723 if (TYPE_LENGTH (result_type
) == 0)
724 TYPE_FLAGS (result_type
) |= TYPE_FLAG_TARGET_STUB
;
726 return (result_type
);
729 /* Create a string type using either a blank type supplied in RESULT_TYPE,
730 or creating a new type. String types are similar enough to array of
731 char types that we can use create_array_type to build the basic type
732 and then bash it into a string type.
734 For fixed length strings, the range type contains 0 as the lower
735 bound and the length of the string minus one as the upper bound.
737 FIXME: Maybe we should check the TYPE_CODE of RESULT_TYPE to make
738 sure it is TYPE_CODE_UNDEF before we bash it into a string type? */
741 create_string_type (struct type
*result_type
, struct type
*range_type
)
743 result_type
= create_array_type (result_type
,
744 *current_language
->string_char_type
,
746 TYPE_CODE (result_type
) = TYPE_CODE_STRING
;
747 return (result_type
);
751 create_set_type (struct type
*result_type
, struct type
*domain_type
)
753 LONGEST low_bound
, high_bound
, bit_length
;
754 if (result_type
== NULL
)
756 result_type
= alloc_type (TYPE_OBJFILE (domain_type
));
758 TYPE_CODE (result_type
) = TYPE_CODE_SET
;
759 TYPE_NFIELDS (result_type
) = 1;
760 TYPE_FIELDS (result_type
) = (struct field
*)
761 TYPE_ALLOC (result_type
, 1 * sizeof (struct field
));
762 memset (TYPE_FIELDS (result_type
), 0, sizeof (struct field
));
764 if (!TYPE_STUB (domain_type
))
766 if (get_discrete_bounds (domain_type
, &low_bound
, &high_bound
) < 0)
767 low_bound
= high_bound
= 0;
768 bit_length
= high_bound
- low_bound
+ 1;
769 TYPE_LENGTH (result_type
)
770 = (bit_length
+ TARGET_CHAR_BIT
- 1) / TARGET_CHAR_BIT
;
772 TYPE_FIELD_TYPE (result_type
, 0) = domain_type
;
775 TYPE_FLAGS (result_type
) |= TYPE_FLAG_UNSIGNED
;
777 return (result_type
);
780 /* Construct and return a type of the form:
781 struct NAME { ELT_TYPE ELT_NAME[N]; }
782 We use these types for SIMD registers. For example, the type of
783 the SSE registers on the late x86-family processors is:
784 struct __builtin_v4sf { float f[4]; }
785 built by the function call:
786 init_simd_type ("__builtin_v4sf", builtin_type_float, "f", 4)
787 The type returned is a permanent type, allocated using malloc; it
788 doesn't live in any objfile's obstack. */
790 init_simd_type (char *name
,
791 struct type
*elt_type
,
795 struct type
*simd_type
;
796 struct type
*array_type
;
798 simd_type
= init_composite_type (name
, TYPE_CODE_STRUCT
);
799 array_type
= create_array_type (0, elt_type
,
800 create_range_type (0, builtin_type_int
,
802 append_composite_type_field (simd_type
, elt_name
, array_type
);
807 build_builtin_type_vec128 (void)
809 /* Construct a type for the 128 bit registers. The type we're
812 union __gdb_builtin_type_vec128
814 struct __builtin_v16qi v16qi
;
815 struct __builtin_v8hi v8hi
;
816 struct __builtin_v4si v4si
;
817 struct __builtin_v4sf v4sf
;
824 t
= init_composite_type ("__gdb_builtin_type_vec128", TYPE_CODE_UNION
);
825 append_composite_type_field (t
, "uint128", builtin_type_int128
);
826 append_composite_type_field (t
, "v4sf", builtin_type_v4sf
);
827 append_composite_type_field (t
, "v4si", builtin_type_v4si
);
828 append_composite_type_field (t
, "v8hi", builtin_type_v8hi
);
829 append_composite_type_field (t
, "v16qi", builtin_type_v16qi
);
834 /* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE.
835 A MEMBER is a wierd thing -- it amounts to a typed offset into
836 a struct, e.g. "an int at offset 8". A MEMBER TYPE doesn't
837 include the offset (that's the value of the MEMBER itself), but does
838 include the structure type into which it points (for some reason).
840 When "smashing" the type, we preserve the objfile that the
841 old type pointed to, since we aren't changing where the type is actually
845 smash_to_member_type (struct type
*type
, struct type
*domain
,
846 struct type
*to_type
)
848 struct objfile
*objfile
;
850 objfile
= TYPE_OBJFILE (type
);
852 memset ((char *) type
, 0, sizeof (struct type
));
853 TYPE_OBJFILE (type
) = objfile
;
854 TYPE_TARGET_TYPE (type
) = to_type
;
855 TYPE_DOMAIN_TYPE (type
) = domain
;
856 TYPE_LENGTH (type
) = 1; /* In practice, this is never needed. */
857 TYPE_CODE (type
) = TYPE_CODE_MEMBER
;
860 /* Smash TYPE to be a type of method of DOMAIN with type TO_TYPE.
861 METHOD just means `function that gets an extra "this" argument'.
863 When "smashing" the type, we preserve the objfile that the
864 old type pointed to, since we aren't changing where the type is actually
868 smash_to_method_type (struct type
*type
, struct type
*domain
,
869 struct type
*to_type
, struct type
**args
)
871 struct objfile
*objfile
;
873 objfile
= TYPE_OBJFILE (type
);
875 memset ((char *) type
, 0, sizeof (struct type
));
876 TYPE_OBJFILE (type
) = objfile
;
877 TYPE_TARGET_TYPE (type
) = to_type
;
878 TYPE_DOMAIN_TYPE (type
) = domain
;
879 TYPE_ARG_TYPES (type
) = args
;
880 TYPE_LENGTH (type
) = 1; /* In practice, this is never needed. */
881 TYPE_CODE (type
) = TYPE_CODE_METHOD
;
884 /* Return a typename for a struct/union/enum type without "struct ",
885 "union ", or "enum ". If the type has a NULL name, return NULL. */
888 type_name_no_tag (register const struct type
*type
)
890 if (TYPE_TAG_NAME (type
) != NULL
)
891 return TYPE_TAG_NAME (type
);
893 /* Is there code which expects this to return the name if there is no
894 tag name? My guess is that this is mainly used for C++ in cases where
895 the two will always be the same. */
896 return TYPE_NAME (type
);
899 /* Lookup a primitive type named NAME.
900 Return zero if NAME is not a primitive type. */
903 lookup_primitive_typename (char *name
)
905 struct type
**const *p
;
907 for (p
= current_language
->la_builtin_type_vector
; *p
!= NULL
; p
++)
909 if (STREQ ((**p
)->name
, name
))
917 /* Lookup a typedef or primitive type named NAME,
918 visible in lexical block BLOCK.
919 If NOERR is nonzero, return zero if NAME is not suitably defined. */
922 lookup_typename (char *name
, struct block
*block
, int noerr
)
924 register struct symbol
*sym
;
925 register struct type
*tmp
;
927 sym
= lookup_symbol (name
, block
, VAR_NAMESPACE
, 0, (struct symtab
**) NULL
);
928 if (sym
== NULL
|| SYMBOL_CLASS (sym
) != LOC_TYPEDEF
)
930 tmp
= lookup_primitive_typename (name
);
935 else if (!tmp
&& noerr
)
941 error ("No type named %s.", name
);
944 return (SYMBOL_TYPE (sym
));
948 lookup_unsigned_typename (char *name
)
950 char *uns
= alloca (strlen (name
) + 10);
952 strcpy (uns
, "unsigned ");
953 strcpy (uns
+ 9, name
);
954 return (lookup_typename (uns
, (struct block
*) NULL
, 0));
958 lookup_signed_typename (char *name
)
961 char *uns
= alloca (strlen (name
) + 8);
963 strcpy (uns
, "signed ");
964 strcpy (uns
+ 7, name
);
965 t
= lookup_typename (uns
, (struct block
*) NULL
, 1);
966 /* If we don't find "signed FOO" just try again with plain "FOO". */
969 return lookup_typename (name
, (struct block
*) NULL
, 0);
972 /* Lookup a structure type named "struct NAME",
973 visible in lexical block BLOCK. */
976 lookup_struct (char *name
, struct block
*block
)
978 register struct symbol
*sym
;
980 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
981 (struct symtab
**) NULL
);
985 error ("No struct type named %s.", name
);
987 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
989 error ("This context has class, union or enum %s, not a struct.", name
);
991 return (SYMBOL_TYPE (sym
));
994 /* Lookup a union type named "union NAME",
995 visible in lexical block BLOCK. */
998 lookup_union (char *name
, struct block
*block
)
1000 register struct symbol
*sym
;
1003 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
1004 (struct symtab
**) NULL
);
1007 error ("No union type named %s.", name
);
1009 t
= SYMBOL_TYPE (sym
);
1011 if (TYPE_CODE (t
) == TYPE_CODE_UNION
)
1014 /* C++ unions may come out with TYPE_CODE_CLASS, but we look at
1015 * a further "declared_type" field to discover it is really a union.
1017 if (HAVE_CPLUS_STRUCT (t
))
1018 if (TYPE_DECLARED_TYPE (t
) == DECLARED_TYPE_UNION
)
1021 /* If we get here, it's not a union */
1022 error ("This context has class, struct or enum %s, not a union.", name
);
1026 /* Lookup an enum type named "enum NAME",
1027 visible in lexical block BLOCK. */
1030 lookup_enum (char *name
, struct block
*block
)
1032 register struct symbol
*sym
;
1034 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
1035 (struct symtab
**) NULL
);
1038 error ("No enum type named %s.", name
);
1040 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_ENUM
)
1042 error ("This context has class, struct or union %s, not an enum.", name
);
1044 return (SYMBOL_TYPE (sym
));
1047 /* Lookup a template type named "template NAME<TYPE>",
1048 visible in lexical block BLOCK. */
1051 lookup_template_type (char *name
, struct type
*type
, struct block
*block
)
1054 char *nam
= (char *) alloca (strlen (name
) + strlen (type
->name
) + 4);
1057 strcat (nam
, type
->name
);
1058 strcat (nam
, " >"); /* FIXME, extra space still introduced in gcc? */
1060 sym
= lookup_symbol (nam
, block
, VAR_NAMESPACE
, 0, (struct symtab
**) NULL
);
1064 error ("No template type named %s.", name
);
1066 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
1068 error ("This context has class, union or enum %s, not a struct.", name
);
1070 return (SYMBOL_TYPE (sym
));
1073 /* Given a type TYPE, lookup the type of the component of type named NAME.
1075 TYPE can be either a struct or union, or a pointer or reference to a struct or
1076 union. If it is a pointer or reference, its target type is automatically used.
1077 Thus '.' and '->' are interchangable, as specified for the definitions of the
1078 expression element types STRUCTOP_STRUCT and STRUCTOP_PTR.
1080 If NOERR is nonzero, return zero if NAME is not suitably defined.
1081 If NAME is the name of a baseclass type, return that type. */
1084 lookup_struct_elt_type (struct type
*type
, char *name
, int noerr
)
1090 CHECK_TYPEDEF (type
);
1091 if (TYPE_CODE (type
) != TYPE_CODE_PTR
1092 && TYPE_CODE (type
) != TYPE_CODE_REF
)
1094 type
= TYPE_TARGET_TYPE (type
);
1097 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
&&
1098 TYPE_CODE (type
) != TYPE_CODE_UNION
)
1100 target_terminal_ours ();
1101 gdb_flush (gdb_stdout
);
1102 fprintf_unfiltered (gdb_stderr
, "Type ");
1103 type_print (type
, "", gdb_stderr
, -1);
1104 error (" is not a structure or union type.");
1108 /* FIXME: This change put in by Michael seems incorrect for the case where
1109 the structure tag name is the same as the member name. I.E. when doing
1110 "ptype bell->bar" for "struct foo { int bar; int foo; } bell;"
1115 typename
= type_name_no_tag (type
);
1116 if (typename
!= NULL
&& STREQ (typename
, name
))
1121 for (i
= TYPE_NFIELDS (type
) - 1; i
>= TYPE_N_BASECLASSES (type
); i
--)
1123 char *t_field_name
= TYPE_FIELD_NAME (type
, i
);
1125 if (t_field_name
&& (strcmp_iw (t_field_name
, name
) == 0))
1127 return TYPE_FIELD_TYPE (type
, i
);
1131 /* OK, it's not in this class. Recursively check the baseclasses. */
1132 for (i
= TYPE_N_BASECLASSES (type
) - 1; i
>= 0; i
--)
1136 t
= lookup_struct_elt_type (TYPE_BASECLASS (type
, i
), name
, noerr
);
1148 target_terminal_ours ();
1149 gdb_flush (gdb_stdout
);
1150 fprintf_unfiltered (gdb_stderr
, "Type ");
1151 type_print (type
, "", gdb_stderr
, -1);
1152 fprintf_unfiltered (gdb_stderr
, " has no component named ");
1153 fputs_filtered (name
, gdb_stderr
);
1155 return (struct type
*) -1; /* For lint */
1158 /* If possible, make the vptr_fieldno and vptr_basetype fields of TYPE
1159 valid. Callers should be aware that in some cases (for example,
1160 the type or one of its baseclasses is a stub type and we are
1161 debugging a .o file), this function will not be able to find the virtual
1162 function table pointer, and vptr_fieldno will remain -1 and vptr_basetype
1163 will remain NULL. */
1166 fill_in_vptr_fieldno (struct type
*type
)
1168 CHECK_TYPEDEF (type
);
1170 if (TYPE_VPTR_FIELDNO (type
) < 0)
1174 /* We must start at zero in case the first (and only) baseclass is
1175 virtual (and hence we cannot share the table pointer). */
1176 for (i
= 0; i
< TYPE_N_BASECLASSES (type
); i
++)
1178 fill_in_vptr_fieldno (TYPE_BASECLASS (type
, i
));
1179 if (TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type
, i
)) >= 0)
1181 TYPE_VPTR_FIELDNO (type
)
1182 = TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type
, i
));
1183 TYPE_VPTR_BASETYPE (type
)
1184 = TYPE_VPTR_BASETYPE (TYPE_BASECLASS (type
, i
));
1191 /* Find the method and field indices for the destructor in class type T.
1192 Return 1 if the destructor was found, otherwise, return 0. */
1195 get_destructor_fn_field (struct type
*t
, int *method_indexp
, int *field_indexp
)
1199 for (i
= 0; i
< TYPE_NFN_FIELDS (t
); i
++)
1202 struct fn_field
*f
= TYPE_FN_FIELDLIST1 (t
, i
);
1204 for (j
= 0; j
< TYPE_FN_FIELDLIST_LENGTH (t
, i
); j
++)
1206 if (is_destructor_name (TYPE_FN_FIELD_PHYSNAME (f
, j
)) != 0)
1217 /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989.
1219 If this is a stubbed struct (i.e. declared as struct foo *), see if
1220 we can find a full definition in some other file. If so, copy this
1221 definition, so we can use it in future. There used to be a comment (but
1222 not any code) that if we don't find a full definition, we'd set a flag
1223 so we don't spend time in the future checking the same type. That would
1224 be a mistake, though--we might load in more symbols which contain a
1225 full definition for the type.
1227 This used to be coded as a macro, but I don't think it is called
1228 often enough to merit such treatment. */
1230 struct complaint stub_noname_complaint
=
1231 {"stub type has NULL name", 0, 0};
1234 check_typedef (struct type
*type
)
1236 struct type
*orig_type
= type
;
1237 int is_const
, is_volatile
;
1239 while (TYPE_CODE (type
) == TYPE_CODE_TYPEDEF
)
1241 if (!TYPE_TARGET_TYPE (type
))
1246 /* It is dangerous to call lookup_symbol if we are currently
1247 reading a symtab. Infinite recursion is one danger. */
1248 if (currently_reading_symtab
)
1251 name
= type_name_no_tag (type
);
1252 /* FIXME: shouldn't we separately check the TYPE_NAME and the
1253 TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE
1254 as appropriate? (this code was written before TYPE_NAME and
1255 TYPE_TAG_NAME were separate). */
1258 complain (&stub_noname_complaint
);
1261 sym
= lookup_symbol (name
, 0, STRUCT_NAMESPACE
, 0,
1262 (struct symtab
**) NULL
);
1264 TYPE_TARGET_TYPE (type
) = SYMBOL_TYPE (sym
);
1266 TYPE_TARGET_TYPE (type
) = alloc_type (NULL
); /* TYPE_CODE_UNDEF */
1268 type
= TYPE_TARGET_TYPE (type
);
1271 is_const
= TYPE_CONST (type
);
1272 is_volatile
= TYPE_VOLATILE (type
);
1274 /* If this is a struct/class/union with no fields, then check whether a
1275 full definition exists somewhere else. This is for systems where a
1276 type definition with no fields is issued for such types, instead of
1277 identifying them as stub types in the first place */
1279 if (TYPE_IS_OPAQUE (type
) && opaque_type_resolution
&& !currently_reading_symtab
)
1281 char *name
= type_name_no_tag (type
);
1282 struct type
*newtype
;
1285 complain (&stub_noname_complaint
);
1288 newtype
= lookup_transparent_type (name
);
1290 make_cv_type (is_const
, is_volatile
, newtype
, &type
);
1292 /* Otherwise, rely on the stub flag being set for opaque/stubbed types */
1293 else if (TYPE_STUB (type
) && !currently_reading_symtab
)
1295 char *name
= type_name_no_tag (type
);
1296 /* FIXME: shouldn't we separately check the TYPE_NAME and the
1297 TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE
1298 as appropriate? (this code was written before TYPE_NAME and
1299 TYPE_TAG_NAME were separate). */
1303 complain (&stub_noname_complaint
);
1306 sym
= lookup_symbol (name
, 0, STRUCT_NAMESPACE
, 0, (struct symtab
**) NULL
);
1308 make_cv_type (is_const
, is_volatile
, SYMBOL_TYPE (sym
), &type
);
1311 if (TYPE_TARGET_STUB (type
))
1313 struct type
*range_type
;
1314 struct type
*target_type
= check_typedef (TYPE_TARGET_TYPE (type
));
1316 if (TYPE_STUB (target_type
) || TYPE_TARGET_STUB (target_type
))
1319 else if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
1320 && TYPE_NFIELDS (type
) == 1
1321 && (TYPE_CODE (range_type
= TYPE_FIELD_TYPE (type
, 0))
1322 == TYPE_CODE_RANGE
))
1324 /* Now recompute the length of the array type, based on its
1325 number of elements and the target type's length. */
1326 TYPE_LENGTH (type
) =
1327 ((TYPE_FIELD_BITPOS (range_type
, 1)
1328 - TYPE_FIELD_BITPOS (range_type
, 0)
1330 * TYPE_LENGTH (target_type
));
1331 TYPE_FLAGS (type
) &= ~TYPE_FLAG_TARGET_STUB
;
1333 else if (TYPE_CODE (type
) == TYPE_CODE_RANGE
)
1335 TYPE_LENGTH (type
) = TYPE_LENGTH (target_type
);
1336 TYPE_FLAGS (type
) &= ~TYPE_FLAG_TARGET_STUB
;
1339 /* Cache TYPE_LENGTH for future use. */
1340 TYPE_LENGTH (orig_type
) = TYPE_LENGTH (type
);
1344 /* New code added to support parsing of Cfront stabs strings */
1345 #define INIT_EXTRA { pextras->len=0; pextras->str[0]='\0'; }
1346 #define ADD_EXTRA(c) { pextras->str[pextras->len++]=c; }
1349 add_name (struct extra
*pextras
, char *n
)
1353 if ((nlen
= (n
? strlen (n
) : 0)) == 0)
1355 sprintf (pextras
->str
+ pextras
->len
, "%d%s", nlen
, n
);
1356 pextras
->len
= strlen (pextras
->str
);
1360 add_mangled_type (struct extra
*pextras
, struct type
*t
)
1362 enum type_code tcode
;
1366 tcode
= TYPE_CODE (t
);
1367 tlen
= TYPE_LENGTH (t
);
1368 tflags
= TYPE_FLAGS (t
);
1369 tname
= TYPE_NAME (t
);
1370 /* args of "..." seem to get mangled as "e" */
1388 if ((pname
= strrchr (tname
, 'l'), pname
) && !strcmp (pname
, "long"))
1401 static struct complaint msg
=
1402 {"Bad int type code length x%x\n", 0, 0};
1404 complain (&msg
, tlen
);
1423 static struct complaint msg
=
1424 {"Bad float type code length x%x\n", 0, 0};
1425 complain (&msg
, tlen
);
1431 /* followed by what it's a ref to */
1435 /* followed by what it's a ptr to */
1437 case TYPE_CODE_TYPEDEF
:
1439 static struct complaint msg
=
1440 {"Typedefs in overloaded functions not yet supported\n", 0, 0};
1443 /* followed by type bytes & name */
1445 case TYPE_CODE_FUNC
:
1447 /* followed by func's arg '_' & ret types */
1449 case TYPE_CODE_VOID
:
1452 case TYPE_CODE_METHOD
:
1454 /* followed by name of class and func's arg '_' & ret types */
1455 add_name (pextras
, tname
);
1456 ADD_EXTRA ('F'); /* then mangle function */
1458 case TYPE_CODE_STRUCT
: /* C struct */
1459 case TYPE_CODE_UNION
: /* C union */
1460 case TYPE_CODE_ENUM
: /* Enumeration type */
1461 /* followed by name of type */
1462 add_name (pextras
, tname
);
1465 /* errors possible types/not supported */
1466 case TYPE_CODE_CHAR
:
1467 case TYPE_CODE_ARRAY
: /* Array type */
1468 case TYPE_CODE_MEMBER
: /* Member type */
1469 case TYPE_CODE_BOOL
:
1470 case TYPE_CODE_COMPLEX
: /* Complex float */
1471 case TYPE_CODE_UNDEF
:
1472 case TYPE_CODE_SET
: /* Pascal sets */
1473 case TYPE_CODE_RANGE
:
1474 case TYPE_CODE_STRING
:
1475 case TYPE_CODE_BITSTRING
:
1476 case TYPE_CODE_ERROR
:
1479 static struct complaint msg
=
1480 {"Unknown type code x%x\n", 0, 0};
1481 complain (&msg
, tcode
);
1485 add_mangled_type (pextras
, t
->target_type
);
1490 cfront_mangle_name (struct type
*type
, int i
, int j
)
1493 char *mangled_name
= gdb_mangle_name (type
, i
, j
);
1495 f
= TYPE_FN_FIELDLIST1 (type
, i
); /* moved from below */
1497 /* kludge to support cfront methods - gdb expects to find "F" for
1498 ARM_mangled names, so when we mangle, we have to add it here */
1502 char *arm_mangled_name
;
1503 struct fn_field
*method
= &f
[j
];
1504 char *field_name
= TYPE_FN_FIELDLIST_NAME (type
, i
);
1505 char *physname
= TYPE_FN_FIELD_PHYSNAME (f
, j
);
1506 char *newname
= type_name_no_tag (type
);
1508 struct type
*ftype
= TYPE_FN_FIELD_TYPE (f
, j
);
1509 int nargs
= TYPE_NFIELDS (ftype
); /* number of args */
1510 struct extra extras
, *pextras
= &extras
;
1513 if (TYPE_FN_FIELD_STATIC_P (f
, j
)) /* j for sublist within this list */
1516 /* add args here! */
1517 if (nargs
<= 1) /* no args besides this */
1521 for (k
= 1; k
< nargs
; k
++)
1524 t
= TYPE_FIELD_TYPE (ftype
, k
);
1525 add_mangled_type (pextras
, t
);
1529 printf ("add_mangled_type: %s\n", extras
.str
); /* FIXME */
1530 xasprintf (&arm_mangled_name
, "%s%s", mangled_name
, extras
.str
);
1531 xfree (mangled_name
);
1532 mangled_name
= arm_mangled_name
;
1538 /* End of new code added to support parsing of Cfront stabs strings */
1540 /* Parse a type expression in the string [P..P+LENGTH). If an error occurs,
1541 silently return builtin_type_void. */
1544 safe_parse_type (char *p
, int length
)
1546 struct ui_file
*saved_gdb_stderr
;
1549 /* Suppress error messages. */
1550 saved_gdb_stderr
= gdb_stderr
;
1551 gdb_stderr
= ui_file_new ();
1553 /* Call parse_and_eval_type() without fear of longjmp()s. */
1554 if (!gdb_parse_and_eval_type (p
, length
, &type
))
1555 type
= builtin_type_void
;
1557 /* Stop suppressing error messages. */
1558 ui_file_delete (gdb_stderr
);
1559 gdb_stderr
= saved_gdb_stderr
;
1564 /* Ugly hack to convert method stubs into method types.
1566 He ain't kiddin'. This demangles the name of the method into a string
1567 including argument types, parses out each argument type, generates
1568 a string casting a zero to that type, evaluates the string, and stuffs
1569 the resulting type into an argtype vector!!! Then it knows the type
1570 of the whole function (including argument types for overloading),
1571 which info used to be in the stab's but was removed to hack back
1572 the space required for them. */
1575 check_stub_method (struct type
*type
, int method_id
, int signature_id
)
1578 char *mangled_name
= gdb_mangle_name (type
, method_id
, signature_id
);
1579 char *demangled_name
= cplus_demangle (mangled_name
,
1580 DMGL_PARAMS
| DMGL_ANSI
);
1581 char *argtypetext
, *p
;
1582 int depth
= 0, argcount
= 1;
1583 struct type
**argtypes
;
1586 /* Make sure we got back a function string that we can use. */
1588 p
= strchr (demangled_name
, '(');
1592 if (demangled_name
== NULL
|| p
== NULL
)
1593 error ("Internal: Cannot demangle mangled name `%s'.", mangled_name
);
1595 /* Now, read in the parameters that define this type. */
1600 if (*p
== '(' || *p
== '<')
1604 else if (*p
== ')' || *p
== '>')
1608 else if (*p
== ',' && depth
== 0)
1616 /* We need two more slots: one for the THIS pointer, and one for the
1617 NULL [...] or void [end of arglist]. */
1619 argtypes
= (struct type
**)
1620 TYPE_ALLOC (type
, (argcount
+ 2) * sizeof (struct type
*));
1622 /* FIXME: This is wrong for static member functions. */
1623 argtypes
[0] = lookup_pointer_type (type
);
1626 if (*p
!= ')') /* () means no args, skip while */
1631 if (depth
<= 0 && (*p
== ',' || *p
== ')'))
1633 /* Avoid parsing of ellipsis, they will be handled below. */
1634 if (strncmp (argtypetext
, "...", p
- argtypetext
) != 0)
1636 argtypes
[argcount
] =
1637 safe_parse_type (argtypetext
, p
- argtypetext
);
1640 argtypetext
= p
+ 1;
1643 if (*p
== '(' || *p
== '<')
1647 else if (*p
== ')' || *p
== '>')
1656 if (p
[-2] != '.') /* Not '...' */
1658 argtypes
[argcount
] = builtin_type_void
; /* List terminator */
1662 argtypes
[argcount
] = NULL
; /* Ellist terminator */
1665 xfree (demangled_name
);
1667 f
= TYPE_FN_FIELDLIST1 (type
, method_id
);
1669 TYPE_FN_FIELD_PHYSNAME (f
, signature_id
) = mangled_name
;
1671 /* Now update the old "stub" type into a real type. */
1672 mtype
= TYPE_FN_FIELD_TYPE (f
, signature_id
);
1673 TYPE_DOMAIN_TYPE (mtype
) = type
;
1674 TYPE_ARG_TYPES (mtype
) = argtypes
;
1675 TYPE_FLAGS (mtype
) &= ~TYPE_FLAG_STUB
;
1676 TYPE_FN_FIELD_STUB (f
, signature_id
) = 0;
1679 const struct cplus_struct_type cplus_struct_default
;
1682 allocate_cplus_struct_type (struct type
*type
)
1684 if (!HAVE_CPLUS_STRUCT (type
))
1686 TYPE_CPLUS_SPECIFIC (type
) = (struct cplus_struct_type
*)
1687 TYPE_ALLOC (type
, sizeof (struct cplus_struct_type
));
1688 *(TYPE_CPLUS_SPECIFIC (type
)) = cplus_struct_default
;
1692 /* Helper function to initialize the standard scalar types.
1694 If NAME is non-NULL and OBJFILE is non-NULL, then we make a copy
1695 of the string pointed to by name in the type_obstack for that objfile,
1696 and initialize the type name to that copy. There are places (mipsread.c
1697 in particular, where init_type is called with a NULL value for NAME). */
1700 init_type (enum type_code code
, int length
, int flags
, char *name
,
1701 struct objfile
*objfile
)
1703 register struct type
*type
;
1705 type
= alloc_type (objfile
);
1706 TYPE_CODE (type
) = code
;
1707 TYPE_LENGTH (type
) = length
;
1708 TYPE_FLAGS (type
) |= flags
;
1709 if ((name
!= NULL
) && (objfile
!= NULL
))
1712 obsavestring (name
, strlen (name
), &objfile
->type_obstack
);
1716 TYPE_NAME (type
) = name
;
1721 if (code
== TYPE_CODE_STRUCT
|| code
== TYPE_CODE_UNION
)
1723 INIT_CPLUS_SPECIFIC (type
);
1728 /* Helper function. Create an empty composite type. */
1731 init_composite_type (char *name
, enum type_code code
)
1734 gdb_assert (code
== TYPE_CODE_STRUCT
1735 || code
== TYPE_CODE_UNION
);
1736 t
= init_type (code
, 0, 0, NULL
, NULL
);
1737 TYPE_TAG_NAME (t
) = name
;
1741 /* Helper function. Append a field to a composite type. */
1744 append_composite_type_field (struct type
*t
, char *name
, struct type
*field
)
1747 TYPE_NFIELDS (t
) = TYPE_NFIELDS (t
) + 1;
1748 TYPE_FIELDS (t
) = xrealloc (TYPE_FIELDS (t
),
1749 sizeof (struct field
) * TYPE_NFIELDS (t
));
1750 f
= &(TYPE_FIELDS (t
)[TYPE_NFIELDS (t
) - 1]);
1751 memset (f
, 0, sizeof f
[0]);
1752 FIELD_TYPE (f
[0]) = field
;
1753 FIELD_NAME (f
[0]) = name
;
1754 if (TYPE_CODE (t
) == TYPE_CODE_UNION
)
1756 if (TYPE_LENGTH (t
) < TYPE_LENGTH (field
))
1757 TYPE_LENGTH (t
) = TYPE_LENGTH (field
);
1759 else if (TYPE_CODE (t
) == TYPE_CODE_STRUCT
)
1761 TYPE_LENGTH (t
) = TYPE_LENGTH (t
) + TYPE_LENGTH (field
);
1762 if (TYPE_NFIELDS (t
) > 1)
1764 FIELD_BITPOS (f
[0]) = (FIELD_BITPOS (f
[-1])
1765 + TYPE_LENGTH (field
) * TARGET_CHAR_BIT
);
1770 /* Look up a fundamental type for the specified objfile.
1771 May need to construct such a type if this is the first use.
1773 Some object file formats (ELF, COFF, etc) do not define fundamental
1774 types such as "int" or "double". Others (stabs for example), do
1775 define fundamental types.
1777 For the formats which don't provide fundamental types, gdb can create
1778 such types, using defaults reasonable for the current language and
1779 the current target machine.
1781 NOTE: This routine is obsolescent. Each debugging format reader
1782 should manage it's own fundamental types, either creating them from
1783 suitable defaults or reading them from the debugging information,
1784 whichever is appropriate. The DWARF reader has already been
1785 fixed to do this. Once the other readers are fixed, this routine
1786 will go away. Also note that fundamental types should be managed
1787 on a compilation unit basis in a multi-language environment, not
1788 on a linkage unit basis as is done here. */
1792 lookup_fundamental_type (struct objfile
*objfile
, int typeid)
1794 register struct type
**typep
;
1795 register int nbytes
;
1797 if (typeid < 0 || typeid >= FT_NUM_MEMBERS
)
1799 error ("internal error - invalid fundamental type id %d", typeid);
1802 /* If this is the first time we need a fundamental type for this objfile
1803 then we need to initialize the vector of type pointers. */
1805 if (objfile
->fundamental_types
== NULL
)
1807 nbytes
= FT_NUM_MEMBERS
* sizeof (struct type
*);
1808 objfile
->fundamental_types
= (struct type
**)
1809 obstack_alloc (&objfile
->type_obstack
, nbytes
);
1810 memset ((char *) objfile
->fundamental_types
, 0, nbytes
);
1811 OBJSTAT (objfile
, n_types
+= FT_NUM_MEMBERS
);
1814 /* Look for this particular type in the fundamental type vector. If one is
1815 not found, create and install one appropriate for the current language. */
1817 typep
= objfile
->fundamental_types
+ typeid;
1820 *typep
= create_fundamental_type (objfile
, typeid);
1827 can_dereference (struct type
*t
)
1829 /* FIXME: Should we return true for references as well as pointers? */
1833 && TYPE_CODE (t
) == TYPE_CODE_PTR
1834 && TYPE_CODE (TYPE_TARGET_TYPE (t
)) != TYPE_CODE_VOID
);
1838 is_integral_type (struct type
*t
)
1843 && ((TYPE_CODE (t
) == TYPE_CODE_INT
)
1844 || (TYPE_CODE (t
) == TYPE_CODE_ENUM
)
1845 || (TYPE_CODE (t
) == TYPE_CODE_CHAR
)
1846 || (TYPE_CODE (t
) == TYPE_CODE_RANGE
)
1847 || (TYPE_CODE (t
) == TYPE_CODE_BOOL
)));
1850 /* Chill varying string and arrays are represented as follows:
1852 struct { int __var_length; ELEMENT_TYPE[MAX_SIZE] __var_data};
1854 Return true if TYPE is such a Chill varying type. */
1857 chill_varying_type (struct type
*type
)
1859 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
1860 || TYPE_NFIELDS (type
) != 2
1861 || strcmp (TYPE_FIELD_NAME (type
, 0), "__var_length") != 0)
1866 /* Check whether BASE is an ancestor or base class or DCLASS
1867 Return 1 if so, and 0 if not.
1868 Note: callers may want to check for identity of the types before
1869 calling this function -- identical types are considered to satisfy
1870 the ancestor relationship even if they're identical */
1873 is_ancestor (struct type
*base
, struct type
*dclass
)
1877 CHECK_TYPEDEF (base
);
1878 CHECK_TYPEDEF (dclass
);
1882 if (TYPE_NAME (base
) && TYPE_NAME (dclass
) &&
1883 !strcmp (TYPE_NAME (base
), TYPE_NAME (dclass
)))
1886 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1887 if (is_ancestor (base
, TYPE_BASECLASS (dclass
, i
)))
1895 /* See whether DCLASS has a virtual table. This routine is aimed at
1896 the HP/Taligent ANSI C++ runtime model, and may not work with other
1897 runtime models. Return 1 => Yes, 0 => No. */
1900 has_vtable (struct type
*dclass
)
1902 /* In the HP ANSI C++ runtime model, a class has a vtable only if it
1903 has virtual functions or virtual bases. */
1907 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
1910 /* First check for the presence of virtual bases */
1911 if (TYPE_FIELD_VIRTUAL_BITS (dclass
))
1912 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1913 if (B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass
), i
))
1916 /* Next check for virtual functions */
1917 if (TYPE_FN_FIELDLISTS (dclass
))
1918 for (i
= 0; i
< TYPE_NFN_FIELDS (dclass
); i
++)
1919 if (TYPE_FN_FIELD_VIRTUAL_P (TYPE_FN_FIELDLIST1 (dclass
, i
), 0))
1922 /* Recurse on non-virtual bases to see if any of them needs a vtable */
1923 if (TYPE_FIELD_VIRTUAL_BITS (dclass
))
1924 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1925 if ((!B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass
), i
)) &&
1926 (has_vtable (TYPE_FIELD_TYPE (dclass
, i
))))
1929 /* Well, maybe we don't need a virtual table */
1933 /* Return a pointer to the "primary base class" of DCLASS.
1935 A NULL return indicates that DCLASS has no primary base, or that it
1936 couldn't be found (insufficient information).
1938 This routine is aimed at the HP/Taligent ANSI C++ runtime model,
1939 and may not work with other runtime models. */
1942 primary_base_class (struct type
*dclass
)
1944 /* In HP ANSI C++'s runtime model, a "primary base class" of a class
1945 is the first directly inherited, non-virtual base class that
1946 requires a virtual table */
1950 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
1953 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1954 if (!TYPE_FIELD_VIRTUAL (dclass
, i
) &&
1955 has_vtable (TYPE_FIELD_TYPE (dclass
, i
)))
1956 return TYPE_FIELD_TYPE (dclass
, i
);
1961 /* Global manipulated by virtual_base_list[_aux]() */
1963 static struct vbase
*current_vbase_list
= NULL
;
1965 /* Return a pointer to a null-terminated list of struct vbase
1966 items. The vbasetype pointer of each item in the list points to the
1967 type information for a virtual base of the argument DCLASS.
1969 Helper function for virtual_base_list().
1970 Note: the list goes backward, right-to-left. virtual_base_list()
1971 copies the items out in reverse order. */
1974 virtual_base_list_aux (struct type
*dclass
)
1976 struct vbase
*tmp_vbase
;
1979 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
1982 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1984 /* Recurse on this ancestor, first */
1985 virtual_base_list_aux (TYPE_FIELD_TYPE (dclass
, i
));
1987 /* If this current base is itself virtual, add it to the list */
1988 if (BASETYPE_VIA_VIRTUAL (dclass
, i
))
1990 struct type
*basetype
= TYPE_FIELD_TYPE (dclass
, i
);
1992 /* Check if base already recorded */
1993 tmp_vbase
= current_vbase_list
;
1996 if (tmp_vbase
->vbasetype
== basetype
)
1997 break; /* found it */
1998 tmp_vbase
= tmp_vbase
->next
;
2001 if (!tmp_vbase
) /* normal exit from loop */
2003 /* Allocate new item for this virtual base */
2004 tmp_vbase
= (struct vbase
*) xmalloc (sizeof (struct vbase
));
2006 /* Stick it on at the end of the list */
2007 tmp_vbase
->vbasetype
= basetype
;
2008 tmp_vbase
->next
= current_vbase_list
;
2009 current_vbase_list
= tmp_vbase
;
2012 } /* for loop over bases */
2016 /* Compute the list of virtual bases in the right order. Virtual
2017 bases are laid out in the object's memory area in order of their
2018 occurrence in a depth-first, left-to-right search through the
2021 Argument DCLASS is the type whose virtual bases are required.
2022 Return value is the address of a null-terminated array of pointers
2023 to struct type items.
2025 This routine is aimed at the HP/Taligent ANSI C++ runtime model,
2026 and may not work with other runtime models.
2028 This routine merely hands off the argument to virtual_base_list_aux()
2029 and then copies the result into an array to save space. */
2032 virtual_base_list (struct type
*dclass
)
2034 register struct vbase
*tmp_vbase
;
2035 register struct vbase
*tmp_vbase_2
;
2038 struct type
**vbase_array
;
2040 current_vbase_list
= NULL
;
2041 virtual_base_list_aux (dclass
);
2043 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; i
++, tmp_vbase
= tmp_vbase
->next
)
2048 vbase_array
= (struct type
**) xmalloc ((count
+ 1) * sizeof (struct type
*));
2050 for (i
= count
- 1, tmp_vbase
= current_vbase_list
; i
>= 0; i
--, tmp_vbase
= tmp_vbase
->next
)
2051 vbase_array
[i
] = tmp_vbase
->vbasetype
;
2053 /* Get rid of constructed chain */
2054 tmp_vbase_2
= tmp_vbase
= current_vbase_list
;
2057 tmp_vbase
= tmp_vbase
->next
;
2058 xfree (tmp_vbase_2
);
2059 tmp_vbase_2
= tmp_vbase
;
2062 vbase_array
[count
] = NULL
;
2066 /* Return the length of the virtual base list of the type DCLASS. */
2069 virtual_base_list_length (struct type
*dclass
)
2072 register struct vbase
*tmp_vbase
;
2074 current_vbase_list
= NULL
;
2075 virtual_base_list_aux (dclass
);
2077 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; i
++, tmp_vbase
= tmp_vbase
->next
)
2082 /* Return the number of elements of the virtual base list of the type
2083 DCLASS, ignoring those appearing in the primary base (and its
2084 primary base, recursively). */
2087 virtual_base_list_length_skip_primaries (struct type
*dclass
)
2090 register struct vbase
*tmp_vbase
;
2091 struct type
*primary
;
2093 primary
= TYPE_RUNTIME_PTR (dclass
) ? TYPE_PRIMARY_BASE (dclass
) : NULL
;
2096 return virtual_base_list_length (dclass
);
2098 current_vbase_list
= NULL
;
2099 virtual_base_list_aux (dclass
);
2101 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; tmp_vbase
= tmp_vbase
->next
)
2103 if (virtual_base_index (tmp_vbase
->vbasetype
, primary
) >= 0)
2111 /* Return the index (position) of type BASE, which is a virtual base
2112 class of DCLASS, in the latter's virtual base list. A return of -1
2113 indicates "not found" or a problem. */
2116 virtual_base_index (struct type
*base
, struct type
*dclass
)
2118 register struct type
*vbase
;
2121 if ((TYPE_CODE (dclass
) != TYPE_CODE_CLASS
) ||
2122 (TYPE_CODE (base
) != TYPE_CODE_CLASS
))
2126 vbase
= virtual_base_list (dclass
)[0];
2131 vbase
= virtual_base_list (dclass
)[++i
];
2134 return vbase
? i
: -1;
2139 /* Return the index (position) of type BASE, which is a virtual base
2140 class of DCLASS, in the latter's virtual base list. Skip over all
2141 bases that may appear in the virtual base list of the primary base
2142 class of DCLASS (recursively). A return of -1 indicates "not
2143 found" or a problem. */
2146 virtual_base_index_skip_primaries (struct type
*base
, struct type
*dclass
)
2148 register struct type
*vbase
;
2150 struct type
*primary
;
2152 if ((TYPE_CODE (dclass
) != TYPE_CODE_CLASS
) ||
2153 (TYPE_CODE (base
) != TYPE_CODE_CLASS
))
2156 primary
= TYPE_RUNTIME_PTR (dclass
) ? TYPE_PRIMARY_BASE (dclass
) : NULL
;
2160 vbase
= virtual_base_list (dclass
)[0];
2163 if (!primary
|| (virtual_base_index_skip_primaries (vbase
, primary
) < 0))
2167 vbase
= virtual_base_list (dclass
)[++i
];
2170 return vbase
? j
: -1;
2173 /* Return position of a derived class DCLASS in the list of
2174 * primary bases starting with the remotest ancestor.
2175 * Position returned is 0-based. */
2178 class_index_in_primary_list (struct type
*dclass
)
2180 struct type
*pbc
; /* primary base class */
2182 /* Simply recurse on primary base */
2183 pbc
= TYPE_PRIMARY_BASE (dclass
);
2185 return 1 + class_index_in_primary_list (pbc
);
2190 /* Return a count of the number of virtual functions a type has.
2191 * This includes all the virtual functions it inherits from its
2195 /* pai: FIXME This doesn't do the right thing: count redefined virtual
2196 * functions only once (latest redefinition)
2200 count_virtual_fns (struct type
*dclass
)
2202 int fn
, oi
; /* function and overloaded instance indices */
2203 int vfuncs
; /* count to return */
2205 /* recurse on bases that can share virtual table */
2206 struct type
*pbc
= primary_base_class (dclass
);
2208 vfuncs
= count_virtual_fns (pbc
);
2212 for (fn
= 0; fn
< TYPE_NFN_FIELDS (dclass
); fn
++)
2213 for (oi
= 0; oi
< TYPE_FN_FIELDLIST_LENGTH (dclass
, fn
); oi
++)
2214 if (TYPE_FN_FIELD_VIRTUAL_P (TYPE_FN_FIELDLIST1 (dclass
, fn
), oi
))
2222 /* Functions for overload resolution begin here */
2224 /* Compare two badness vectors A and B and return the result.
2225 * 0 => A and B are identical
2226 * 1 => A and B are incomparable
2227 * 2 => A is better than B
2228 * 3 => A is worse than B */
2231 compare_badness (struct badness_vector
*a
, struct badness_vector
*b
)
2235 short found_pos
= 0; /* any positives in c? */
2236 short found_neg
= 0; /* any negatives in c? */
2238 /* differing lengths => incomparable */
2239 if (a
->length
!= b
->length
)
2242 /* Subtract b from a */
2243 for (i
= 0; i
< a
->length
; i
++)
2245 tmp
= a
->rank
[i
] - b
->rank
[i
];
2255 return 1; /* incomparable */
2257 return 3; /* A > B */
2263 return 2; /* A < B */
2265 return 0; /* A == B */
2269 /* Rank a function by comparing its parameter types (PARMS, length NPARMS),
2270 * to the types of an argument list (ARGS, length NARGS).
2271 * Return a pointer to a badness vector. This has NARGS + 1 entries. */
2273 struct badness_vector
*
2274 rank_function (struct type
**parms
, int nparms
, struct type
**args
, int nargs
)
2277 struct badness_vector
*bv
;
2278 int min_len
= nparms
< nargs
? nparms
: nargs
;
2280 bv
= xmalloc (sizeof (struct badness_vector
));
2281 bv
->length
= nargs
+ 1; /* add 1 for the length-match rank */
2282 bv
->rank
= xmalloc ((nargs
+ 1) * sizeof (int));
2284 /* First compare the lengths of the supplied lists.
2285 * If there is a mismatch, set it to a high value. */
2287 /* pai/1997-06-03 FIXME: when we have debug info about default
2288 * arguments and ellipsis parameter lists, we should consider those
2289 * and rank the length-match more finely. */
2291 LENGTH_MATCH (bv
) = (nargs
!= nparms
) ? LENGTH_MISMATCH_BADNESS
: 0;
2293 /* Now rank all the parameters of the candidate function */
2294 for (i
= 1; i
<= min_len
; i
++)
2295 bv
->rank
[i
] = rank_one_type (parms
[i
-1], args
[i
-1]);
2297 /* If more arguments than parameters, add dummy entries */
2298 for (i
= min_len
+ 1; i
<= nargs
; i
++)
2299 bv
->rank
[i
] = TOO_FEW_PARAMS_BADNESS
;
2304 /* Compare one type (PARM) for compatibility with another (ARG).
2305 * PARM is intended to be the parameter type of a function; and
2306 * ARG is the supplied argument's type. This function tests if
2307 * the latter can be converted to the former.
2309 * Return 0 if they are identical types;
2310 * Otherwise, return an integer which corresponds to how compatible
2311 * PARM is to ARG. The higher the return value, the worse the match.
2312 * Generally the "bad" conversions are all uniformly assigned a 100 */
2315 rank_one_type (struct type
*parm
, struct type
*arg
)
2317 /* Identical type pointers */
2318 /* However, this still doesn't catch all cases of same type for arg
2319 * and param. The reason is that builtin types are different from
2320 * the same ones constructed from the object. */
2324 /* Resolve typedefs */
2325 if (TYPE_CODE (parm
) == TYPE_CODE_TYPEDEF
)
2326 parm
= check_typedef (parm
);
2327 if (TYPE_CODE (arg
) == TYPE_CODE_TYPEDEF
)
2328 arg
= check_typedef (arg
);
2331 Well, damnit, if the names are exactly the same,
2332 i'll say they are exactly the same. This happens when we generate
2333 method stubs. The types won't point to the same address, but they
2334 really are the same.
2337 if (TYPE_NAME (parm
) && TYPE_NAME (arg
) &&
2338 !strcmp (TYPE_NAME (parm
), TYPE_NAME (arg
)))
2341 /* Check if identical after resolving typedefs */
2345 /* See through references, since we can almost make non-references
2347 if (TYPE_CODE (arg
) == TYPE_CODE_REF
)
2348 return (rank_one_type (parm
, TYPE_TARGET_TYPE (arg
))
2349 + REFERENCE_CONVERSION_BADNESS
);
2350 if (TYPE_CODE (parm
) == TYPE_CODE_REF
)
2351 return (rank_one_type (TYPE_TARGET_TYPE (parm
), arg
)
2352 + REFERENCE_CONVERSION_BADNESS
);
2354 /* Debugging only. */
2355 fprintf_filtered (gdb_stderr
,"------ Arg is %s [%d], parm is %s [%d]\n",
2356 TYPE_NAME (arg
), TYPE_CODE (arg
), TYPE_NAME (parm
), TYPE_CODE (parm
));
2358 /* x -> y means arg of type x being supplied for parameter of type y */
2360 switch (TYPE_CODE (parm
))
2363 switch (TYPE_CODE (arg
))
2366 if (TYPE_CODE (TYPE_TARGET_TYPE (parm
)) == TYPE_CODE_VOID
)
2367 return VOID_PTR_CONVERSION_BADNESS
;
2369 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2370 case TYPE_CODE_ARRAY
:
2371 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2372 case TYPE_CODE_FUNC
:
2373 return rank_one_type (TYPE_TARGET_TYPE (parm
), arg
);
2375 case TYPE_CODE_ENUM
:
2376 case TYPE_CODE_CHAR
:
2377 case TYPE_CODE_RANGE
:
2378 case TYPE_CODE_BOOL
:
2379 return POINTER_CONVERSION_BADNESS
;
2381 return INCOMPATIBLE_TYPE_BADNESS
;
2383 case TYPE_CODE_ARRAY
:
2384 switch (TYPE_CODE (arg
))
2387 case TYPE_CODE_ARRAY
:
2388 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2390 return INCOMPATIBLE_TYPE_BADNESS
;
2392 case TYPE_CODE_FUNC
:
2393 switch (TYPE_CODE (arg
))
2395 case TYPE_CODE_PTR
: /* funcptr -> func */
2396 return rank_one_type (parm
, TYPE_TARGET_TYPE (arg
));
2398 return INCOMPATIBLE_TYPE_BADNESS
;
2401 switch (TYPE_CODE (arg
))
2404 if (TYPE_LENGTH (arg
) == TYPE_LENGTH (parm
))
2406 /* Deal with signed, unsigned, and plain chars and
2407 signed and unsigned ints */
2408 if (TYPE_NOSIGN (parm
))
2410 /* This case only for character types */
2411 if (TYPE_NOSIGN (arg
)) /* plain char -> plain char */
2414 return INTEGER_COERCION_BADNESS
; /* signed/unsigned char -> plain char */
2416 else if (TYPE_UNSIGNED (parm
))
2418 if (TYPE_UNSIGNED (arg
))
2420 if (!strcmp_iw (TYPE_NAME (parm
), TYPE_NAME (arg
)))
2421 return 0; /* unsigned int -> unsigned int, or unsigned long -> unsigned long */
2422 else if (!strcmp_iw (TYPE_NAME (arg
), "int") && !strcmp_iw (TYPE_NAME (parm
), "long"))
2423 return INTEGER_PROMOTION_BADNESS
; /* unsigned int -> unsigned long */
2425 return INTEGER_COERCION_BADNESS
; /* unsigned long -> unsigned int */
2429 if (!strcmp_iw (TYPE_NAME (arg
), "long") && !strcmp_iw (TYPE_NAME (parm
), "int"))
2430 return INTEGER_COERCION_BADNESS
; /* signed long -> unsigned int */
2432 return INTEGER_CONVERSION_BADNESS
; /* signed int/long -> unsigned int/long */
2435 else if (!TYPE_NOSIGN (arg
) && !TYPE_UNSIGNED (arg
))
2437 if (!strcmp_iw (TYPE_NAME (parm
), TYPE_NAME (arg
)))
2439 else if (!strcmp_iw (TYPE_NAME (arg
), "int") && !strcmp_iw (TYPE_NAME (parm
), "long"))
2440 return INTEGER_PROMOTION_BADNESS
;
2442 return INTEGER_COERCION_BADNESS
;
2445 return INTEGER_COERCION_BADNESS
;
2447 else if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2448 return INTEGER_PROMOTION_BADNESS
;
2450 return INTEGER_COERCION_BADNESS
;
2451 case TYPE_CODE_ENUM
:
2452 case TYPE_CODE_CHAR
:
2453 case TYPE_CODE_RANGE
:
2454 case TYPE_CODE_BOOL
:
2455 return INTEGER_PROMOTION_BADNESS
;
2457 return INT_FLOAT_CONVERSION_BADNESS
;
2459 return NS_POINTER_CONVERSION_BADNESS
;
2461 return INCOMPATIBLE_TYPE_BADNESS
;
2464 case TYPE_CODE_ENUM
:
2465 switch (TYPE_CODE (arg
))
2468 case TYPE_CODE_CHAR
:
2469 case TYPE_CODE_RANGE
:
2470 case TYPE_CODE_BOOL
:
2471 case TYPE_CODE_ENUM
:
2472 return INTEGER_COERCION_BADNESS
;
2474 return INT_FLOAT_CONVERSION_BADNESS
;
2476 return INCOMPATIBLE_TYPE_BADNESS
;
2479 case TYPE_CODE_CHAR
:
2480 switch (TYPE_CODE (arg
))
2482 case TYPE_CODE_RANGE
:
2483 case TYPE_CODE_BOOL
:
2484 case TYPE_CODE_ENUM
:
2485 return INTEGER_COERCION_BADNESS
;
2487 return INT_FLOAT_CONVERSION_BADNESS
;
2489 if (TYPE_LENGTH (arg
) > TYPE_LENGTH (parm
))
2490 return INTEGER_COERCION_BADNESS
;
2491 else if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2492 return INTEGER_PROMOTION_BADNESS
;
2493 /* >>> !! else fall through !! <<< */
2494 case TYPE_CODE_CHAR
:
2495 /* Deal with signed, unsigned, and plain chars for C++
2496 and with int cases falling through from previous case */
2497 if (TYPE_NOSIGN (parm
))
2499 if (TYPE_NOSIGN (arg
))
2502 return INTEGER_COERCION_BADNESS
;
2504 else if (TYPE_UNSIGNED (parm
))
2506 if (TYPE_UNSIGNED (arg
))
2509 return INTEGER_PROMOTION_BADNESS
;
2511 else if (!TYPE_NOSIGN (arg
) && !TYPE_UNSIGNED (arg
))
2514 return INTEGER_COERCION_BADNESS
;
2516 return INCOMPATIBLE_TYPE_BADNESS
;
2519 case TYPE_CODE_RANGE
:
2520 switch (TYPE_CODE (arg
))
2523 case TYPE_CODE_CHAR
:
2524 case TYPE_CODE_RANGE
:
2525 case TYPE_CODE_BOOL
:
2526 case TYPE_CODE_ENUM
:
2527 return INTEGER_COERCION_BADNESS
;
2529 return INT_FLOAT_CONVERSION_BADNESS
;
2531 return INCOMPATIBLE_TYPE_BADNESS
;
2534 case TYPE_CODE_BOOL
:
2535 switch (TYPE_CODE (arg
))
2538 case TYPE_CODE_CHAR
:
2539 case TYPE_CODE_RANGE
:
2540 case TYPE_CODE_ENUM
:
2543 return BOOLEAN_CONVERSION_BADNESS
;
2544 case TYPE_CODE_BOOL
:
2547 return INCOMPATIBLE_TYPE_BADNESS
;
2551 switch (TYPE_CODE (arg
))
2554 if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2555 return FLOAT_PROMOTION_BADNESS
;
2556 else if (TYPE_LENGTH (arg
) == TYPE_LENGTH (parm
))
2559 return FLOAT_CONVERSION_BADNESS
;
2561 case TYPE_CODE_BOOL
:
2562 case TYPE_CODE_ENUM
:
2563 case TYPE_CODE_RANGE
:
2564 case TYPE_CODE_CHAR
:
2565 return INT_FLOAT_CONVERSION_BADNESS
;
2567 return INCOMPATIBLE_TYPE_BADNESS
;
2570 case TYPE_CODE_COMPLEX
:
2571 switch (TYPE_CODE (arg
))
2572 { /* Strictly not needed for C++, but... */
2574 return FLOAT_PROMOTION_BADNESS
;
2575 case TYPE_CODE_COMPLEX
:
2578 return INCOMPATIBLE_TYPE_BADNESS
;
2581 case TYPE_CODE_STRUCT
:
2582 /* currently same as TYPE_CODE_CLASS */
2583 switch (TYPE_CODE (arg
))
2585 case TYPE_CODE_STRUCT
:
2586 /* Check for derivation */
2587 if (is_ancestor (parm
, arg
))
2588 return BASE_CONVERSION_BADNESS
;
2589 /* else fall through */
2591 return INCOMPATIBLE_TYPE_BADNESS
;
2594 case TYPE_CODE_UNION
:
2595 switch (TYPE_CODE (arg
))
2597 case TYPE_CODE_UNION
:
2599 return INCOMPATIBLE_TYPE_BADNESS
;
2602 case TYPE_CODE_MEMBER
:
2603 switch (TYPE_CODE (arg
))
2606 return INCOMPATIBLE_TYPE_BADNESS
;
2609 case TYPE_CODE_METHOD
:
2610 switch (TYPE_CODE (arg
))
2614 return INCOMPATIBLE_TYPE_BADNESS
;
2618 switch (TYPE_CODE (arg
))
2622 return INCOMPATIBLE_TYPE_BADNESS
;
2627 switch (TYPE_CODE (arg
))
2631 return rank_one_type (TYPE_FIELD_TYPE (parm
, 0), TYPE_FIELD_TYPE (arg
, 0));
2633 return INCOMPATIBLE_TYPE_BADNESS
;
2636 case TYPE_CODE_VOID
:
2638 return INCOMPATIBLE_TYPE_BADNESS
;
2639 } /* switch (TYPE_CODE (arg)) */
2643 /* End of functions for overload resolution */
2646 print_bit_vector (B_TYPE
*bits
, int nbits
)
2650 for (bitno
= 0; bitno
< nbits
; bitno
++)
2652 if ((bitno
% 8) == 0)
2654 puts_filtered (" ");
2656 if (B_TST (bits
, bitno
))
2658 printf_filtered ("1");
2662 printf_filtered ("0");
2667 /* The args list is a strange beast. It is either terminated by a NULL
2668 pointer for varargs functions, or by a pointer to a TYPE_CODE_VOID
2669 type for normal fixed argcount functions. (FIXME someday)
2670 Also note the first arg should be the "this" pointer, we may not want to
2671 include it since we may get into a infinitely recursive situation. */
2674 print_arg_types (struct type
**args
, int spaces
)
2678 while (*args
!= NULL
)
2680 recursive_dump_type (*args
, spaces
+ 2);
2681 if ((*args
++)->code
== TYPE_CODE_VOID
)
2690 dump_fn_fieldlists (struct type
*type
, int spaces
)
2696 printfi_filtered (spaces
, "fn_fieldlists ");
2697 gdb_print_host_address (TYPE_FN_FIELDLISTS (type
), gdb_stdout
);
2698 printf_filtered ("\n");
2699 for (method_idx
= 0; method_idx
< TYPE_NFN_FIELDS (type
); method_idx
++)
2701 f
= TYPE_FN_FIELDLIST1 (type
, method_idx
);
2702 printfi_filtered (spaces
+ 2, "[%d] name '%s' (",
2704 TYPE_FN_FIELDLIST_NAME (type
, method_idx
));
2705 gdb_print_host_address (TYPE_FN_FIELDLIST_NAME (type
, method_idx
),
2707 printf_filtered (") length %d\n",
2708 TYPE_FN_FIELDLIST_LENGTH (type
, method_idx
));
2709 for (overload_idx
= 0;
2710 overload_idx
< TYPE_FN_FIELDLIST_LENGTH (type
, method_idx
);
2713 printfi_filtered (spaces
+ 4, "[%d] physname '%s' (",
2715 TYPE_FN_FIELD_PHYSNAME (f
, overload_idx
));
2716 gdb_print_host_address (TYPE_FN_FIELD_PHYSNAME (f
, overload_idx
),
2718 printf_filtered (")\n");
2719 printfi_filtered (spaces
+ 8, "type ");
2720 gdb_print_host_address (TYPE_FN_FIELD_TYPE (f
, overload_idx
), gdb_stdout
);
2721 printf_filtered ("\n");
2723 recursive_dump_type (TYPE_FN_FIELD_TYPE (f
, overload_idx
),
2726 printfi_filtered (spaces
+ 8, "args ");
2727 gdb_print_host_address (TYPE_FN_FIELD_ARGS (f
, overload_idx
), gdb_stdout
);
2728 printf_filtered ("\n");
2730 print_arg_types (TYPE_FN_FIELD_ARGS (f
, overload_idx
), spaces
);
2731 printfi_filtered (spaces
+ 8, "fcontext ");
2732 gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f
, overload_idx
),
2734 printf_filtered ("\n");
2736 printfi_filtered (spaces
+ 8, "is_const %d\n",
2737 TYPE_FN_FIELD_CONST (f
, overload_idx
));
2738 printfi_filtered (spaces
+ 8, "is_volatile %d\n",
2739 TYPE_FN_FIELD_VOLATILE (f
, overload_idx
));
2740 printfi_filtered (spaces
+ 8, "is_private %d\n",
2741 TYPE_FN_FIELD_PRIVATE (f
, overload_idx
));
2742 printfi_filtered (spaces
+ 8, "is_protected %d\n",
2743 TYPE_FN_FIELD_PROTECTED (f
, overload_idx
));
2744 printfi_filtered (spaces
+ 8, "is_stub %d\n",
2745 TYPE_FN_FIELD_STUB (f
, overload_idx
));
2746 printfi_filtered (spaces
+ 8, "voffset %u\n",
2747 TYPE_FN_FIELD_VOFFSET (f
, overload_idx
));
2753 print_cplus_stuff (struct type
*type
, int spaces
)
2755 printfi_filtered (spaces
, "n_baseclasses %d\n",
2756 TYPE_N_BASECLASSES (type
));
2757 printfi_filtered (spaces
, "nfn_fields %d\n",
2758 TYPE_NFN_FIELDS (type
));
2759 printfi_filtered (spaces
, "nfn_fields_total %d\n",
2760 TYPE_NFN_FIELDS_TOTAL (type
));
2761 if (TYPE_N_BASECLASSES (type
) > 0)
2763 printfi_filtered (spaces
, "virtual_field_bits (%d bits at *",
2764 TYPE_N_BASECLASSES (type
));
2765 gdb_print_host_address (TYPE_FIELD_VIRTUAL_BITS (type
), gdb_stdout
);
2766 printf_filtered (")");
2768 print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type
),
2769 TYPE_N_BASECLASSES (type
));
2770 puts_filtered ("\n");
2772 if (TYPE_NFIELDS (type
) > 0)
2774 if (TYPE_FIELD_PRIVATE_BITS (type
) != NULL
)
2776 printfi_filtered (spaces
, "private_field_bits (%d bits at *",
2777 TYPE_NFIELDS (type
));
2778 gdb_print_host_address (TYPE_FIELD_PRIVATE_BITS (type
), gdb_stdout
);
2779 printf_filtered (")");
2780 print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type
),
2781 TYPE_NFIELDS (type
));
2782 puts_filtered ("\n");
2784 if (TYPE_FIELD_PROTECTED_BITS (type
) != NULL
)
2786 printfi_filtered (spaces
, "protected_field_bits (%d bits at *",
2787 TYPE_NFIELDS (type
));
2788 gdb_print_host_address (TYPE_FIELD_PROTECTED_BITS (type
), gdb_stdout
);
2789 printf_filtered (")");
2790 print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type
),
2791 TYPE_NFIELDS (type
));
2792 puts_filtered ("\n");
2795 if (TYPE_NFN_FIELDS (type
) > 0)
2797 dump_fn_fieldlists (type
, spaces
);
2802 print_bound_type (int bt
)
2806 case BOUND_CANNOT_BE_DETERMINED
:
2807 printf_filtered ("(BOUND_CANNOT_BE_DETERMINED)");
2809 case BOUND_BY_REF_ON_STACK
:
2810 printf_filtered ("(BOUND_BY_REF_ON_STACK)");
2812 case BOUND_BY_VALUE_ON_STACK
:
2813 printf_filtered ("(BOUND_BY_VALUE_ON_STACK)");
2815 case BOUND_BY_REF_IN_REG
:
2816 printf_filtered ("(BOUND_BY_REF_IN_REG)");
2818 case BOUND_BY_VALUE_IN_REG
:
2819 printf_filtered ("(BOUND_BY_VALUE_IN_REG)");
2822 printf_filtered ("(BOUND_SIMPLE)");
2825 printf_filtered ("(unknown bound type)");
2830 static struct obstack dont_print_type_obstack
;
2833 recursive_dump_type (struct type
*type
, int spaces
)
2838 obstack_begin (&dont_print_type_obstack
, 0);
2840 if (TYPE_NFIELDS (type
) > 0
2841 || (TYPE_CPLUS_SPECIFIC (type
) && TYPE_NFN_FIELDS (type
) > 0))
2843 struct type
**first_dont_print
2844 = (struct type
**) obstack_base (&dont_print_type_obstack
);
2846 int i
= (struct type
**) obstack_next_free (&dont_print_type_obstack
)
2851 if (type
== first_dont_print
[i
])
2853 printfi_filtered (spaces
, "type node ");
2854 gdb_print_host_address (type
, gdb_stdout
);
2855 printf_filtered (" <same as already seen type>\n");
2860 obstack_ptr_grow (&dont_print_type_obstack
, type
);
2863 printfi_filtered (spaces
, "type node ");
2864 gdb_print_host_address (type
, gdb_stdout
);
2865 printf_filtered ("\n");
2866 printfi_filtered (spaces
, "name '%s' (",
2867 TYPE_NAME (type
) ? TYPE_NAME (type
) : "<NULL>");
2868 gdb_print_host_address (TYPE_NAME (type
), gdb_stdout
);
2869 printf_filtered (")\n");
2870 printfi_filtered (spaces
, "tagname '%s' (",
2871 TYPE_TAG_NAME (type
) ? TYPE_TAG_NAME (type
) : "<NULL>");
2872 gdb_print_host_address (TYPE_TAG_NAME (type
), gdb_stdout
);
2873 printf_filtered (")\n");
2874 printfi_filtered (spaces
, "code 0x%x ", TYPE_CODE (type
));
2875 switch (TYPE_CODE (type
))
2877 case TYPE_CODE_UNDEF
:
2878 printf_filtered ("(TYPE_CODE_UNDEF)");
2881 printf_filtered ("(TYPE_CODE_PTR)");
2883 case TYPE_CODE_ARRAY
:
2884 printf_filtered ("(TYPE_CODE_ARRAY)");
2886 case TYPE_CODE_STRUCT
:
2887 printf_filtered ("(TYPE_CODE_STRUCT)");
2889 case TYPE_CODE_UNION
:
2890 printf_filtered ("(TYPE_CODE_UNION)");
2892 case TYPE_CODE_ENUM
:
2893 printf_filtered ("(TYPE_CODE_ENUM)");
2895 case TYPE_CODE_FUNC
:
2896 printf_filtered ("(TYPE_CODE_FUNC)");
2899 printf_filtered ("(TYPE_CODE_INT)");
2902 printf_filtered ("(TYPE_CODE_FLT)");
2904 case TYPE_CODE_VOID
:
2905 printf_filtered ("(TYPE_CODE_VOID)");
2908 printf_filtered ("(TYPE_CODE_SET)");
2910 case TYPE_CODE_RANGE
:
2911 printf_filtered ("(TYPE_CODE_RANGE)");
2913 case TYPE_CODE_STRING
:
2914 printf_filtered ("(TYPE_CODE_STRING)");
2916 case TYPE_CODE_BITSTRING
:
2917 printf_filtered ("(TYPE_CODE_BITSTRING)");
2919 case TYPE_CODE_ERROR
:
2920 printf_filtered ("(TYPE_CODE_ERROR)");
2922 case TYPE_CODE_MEMBER
:
2923 printf_filtered ("(TYPE_CODE_MEMBER)");
2925 case TYPE_CODE_METHOD
:
2926 printf_filtered ("(TYPE_CODE_METHOD)");
2929 printf_filtered ("(TYPE_CODE_REF)");
2931 case TYPE_CODE_CHAR
:
2932 printf_filtered ("(TYPE_CODE_CHAR)");
2934 case TYPE_CODE_BOOL
:
2935 printf_filtered ("(TYPE_CODE_BOOL)");
2937 case TYPE_CODE_COMPLEX
:
2938 printf_filtered ("(TYPE_CODE_COMPLEX)");
2940 case TYPE_CODE_TYPEDEF
:
2941 printf_filtered ("(TYPE_CODE_TYPEDEF)");
2943 case TYPE_CODE_TEMPLATE
:
2944 printf_filtered ("(TYPE_CODE_TEMPLATE)");
2946 case TYPE_CODE_TEMPLATE_ARG
:
2947 printf_filtered ("(TYPE_CODE_TEMPLATE_ARG)");
2950 printf_filtered ("(UNKNOWN TYPE CODE)");
2953 puts_filtered ("\n");
2954 printfi_filtered (spaces
, "length %d\n", TYPE_LENGTH (type
));
2955 printfi_filtered (spaces
, "upper_bound_type 0x%x ",
2956 TYPE_ARRAY_UPPER_BOUND_TYPE (type
));
2957 print_bound_type (TYPE_ARRAY_UPPER_BOUND_TYPE (type
));
2958 puts_filtered ("\n");
2959 printfi_filtered (spaces
, "lower_bound_type 0x%x ",
2960 TYPE_ARRAY_LOWER_BOUND_TYPE (type
));
2961 print_bound_type (TYPE_ARRAY_LOWER_BOUND_TYPE (type
));
2962 puts_filtered ("\n");
2963 printfi_filtered (spaces
, "objfile ");
2964 gdb_print_host_address (TYPE_OBJFILE (type
), gdb_stdout
);
2965 printf_filtered ("\n");
2966 printfi_filtered (spaces
, "target_type ");
2967 gdb_print_host_address (TYPE_TARGET_TYPE (type
), gdb_stdout
);
2968 printf_filtered ("\n");
2969 if (TYPE_TARGET_TYPE (type
) != NULL
)
2971 recursive_dump_type (TYPE_TARGET_TYPE (type
), spaces
+ 2);
2973 printfi_filtered (spaces
, "pointer_type ");
2974 gdb_print_host_address (TYPE_POINTER_TYPE (type
), gdb_stdout
);
2975 printf_filtered ("\n");
2976 printfi_filtered (spaces
, "reference_type ");
2977 gdb_print_host_address (TYPE_REFERENCE_TYPE (type
), gdb_stdout
);
2978 printf_filtered ("\n");
2979 printfi_filtered (spaces
, "cv_type ");
2980 gdb_print_host_address (TYPE_CV_TYPE (type
), gdb_stdout
);
2981 printf_filtered ("\n");
2982 printfi_filtered (spaces
, "as_type ");
2983 gdb_print_host_address (TYPE_AS_TYPE (type
), gdb_stdout
);
2984 printf_filtered ("\n");
2985 printfi_filtered (spaces
, "flags 0x%x", TYPE_FLAGS (type
));
2986 if (TYPE_UNSIGNED (type
))
2988 puts_filtered (" TYPE_FLAG_UNSIGNED");
2990 if (TYPE_NOSIGN (type
))
2992 puts_filtered (" TYPE_FLAG_NOSIGN");
2994 if (TYPE_STUB (type
))
2996 puts_filtered (" TYPE_FLAG_STUB");
2998 if (TYPE_TARGET_STUB (type
))
3000 puts_filtered (" TYPE_FLAG_TARGET_STUB");
3002 if (TYPE_STATIC (type
))
3004 puts_filtered (" TYPE_FLAG_STATIC");
3006 if (TYPE_CONST (type
))
3008 puts_filtered (" TYPE_FLAG_CONST");
3010 if (TYPE_VOLATILE (type
))
3012 puts_filtered (" TYPE_FLAG_VOLATILE");
3014 if (TYPE_PROTOTYPED (type
))
3016 puts_filtered (" TYPE_FLAG_PROTOTYPED");
3018 if (TYPE_INCOMPLETE (type
))
3020 puts_filtered (" TYPE_FLAG_INCOMPLETE");
3022 if (TYPE_CODE_SPACE (type
))
3024 puts_filtered (" TYPE_FLAG_CODE_SPACE");
3026 if (TYPE_DATA_SPACE (type
))
3028 puts_filtered (" TYPE_FLAG_DATA_SPACE");
3030 if (TYPE_VARARGS (type
))
3032 puts_filtered (" TYPE_FLAG_VARARGS");
3034 /* This is used for things like AltiVec registers on ppc. Gcc emits
3035 an attribute for the array type, which tells whether or not we
3036 have a vector, instead of a regular array. */
3037 if (TYPE_VECTOR (type
))
3039 puts_filtered (" TYPE_FLAG_VECTOR");
3041 puts_filtered ("\n");
3042 printfi_filtered (spaces
, "nfields %d ", TYPE_NFIELDS (type
));
3043 gdb_print_host_address (TYPE_FIELDS (type
), gdb_stdout
);
3044 puts_filtered ("\n");
3045 for (idx
= 0; idx
< TYPE_NFIELDS (type
); idx
++)
3047 printfi_filtered (spaces
+ 2,
3048 "[%d] bitpos %d bitsize %d type ",
3049 idx
, TYPE_FIELD_BITPOS (type
, idx
),
3050 TYPE_FIELD_BITSIZE (type
, idx
));
3051 gdb_print_host_address (TYPE_FIELD_TYPE (type
, idx
), gdb_stdout
);
3052 printf_filtered (" name '%s' (",
3053 TYPE_FIELD_NAME (type
, idx
) != NULL
3054 ? TYPE_FIELD_NAME (type
, idx
)
3056 gdb_print_host_address (TYPE_FIELD_NAME (type
, idx
), gdb_stdout
);
3057 printf_filtered (")\n");
3058 if (TYPE_FIELD_TYPE (type
, idx
) != NULL
)
3060 recursive_dump_type (TYPE_FIELD_TYPE (type
, idx
), spaces
+ 4);
3063 printfi_filtered (spaces
, "vptr_basetype ");
3064 gdb_print_host_address (TYPE_VPTR_BASETYPE (type
), gdb_stdout
);
3065 puts_filtered ("\n");
3066 if (TYPE_VPTR_BASETYPE (type
) != NULL
)
3068 recursive_dump_type (TYPE_VPTR_BASETYPE (type
), spaces
+ 2);
3070 printfi_filtered (spaces
, "vptr_fieldno %d\n", TYPE_VPTR_FIELDNO (type
));
3071 switch (TYPE_CODE (type
))
3073 case TYPE_CODE_METHOD
:
3074 case TYPE_CODE_FUNC
:
3075 printfi_filtered (spaces
, "arg_types ");
3076 gdb_print_host_address (TYPE_ARG_TYPES (type
), gdb_stdout
);
3077 puts_filtered ("\n");
3078 print_arg_types (TYPE_ARG_TYPES (type
), spaces
);
3081 case TYPE_CODE_STRUCT
:
3082 printfi_filtered (spaces
, "cplus_stuff ");
3083 gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type
), gdb_stdout
);
3084 puts_filtered ("\n");
3085 print_cplus_stuff (type
, spaces
);
3089 printfi_filtered (spaces
, "floatformat ");
3090 if (TYPE_FLOATFORMAT (type
) == NULL
3091 || TYPE_FLOATFORMAT (type
)->name
== NULL
)
3092 puts_filtered ("(null)");
3094 puts_filtered (TYPE_FLOATFORMAT (type
)->name
);
3095 puts_filtered ("\n");
3099 /* We have to pick one of the union types to be able print and test
3100 the value. Pick cplus_struct_type, even though we know it isn't
3101 any particular one. */
3102 printfi_filtered (spaces
, "type_specific ");
3103 gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type
), gdb_stdout
);
3104 if (TYPE_CPLUS_SPECIFIC (type
) != NULL
)
3106 printf_filtered (" (unknown data form)");
3108 printf_filtered ("\n");
3113 obstack_free (&dont_print_type_obstack
, NULL
);
3116 static void build_gdbtypes (void);
3118 build_gdbtypes (void)
3121 init_type (TYPE_CODE_VOID
, 1,
3123 "void", (struct objfile
*) NULL
);
3125 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3127 | (TARGET_CHAR_SIGNED
? 0 : TYPE_FLAG_UNSIGNED
)),
3128 "char", (struct objfile
*) NULL
);
3129 builtin_type_true_char
=
3130 init_type (TYPE_CODE_CHAR
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3132 "true character", (struct objfile
*) NULL
);
3133 builtin_type_signed_char
=
3134 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3136 "signed char", (struct objfile
*) NULL
);
3137 builtin_type_unsigned_char
=
3138 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3140 "unsigned char", (struct objfile
*) NULL
);
3141 builtin_type_short
=
3142 init_type (TYPE_CODE_INT
, TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
3144 "short", (struct objfile
*) NULL
);
3145 builtin_type_unsigned_short
=
3146 init_type (TYPE_CODE_INT
, TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
3148 "unsigned short", (struct objfile
*) NULL
);
3150 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
3152 "int", (struct objfile
*) NULL
);
3153 builtin_type_unsigned_int
=
3154 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
3156 "unsigned int", (struct objfile
*) NULL
);
3158 init_type (TYPE_CODE_INT
, TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
3160 "long", (struct objfile
*) NULL
);
3161 builtin_type_unsigned_long
=
3162 init_type (TYPE_CODE_INT
, TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
3164 "unsigned long", (struct objfile
*) NULL
);
3165 builtin_type_long_long
=
3166 init_type (TYPE_CODE_INT
, TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
3168 "long long", (struct objfile
*) NULL
);
3169 builtin_type_unsigned_long_long
=
3170 init_type (TYPE_CODE_INT
, TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
3172 "unsigned long long", (struct objfile
*) NULL
);
3173 builtin_type_float
=
3174 init_type (TYPE_CODE_FLT
, TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
3176 "float", (struct objfile
*) NULL
);
3177 /* vinschen@redhat.com 2002-02-08:
3178 The below lines are disabled since they are doing the wrong
3179 thing for non-multiarch targets. They are setting the correct
3180 type of floats for the target but while on multiarch targets
3181 this is done everytime the architecture changes, it's done on
3182 non-multiarch targets only on startup, leaving the wrong values
3183 in even if the architecture changes (eg. from big-endian to
3186 TYPE_FLOATFORMAT (builtin_type_float
) = TARGET_FLOAT_FORMAT
;
3188 builtin_type_double
=
3189 init_type (TYPE_CODE_FLT
, TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
3191 "double", (struct objfile
*) NULL
);
3193 TYPE_FLOATFORMAT (builtin_type_double
) = TARGET_DOUBLE_FORMAT
;
3195 builtin_type_long_double
=
3196 init_type (TYPE_CODE_FLT
, TARGET_LONG_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
3198 "long double", (struct objfile
*) NULL
);
3200 TYPE_FLOATFORMAT (builtin_type_long_double
) = TARGET_LONG_DOUBLE_FORMAT
;
3202 builtin_type_complex
=
3203 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
3205 "complex", (struct objfile
*) NULL
);
3206 TYPE_TARGET_TYPE (builtin_type_complex
) = builtin_type_float
;
3207 builtin_type_double_complex
=
3208 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
3210 "double complex", (struct objfile
*) NULL
);
3211 TYPE_TARGET_TYPE (builtin_type_double_complex
) = builtin_type_double
;
3212 builtin_type_string
=
3213 init_type (TYPE_CODE_STRING
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3215 "string", (struct objfile
*) NULL
);
3217 init_type (TYPE_CODE_INT
, 8 / 8,
3219 "int8_t", (struct objfile
*) NULL
);
3220 builtin_type_uint8
=
3221 init_type (TYPE_CODE_INT
, 8 / 8,
3223 "uint8_t", (struct objfile
*) NULL
);
3224 builtin_type_int16
=
3225 init_type (TYPE_CODE_INT
, 16 / 8,
3227 "int16_t", (struct objfile
*) NULL
);
3228 builtin_type_uint16
=
3229 init_type (TYPE_CODE_INT
, 16 / 8,
3231 "uint16_t", (struct objfile
*) NULL
);
3232 builtin_type_int32
=
3233 init_type (TYPE_CODE_INT
, 32 / 8,
3235 "int32_t", (struct objfile
*) NULL
);
3236 builtin_type_uint32
=
3237 init_type (TYPE_CODE_INT
, 32 / 8,
3239 "uint32_t", (struct objfile
*) NULL
);
3240 builtin_type_int64
=
3241 init_type (TYPE_CODE_INT
, 64 / 8,
3243 "int64_t", (struct objfile
*) NULL
);
3244 builtin_type_uint64
=
3245 init_type (TYPE_CODE_INT
, 64 / 8,
3247 "uint64_t", (struct objfile
*) NULL
);
3248 builtin_type_int128
=
3249 init_type (TYPE_CODE_INT
, 128 / 8,
3251 "int128_t", (struct objfile
*) NULL
);
3252 builtin_type_uint128
=
3253 init_type (TYPE_CODE_INT
, 128 / 8,
3255 "uint128_t", (struct objfile
*) NULL
);
3257 init_type (TYPE_CODE_BOOL
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3259 "bool", (struct objfile
*) NULL
);
3261 /* Add user knob for controlling resolution of opaque types */
3263 (add_set_cmd ("opaque-type-resolution", class_support
, var_boolean
, (char *) &opaque_type_resolution
,
3264 "Set resolution of opaque struct/class/union types (if set before loading symbols).",
3267 opaque_type_resolution
= 1;
3269 /* Build SIMD types. */
3271 = init_simd_type ("__builtin_v4sf", builtin_type_float
, "f", 4);
3273 = init_simd_type ("__builtin_v4si", builtin_type_int32
, "f", 4);
3275 = init_simd_type ("__builtin_v16qi", builtin_type_int8
, "f", 16);
3277 = init_simd_type ("__builtin_v8qi", builtin_type_int8
, "f", 8);
3279 = init_simd_type ("__builtin_v8hi", builtin_type_int16
, "f", 8);
3281 = init_simd_type ("__builtin_v4hi", builtin_type_int16
, "f", 4);
3283 = init_simd_type ("__builtin_v2si", builtin_type_int32
, "f", 2);
3287 = build_builtin_type_vec128 ();
3289 /* Pointer/Address types. */
3291 /* NOTE: on some targets, addresses and pointers are not necessarily
3292 the same --- for example, on the D10V, pointers are 16 bits long,
3293 but addresses are 32 bits long. See doc/gdbint.texinfo,
3294 ``Pointers Are Not Always Addresses''.
3297 - gdb's `struct type' always describes the target's
3299 - gdb's `struct value' objects should always hold values in
3301 - gdb's CORE_ADDR values are addresses in the unified virtual
3302 address space that the assembler and linker work with. Thus,
3303 since target_read_memory takes a CORE_ADDR as an argument, it
3304 can access any memory on the target, even if the processor has
3305 separate code and data address spaces.
3308 - If v is a value holding a D10V code pointer, its contents are
3309 in target form: a big-endian address left-shifted two bits.
3310 - If p is a D10V pointer type, TYPE_LENGTH (p) == 2, just as
3311 sizeof (void *) == 2 on the target.
3313 In this context, builtin_type_CORE_ADDR is a bit odd: it's a
3314 target type for a value the target will never see. It's only
3315 used to hold the values of (typeless) linker symbols, which are
3316 indeed in the unified virtual address space. */
3317 builtin_type_void_data_ptr
= make_pointer_type (builtin_type_void
, NULL
);
3318 builtin_type_void_func_ptr
3319 = lookup_pointer_type (lookup_function_type (builtin_type_void
));
3320 builtin_type_CORE_ADDR
=
3321 init_type (TYPE_CODE_INT
, TARGET_ADDR_BIT
/ 8,
3323 "__CORE_ADDR", (struct objfile
*) NULL
);
3324 builtin_type_bfd_vma
=
3325 init_type (TYPE_CODE_INT
, TARGET_BFD_VMA_BIT
/ 8,
3327 "__bfd_vma", (struct objfile
*) NULL
);
3331 extern void _initialize_gdbtypes (void);
3333 _initialize_gdbtypes (void)
3335 struct cmd_list_element
*c
;
3338 /* FIXME - For the moment, handle types by swapping them in and out.
3339 Should be using the per-architecture data-pointer and a large
3341 register_gdbarch_swap (&builtin_type_void
, sizeof (struct type
*), NULL
);
3342 register_gdbarch_swap (&builtin_type_char
, sizeof (struct type
*), NULL
);
3343 register_gdbarch_swap (&builtin_type_short
, sizeof (struct type
*), NULL
);
3344 register_gdbarch_swap (&builtin_type_int
, sizeof (struct type
*), NULL
);
3345 register_gdbarch_swap (&builtin_type_long
, sizeof (struct type
*), NULL
);
3346 register_gdbarch_swap (&builtin_type_long_long
, sizeof (struct type
*), NULL
);
3347 register_gdbarch_swap (&builtin_type_signed_char
, sizeof (struct type
*), NULL
);
3348 register_gdbarch_swap (&builtin_type_unsigned_char
, sizeof (struct type
*), NULL
);
3349 register_gdbarch_swap (&builtin_type_unsigned_short
, sizeof (struct type
*), NULL
);
3350 register_gdbarch_swap (&builtin_type_unsigned_int
, sizeof (struct type
*), NULL
);
3351 register_gdbarch_swap (&builtin_type_unsigned_long
, sizeof (struct type
*), NULL
);
3352 register_gdbarch_swap (&builtin_type_unsigned_long_long
, sizeof (struct type
*), NULL
);
3353 register_gdbarch_swap (&builtin_type_float
, sizeof (struct type
*), NULL
);
3354 register_gdbarch_swap (&builtin_type_double
, sizeof (struct type
*), NULL
);
3355 register_gdbarch_swap (&builtin_type_long_double
, sizeof (struct type
*), NULL
);
3356 register_gdbarch_swap (&builtin_type_complex
, sizeof (struct type
*), NULL
);
3357 register_gdbarch_swap (&builtin_type_double_complex
, sizeof (struct type
*), NULL
);
3358 register_gdbarch_swap (&builtin_type_string
, sizeof (struct type
*), NULL
);
3359 register_gdbarch_swap (&builtin_type_int8
, sizeof (struct type
*), NULL
);
3360 register_gdbarch_swap (&builtin_type_uint8
, sizeof (struct type
*), NULL
);
3361 register_gdbarch_swap (&builtin_type_int16
, sizeof (struct type
*), NULL
);
3362 register_gdbarch_swap (&builtin_type_uint16
, sizeof (struct type
*), NULL
);
3363 register_gdbarch_swap (&builtin_type_int32
, sizeof (struct type
*), NULL
);
3364 register_gdbarch_swap (&builtin_type_uint32
, sizeof (struct type
*), NULL
);
3365 register_gdbarch_swap (&builtin_type_int64
, sizeof (struct type
*), NULL
);
3366 register_gdbarch_swap (&builtin_type_uint64
, sizeof (struct type
*), NULL
);
3367 register_gdbarch_swap (&builtin_type_int128
, sizeof (struct type
*), NULL
);
3368 register_gdbarch_swap (&builtin_type_uint128
, sizeof (struct type
*), NULL
);
3369 register_gdbarch_swap (&builtin_type_v4sf
, sizeof (struct type
*), NULL
);
3370 register_gdbarch_swap (&builtin_type_v4si
, sizeof (struct type
*), NULL
);
3371 register_gdbarch_swap (&builtin_type_v16qi
, sizeof (struct type
*), NULL
);
3372 register_gdbarch_swap (&builtin_type_v8qi
, sizeof (struct type
*), NULL
);
3373 register_gdbarch_swap (&builtin_type_v8hi
, sizeof (struct type
*), NULL
);
3374 register_gdbarch_swap (&builtin_type_v4hi
, sizeof (struct type
*), NULL
);
3375 register_gdbarch_swap (&builtin_type_v2si
, sizeof (struct type
*), NULL
);
3376 register_gdbarch_swap (&builtin_type_vec128
, sizeof (struct type
*), NULL
);
3377 REGISTER_GDBARCH_SWAP (builtin_type_void_data_ptr
);
3378 REGISTER_GDBARCH_SWAP (builtin_type_void_func_ptr
);
3379 REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR
);
3380 REGISTER_GDBARCH_SWAP (builtin_type_bfd_vma
);
3381 register_gdbarch_swap (NULL
, 0, build_gdbtypes
);
3383 /* Note: These types do not need to be swapped - they are target
3385 builtin_type_ieee_single_big
=
3386 init_type (TYPE_CODE_FLT
, floatformat_ieee_single_big
.totalsize
/ 8,
3387 0, "builtin_type_ieee_single_big", NULL
);
3388 TYPE_FLOATFORMAT (builtin_type_ieee_single_big
) = &floatformat_ieee_single_big
;
3389 builtin_type_ieee_single_little
=
3390 init_type (TYPE_CODE_FLT
, floatformat_ieee_single_little
.totalsize
/ 8,
3391 0, "builtin_type_ieee_single_little", NULL
);
3392 TYPE_FLOATFORMAT (builtin_type_ieee_single_little
) = &floatformat_ieee_single_little
;
3393 builtin_type_ieee_double_big
=
3394 init_type (TYPE_CODE_FLT
, floatformat_ieee_double_big
.totalsize
/ 8,
3395 0, "builtin_type_ieee_double_big", NULL
);
3396 TYPE_FLOATFORMAT (builtin_type_ieee_double_big
) = &floatformat_ieee_double_big
;
3397 builtin_type_ieee_double_little
=
3398 init_type (TYPE_CODE_FLT
, floatformat_ieee_double_little
.totalsize
/ 8,
3399 0, "builtin_type_ieee_double_little", NULL
);
3400 TYPE_FLOATFORMAT (builtin_type_ieee_double_little
) = &floatformat_ieee_double_little
;
3401 builtin_type_ieee_double_littlebyte_bigword
=
3402 init_type (TYPE_CODE_FLT
, floatformat_ieee_double_littlebyte_bigword
.totalsize
/ 8,
3403 0, "builtin_type_ieee_double_littlebyte_bigword", NULL
);
3404 TYPE_FLOATFORMAT (builtin_type_ieee_double_littlebyte_bigword
) = &floatformat_ieee_double_littlebyte_bigword
;
3405 builtin_type_i387_ext
=
3406 init_type (TYPE_CODE_FLT
, floatformat_i387_ext
.totalsize
/ 8,
3407 0, "builtin_type_i387_ext", NULL
);
3408 TYPE_FLOATFORMAT (builtin_type_i387_ext
) = &floatformat_i387_ext
;
3409 builtin_type_m68881_ext
=
3410 init_type (TYPE_CODE_FLT
, floatformat_m68881_ext
.totalsize
/ 8,
3411 0, "builtin_type_m68881_ext", NULL
);
3412 TYPE_FLOATFORMAT (builtin_type_m68881_ext
) = &floatformat_m68881_ext
;
3413 builtin_type_i960_ext
=
3414 init_type (TYPE_CODE_FLT
, floatformat_i960_ext
.totalsize
/ 8,
3415 0, "builtin_type_i960_ext", NULL
);
3416 TYPE_FLOATFORMAT (builtin_type_i960_ext
) = &floatformat_i960_ext
;
3417 builtin_type_m88110_ext
=
3418 init_type (TYPE_CODE_FLT
, floatformat_m88110_ext
.totalsize
/ 8,
3419 0, "builtin_type_m88110_ext", NULL
);
3420 TYPE_FLOATFORMAT (builtin_type_m88110_ext
) = &floatformat_m88110_ext
;
3421 builtin_type_m88110_harris_ext
=
3422 init_type (TYPE_CODE_FLT
, floatformat_m88110_harris_ext
.totalsize
/ 8,
3423 0, "builtin_type_m88110_harris_ext", NULL
);
3424 TYPE_FLOATFORMAT (builtin_type_m88110_harris_ext
) = &floatformat_m88110_harris_ext
;
3425 builtin_type_arm_ext_big
=
3426 init_type (TYPE_CODE_FLT
, floatformat_arm_ext_big
.totalsize
/ 8,
3427 0, "builtin_type_arm_ext_big", NULL
);
3428 TYPE_FLOATFORMAT (builtin_type_arm_ext_big
) = &floatformat_arm_ext_big
;
3429 builtin_type_arm_ext_littlebyte_bigword
=
3430 init_type (TYPE_CODE_FLT
, floatformat_arm_ext_littlebyte_bigword
.totalsize
/ 8,
3431 0, "builtin_type_arm_ext_littlebyte_bigword", NULL
);
3432 TYPE_FLOATFORMAT (builtin_type_arm_ext_littlebyte_bigword
) = &floatformat_arm_ext_littlebyte_bigword
;
3433 builtin_type_ia64_spill_big
=
3434 init_type (TYPE_CODE_FLT
, floatformat_ia64_spill_big
.totalsize
/ 8,
3435 0, "builtin_type_ia64_spill_big", NULL
);
3436 TYPE_FLOATFORMAT (builtin_type_ia64_spill_big
) = &floatformat_ia64_spill_big
;
3437 builtin_type_ia64_spill_little
=
3438 init_type (TYPE_CODE_FLT
, floatformat_ia64_spill_little
.totalsize
/ 8,
3439 0, "builtin_type_ia64_spill_little", NULL
);
3440 TYPE_FLOATFORMAT (builtin_type_ia64_spill_little
) = &floatformat_ia64_spill_little
;
3441 builtin_type_ia64_quad_big
=
3442 init_type (TYPE_CODE_FLT
, floatformat_ia64_quad_big
.totalsize
/ 8,
3443 0, "builtin_type_ia64_quad_big", NULL
);
3444 TYPE_FLOATFORMAT (builtin_type_ia64_quad_big
) = &floatformat_ia64_quad_big
;
3445 builtin_type_ia64_quad_little
=
3446 init_type (TYPE_CODE_FLT
, floatformat_ia64_quad_little
.totalsize
/ 8,
3447 0, "builtin_type_ia64_quad_little", NULL
);
3448 TYPE_FLOATFORMAT (builtin_type_ia64_quad_little
) = &floatformat_ia64_quad_little
;
3451 add_set_cmd ("overload", no_class
, var_zinteger
, (char *) &overload_debug
,
3452 "Set debugging of C++ overloading.\n\
3453 When enabled, ranking of the functions\n\
3454 is displayed.", &setdebuglist
),