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
);
781 /* Construct and return a type of the form:
782 struct NAME { ELT_TYPE ELT_NAME[N]; }
783 We use these types for SIMD registers. For example, the type of
784 the SSE registers on the late x86-family processors is:
785 struct __builtin_v4sf { float f[4]; }
786 built by the function call:
787 init_simd_type ("__builtin_v4sf", builtin_type_float, "f", 4)
788 The type returned is a permanent type, allocated using malloc; it
789 doesn't live in any objfile's obstack. */
791 init_simd_type (char *name
,
792 struct type
*elt_type
,
799 /* Build the field structure. */
800 f
= xmalloc (sizeof (*f
));
801 memset (f
, 0, sizeof (*f
));
803 f
->type
= create_array_type (0, elt_type
,
804 create_range_type (0, builtin_type_int
,
808 /* Build a struct type with that field. */
809 t
= init_type (TYPE_CODE_STRUCT
, n
* TYPE_LENGTH (elt_type
), 0, 0, 0);
812 TYPE_TAG_NAME (t
) = name
;
818 build_builtin_type_vec128 (void)
820 /* Construct a type for the 128 bit registers. The type we're
823 union __gdb_builtin_type_vec128
825 struct __builtin_v16qi v16qi
;
826 struct __builtin_v8hi v8hi
;
827 struct __builtin_v4si v4si
;
828 struct __builtin_v4sf v4sf
;
836 f
= (struct field
*) xcalloc (5, sizeof (*f
));
838 FIELD_TYPE (f
[0]) = builtin_type_int128
;
839 FIELD_NAME (f
[0]) = "uint128";
841 FIELD_TYPE (f
[1]) = builtin_type_v4sf
;
842 FIELD_NAME (f
[1]) = "v4sf";
844 FIELD_TYPE (f
[2]) = builtin_type_v4si
;
845 FIELD_NAME (f
[2]) = "v4si";
847 FIELD_TYPE (f
[3]) = builtin_type_v8hi
;
848 FIELD_NAME (f
[3]) = "v8hi";
850 FIELD_TYPE (f
[4]) = builtin_type_v16qi
;
851 FIELD_NAME (f
[4]) = "v16qi";
853 /* Build a union type with those fields. */
854 t
= init_type (TYPE_CODE_UNION
, 16, 0, 0, 0);
855 TYPE_NFIELDS (t
) = 5;
857 TYPE_TAG_NAME (t
) = "__gdb_builtin_type_vec128";
862 /* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE.
863 A MEMBER is a wierd thing -- it amounts to a typed offset into
864 a struct, e.g. "an int at offset 8". A MEMBER TYPE doesn't
865 include the offset (that's the value of the MEMBER itself), but does
866 include the structure type into which it points (for some reason).
868 When "smashing" the type, we preserve the objfile that the
869 old type pointed to, since we aren't changing where the type is actually
873 smash_to_member_type (struct type
*type
, struct type
*domain
,
874 struct type
*to_type
)
876 struct objfile
*objfile
;
878 objfile
= TYPE_OBJFILE (type
);
880 memset ((char *) type
, 0, sizeof (struct type
));
881 TYPE_OBJFILE (type
) = objfile
;
882 TYPE_TARGET_TYPE (type
) = to_type
;
883 TYPE_DOMAIN_TYPE (type
) = domain
;
884 TYPE_LENGTH (type
) = 1; /* In practice, this is never needed. */
885 TYPE_CODE (type
) = TYPE_CODE_MEMBER
;
888 /* Smash TYPE to be a type of method of DOMAIN with type TO_TYPE.
889 METHOD just means `function that gets an extra "this" argument'.
891 When "smashing" the type, we preserve the objfile that the
892 old type pointed to, since we aren't changing where the type is actually
896 smash_to_method_type (struct type
*type
, struct type
*domain
,
897 struct type
*to_type
, struct type
**args
)
899 struct objfile
*objfile
;
901 objfile
= TYPE_OBJFILE (type
);
903 memset ((char *) type
, 0, sizeof (struct type
));
904 TYPE_OBJFILE (type
) = objfile
;
905 TYPE_TARGET_TYPE (type
) = to_type
;
906 TYPE_DOMAIN_TYPE (type
) = domain
;
907 TYPE_ARG_TYPES (type
) = args
;
908 TYPE_LENGTH (type
) = 1; /* In practice, this is never needed. */
909 TYPE_CODE (type
) = TYPE_CODE_METHOD
;
912 /* Return a typename for a struct/union/enum type without "struct ",
913 "union ", or "enum ". If the type has a NULL name, return NULL. */
916 type_name_no_tag (register const struct type
*type
)
918 if (TYPE_TAG_NAME (type
) != NULL
)
919 return TYPE_TAG_NAME (type
);
921 /* Is there code which expects this to return the name if there is no
922 tag name? My guess is that this is mainly used for C++ in cases where
923 the two will always be the same. */
924 return TYPE_NAME (type
);
927 /* Lookup a primitive type named NAME.
928 Return zero if NAME is not a primitive type. */
931 lookup_primitive_typename (char *name
)
933 struct type
**const *p
;
935 for (p
= current_language
->la_builtin_type_vector
; *p
!= NULL
; p
++)
937 if (STREQ ((**p
)->name
, name
))
945 /* Lookup a typedef or primitive type named NAME,
946 visible in lexical block BLOCK.
947 If NOERR is nonzero, return zero if NAME is not suitably defined. */
950 lookup_typename (char *name
, struct block
*block
, int noerr
)
952 register struct symbol
*sym
;
953 register struct type
*tmp
;
955 sym
= lookup_symbol (name
, block
, VAR_NAMESPACE
, 0, (struct symtab
**) NULL
);
956 if (sym
== NULL
|| SYMBOL_CLASS (sym
) != LOC_TYPEDEF
)
958 tmp
= lookup_primitive_typename (name
);
963 else if (!tmp
&& noerr
)
969 error ("No type named %s.", name
);
972 return (SYMBOL_TYPE (sym
));
976 lookup_unsigned_typename (char *name
)
978 char *uns
= alloca (strlen (name
) + 10);
980 strcpy (uns
, "unsigned ");
981 strcpy (uns
+ 9, name
);
982 return (lookup_typename (uns
, (struct block
*) NULL
, 0));
986 lookup_signed_typename (char *name
)
989 char *uns
= alloca (strlen (name
) + 8);
991 strcpy (uns
, "signed ");
992 strcpy (uns
+ 7, name
);
993 t
= lookup_typename (uns
, (struct block
*) NULL
, 1);
994 /* If we don't find "signed FOO" just try again with plain "FOO". */
997 return lookup_typename (name
, (struct block
*) NULL
, 0);
1000 /* Lookup a structure type named "struct NAME",
1001 visible in lexical block BLOCK. */
1004 lookup_struct (char *name
, struct block
*block
)
1006 register struct symbol
*sym
;
1008 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
1009 (struct symtab
**) NULL
);
1013 error ("No struct type named %s.", name
);
1015 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
1017 error ("This context has class, union or enum %s, not a struct.", name
);
1019 return (SYMBOL_TYPE (sym
));
1022 /* Lookup a union type named "union NAME",
1023 visible in lexical block BLOCK. */
1026 lookup_union (char *name
, struct block
*block
)
1028 register struct symbol
*sym
;
1031 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
1032 (struct symtab
**) NULL
);
1035 error ("No union type named %s.", name
);
1037 t
= SYMBOL_TYPE (sym
);
1039 if (TYPE_CODE (t
) == TYPE_CODE_UNION
)
1042 /* C++ unions may come out with TYPE_CODE_CLASS, but we look at
1043 * a further "declared_type" field to discover it is really a union.
1045 if (HAVE_CPLUS_STRUCT (t
))
1046 if (TYPE_DECLARED_TYPE (t
) == DECLARED_TYPE_UNION
)
1049 /* If we get here, it's not a union */
1050 error ("This context has class, struct or enum %s, not a union.", name
);
1054 /* Lookup an enum type named "enum NAME",
1055 visible in lexical block BLOCK. */
1058 lookup_enum (char *name
, struct block
*block
)
1060 register struct symbol
*sym
;
1062 sym
= lookup_symbol (name
, block
, STRUCT_NAMESPACE
, 0,
1063 (struct symtab
**) NULL
);
1066 error ("No enum type named %s.", name
);
1068 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_ENUM
)
1070 error ("This context has class, struct or union %s, not an enum.", name
);
1072 return (SYMBOL_TYPE (sym
));
1075 /* Lookup a template type named "template NAME<TYPE>",
1076 visible in lexical block BLOCK. */
1079 lookup_template_type (char *name
, struct type
*type
, struct block
*block
)
1082 char *nam
= (char *) alloca (strlen (name
) + strlen (type
->name
) + 4);
1085 strcat (nam
, type
->name
);
1086 strcat (nam
, " >"); /* FIXME, extra space still introduced in gcc? */
1088 sym
= lookup_symbol (nam
, block
, VAR_NAMESPACE
, 0, (struct symtab
**) NULL
);
1092 error ("No template type named %s.", name
);
1094 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
1096 error ("This context has class, union or enum %s, not a struct.", name
);
1098 return (SYMBOL_TYPE (sym
));
1101 /* Given a type TYPE, lookup the type of the component of type named NAME.
1103 TYPE can be either a struct or union, or a pointer or reference to a struct or
1104 union. If it is a pointer or reference, its target type is automatically used.
1105 Thus '.' and '->' are interchangable, as specified for the definitions of the
1106 expression element types STRUCTOP_STRUCT and STRUCTOP_PTR.
1108 If NOERR is nonzero, return zero if NAME is not suitably defined.
1109 If NAME is the name of a baseclass type, return that type. */
1112 lookup_struct_elt_type (struct type
*type
, char *name
, int noerr
)
1118 CHECK_TYPEDEF (type
);
1119 if (TYPE_CODE (type
) != TYPE_CODE_PTR
1120 && TYPE_CODE (type
) != TYPE_CODE_REF
)
1122 type
= TYPE_TARGET_TYPE (type
);
1125 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
&&
1126 TYPE_CODE (type
) != TYPE_CODE_UNION
)
1128 target_terminal_ours ();
1129 gdb_flush (gdb_stdout
);
1130 fprintf_unfiltered (gdb_stderr
, "Type ");
1131 type_print (type
, "", gdb_stderr
, -1);
1132 error (" is not a structure or union type.");
1136 /* FIXME: This change put in by Michael seems incorrect for the case where
1137 the structure tag name is the same as the member name. I.E. when doing
1138 "ptype bell->bar" for "struct foo { int bar; int foo; } bell;"
1143 typename
= type_name_no_tag (type
);
1144 if (typename
!= NULL
&& STREQ (typename
, name
))
1149 for (i
= TYPE_NFIELDS (type
) - 1; i
>= TYPE_N_BASECLASSES (type
); i
--)
1151 char *t_field_name
= TYPE_FIELD_NAME (type
, i
);
1153 if (t_field_name
&& (strcmp_iw (t_field_name
, name
) == 0))
1155 return TYPE_FIELD_TYPE (type
, i
);
1159 /* OK, it's not in this class. Recursively check the baseclasses. */
1160 for (i
= TYPE_N_BASECLASSES (type
) - 1; i
>= 0; i
--)
1164 t
= lookup_struct_elt_type (TYPE_BASECLASS (type
, i
), name
, noerr
);
1176 target_terminal_ours ();
1177 gdb_flush (gdb_stdout
);
1178 fprintf_unfiltered (gdb_stderr
, "Type ");
1179 type_print (type
, "", gdb_stderr
, -1);
1180 fprintf_unfiltered (gdb_stderr
, " has no component named ");
1181 fputs_filtered (name
, gdb_stderr
);
1183 return (struct type
*) -1; /* For lint */
1186 /* If possible, make the vptr_fieldno and vptr_basetype fields of TYPE
1187 valid. Callers should be aware that in some cases (for example,
1188 the type or one of its baseclasses is a stub type and we are
1189 debugging a .o file), this function will not be able to find the virtual
1190 function table pointer, and vptr_fieldno will remain -1 and vptr_basetype
1191 will remain NULL. */
1194 fill_in_vptr_fieldno (struct type
*type
)
1196 CHECK_TYPEDEF (type
);
1198 if (TYPE_VPTR_FIELDNO (type
) < 0)
1202 /* We must start at zero in case the first (and only) baseclass is
1203 virtual (and hence we cannot share the table pointer). */
1204 for (i
= 0; i
< TYPE_N_BASECLASSES (type
); i
++)
1206 fill_in_vptr_fieldno (TYPE_BASECLASS (type
, i
));
1207 if (TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type
, i
)) >= 0)
1209 TYPE_VPTR_FIELDNO (type
)
1210 = TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type
, i
));
1211 TYPE_VPTR_BASETYPE (type
)
1212 = TYPE_VPTR_BASETYPE (TYPE_BASECLASS (type
, i
));
1219 /* Find the method and field indices for the destructor in class type T.
1220 Return 1 if the destructor was found, otherwise, return 0. */
1223 get_destructor_fn_field (struct type
*t
, int *method_indexp
, int *field_indexp
)
1227 for (i
= 0; i
< TYPE_NFN_FIELDS (t
); i
++)
1230 struct fn_field
*f
= TYPE_FN_FIELDLIST1 (t
, i
);
1232 for (j
= 0; j
< TYPE_FN_FIELDLIST_LENGTH (t
, i
); j
++)
1234 if (is_destructor_name (TYPE_FN_FIELD_PHYSNAME (f
, j
)) != 0)
1245 /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989.
1247 If this is a stubbed struct (i.e. declared as struct foo *), see if
1248 we can find a full definition in some other file. If so, copy this
1249 definition, so we can use it in future. There used to be a comment (but
1250 not any code) that if we don't find a full definition, we'd set a flag
1251 so we don't spend time in the future checking the same type. That would
1252 be a mistake, though--we might load in more symbols which contain a
1253 full definition for the type.
1255 This used to be coded as a macro, but I don't think it is called
1256 often enough to merit such treatment. */
1258 struct complaint stub_noname_complaint
=
1259 {"stub type has NULL name", 0, 0};
1262 check_typedef (struct type
*type
)
1264 struct type
*orig_type
= type
;
1265 int is_const
, is_volatile
;
1267 while (TYPE_CODE (type
) == TYPE_CODE_TYPEDEF
)
1269 if (!TYPE_TARGET_TYPE (type
))
1274 /* It is dangerous to call lookup_symbol if we are currently
1275 reading a symtab. Infinite recursion is one danger. */
1276 if (currently_reading_symtab
)
1279 name
= type_name_no_tag (type
);
1280 /* FIXME: shouldn't we separately check the TYPE_NAME and the
1281 TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE
1282 as appropriate? (this code was written before TYPE_NAME and
1283 TYPE_TAG_NAME were separate). */
1286 complain (&stub_noname_complaint
);
1289 sym
= lookup_symbol (name
, 0, STRUCT_NAMESPACE
, 0,
1290 (struct symtab
**) NULL
);
1292 TYPE_TARGET_TYPE (type
) = SYMBOL_TYPE (sym
);
1294 TYPE_TARGET_TYPE (type
) = alloc_type (NULL
); /* TYPE_CODE_UNDEF */
1296 type
= TYPE_TARGET_TYPE (type
);
1299 is_const
= TYPE_CONST (type
);
1300 is_volatile
= TYPE_VOLATILE (type
);
1302 /* If this is a struct/class/union with no fields, then check whether a
1303 full definition exists somewhere else. This is for systems where a
1304 type definition with no fields is issued for such types, instead of
1305 identifying them as stub types in the first place */
1307 if (TYPE_IS_OPAQUE (type
) && opaque_type_resolution
&& !currently_reading_symtab
)
1309 char *name
= type_name_no_tag (type
);
1310 struct type
*newtype
;
1313 complain (&stub_noname_complaint
);
1316 newtype
= lookup_transparent_type (name
);
1318 make_cv_type (is_const
, is_volatile
, newtype
, &type
);
1320 /* Otherwise, rely on the stub flag being set for opaque/stubbed types */
1321 else if (TYPE_STUB (type
) && !currently_reading_symtab
)
1323 char *name
= type_name_no_tag (type
);
1324 /* FIXME: shouldn't we separately check the TYPE_NAME and the
1325 TYPE_TAG_NAME, and look in STRUCT_NAMESPACE and/or VAR_NAMESPACE
1326 as appropriate? (this code was written before TYPE_NAME and
1327 TYPE_TAG_NAME were separate). */
1331 complain (&stub_noname_complaint
);
1334 sym
= lookup_symbol (name
, 0, STRUCT_NAMESPACE
, 0, (struct symtab
**) NULL
);
1336 make_cv_type (is_const
, is_volatile
, SYMBOL_TYPE (sym
), &type
);
1339 if (TYPE_TARGET_STUB (type
))
1341 struct type
*range_type
;
1342 struct type
*target_type
= check_typedef (TYPE_TARGET_TYPE (type
));
1344 if (TYPE_STUB (target_type
) || TYPE_TARGET_STUB (target_type
))
1347 else if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
1348 && TYPE_NFIELDS (type
) == 1
1349 && (TYPE_CODE (range_type
= TYPE_FIELD_TYPE (type
, 0))
1350 == TYPE_CODE_RANGE
))
1352 /* Now recompute the length of the array type, based on its
1353 number of elements and the target type's length. */
1354 TYPE_LENGTH (type
) =
1355 ((TYPE_FIELD_BITPOS (range_type
, 1)
1356 - TYPE_FIELD_BITPOS (range_type
, 0)
1358 * TYPE_LENGTH (target_type
));
1359 TYPE_FLAGS (type
) &= ~TYPE_FLAG_TARGET_STUB
;
1361 else if (TYPE_CODE (type
) == TYPE_CODE_RANGE
)
1363 TYPE_LENGTH (type
) = TYPE_LENGTH (target_type
);
1364 TYPE_FLAGS (type
) &= ~TYPE_FLAG_TARGET_STUB
;
1367 /* Cache TYPE_LENGTH for future use. */
1368 TYPE_LENGTH (orig_type
) = TYPE_LENGTH (type
);
1372 /* New code added to support parsing of Cfront stabs strings */
1373 #define INIT_EXTRA { pextras->len=0; pextras->str[0]='\0'; }
1374 #define ADD_EXTRA(c) { pextras->str[pextras->len++]=c; }
1377 add_name (struct extra
*pextras
, char *n
)
1381 if ((nlen
= (n
? strlen (n
) : 0)) == 0)
1383 sprintf (pextras
->str
+ pextras
->len
, "%d%s", nlen
, n
);
1384 pextras
->len
= strlen (pextras
->str
);
1388 add_mangled_type (struct extra
*pextras
, struct type
*t
)
1390 enum type_code tcode
;
1394 tcode
= TYPE_CODE (t
);
1395 tlen
= TYPE_LENGTH (t
);
1396 tflags
= TYPE_FLAGS (t
);
1397 tname
= TYPE_NAME (t
);
1398 /* args of "..." seem to get mangled as "e" */
1416 if ((pname
= strrchr (tname
, 'l'), pname
) && !strcmp (pname
, "long"))
1429 static struct complaint msg
=
1430 {"Bad int type code length x%x\n", 0, 0};
1432 complain (&msg
, tlen
);
1451 static struct complaint msg
=
1452 {"Bad float type code length x%x\n", 0, 0};
1453 complain (&msg
, tlen
);
1459 /* followed by what it's a ref to */
1463 /* followed by what it's a ptr to */
1465 case TYPE_CODE_TYPEDEF
:
1467 static struct complaint msg
=
1468 {"Typedefs in overloaded functions not yet supported\n", 0, 0};
1471 /* followed by type bytes & name */
1473 case TYPE_CODE_FUNC
:
1475 /* followed by func's arg '_' & ret types */
1477 case TYPE_CODE_VOID
:
1480 case TYPE_CODE_METHOD
:
1482 /* followed by name of class and func's arg '_' & ret types */
1483 add_name (pextras
, tname
);
1484 ADD_EXTRA ('F'); /* then mangle function */
1486 case TYPE_CODE_STRUCT
: /* C struct */
1487 case TYPE_CODE_UNION
: /* C union */
1488 case TYPE_CODE_ENUM
: /* Enumeration type */
1489 /* followed by name of type */
1490 add_name (pextras
, tname
);
1493 /* errors possible types/not supported */
1494 case TYPE_CODE_CHAR
:
1495 case TYPE_CODE_ARRAY
: /* Array type */
1496 case TYPE_CODE_MEMBER
: /* Member type */
1497 case TYPE_CODE_BOOL
:
1498 case TYPE_CODE_COMPLEX
: /* Complex float */
1499 case TYPE_CODE_UNDEF
:
1500 case TYPE_CODE_SET
: /* Pascal sets */
1501 case TYPE_CODE_RANGE
:
1502 case TYPE_CODE_STRING
:
1503 case TYPE_CODE_BITSTRING
:
1504 case TYPE_CODE_ERROR
:
1507 static struct complaint msg
=
1508 {"Unknown type code x%x\n", 0, 0};
1509 complain (&msg
, tcode
);
1513 add_mangled_type (pextras
, t
->target_type
);
1518 cfront_mangle_name (struct type
*type
, int i
, int j
)
1521 char *mangled_name
= gdb_mangle_name (type
, i
, j
);
1523 f
= TYPE_FN_FIELDLIST1 (type
, i
); /* moved from below */
1525 /* kludge to support cfront methods - gdb expects to find "F" for
1526 ARM_mangled names, so when we mangle, we have to add it here */
1530 char *arm_mangled_name
;
1531 struct fn_field
*method
= &f
[j
];
1532 char *field_name
= TYPE_FN_FIELDLIST_NAME (type
, i
);
1533 char *physname
= TYPE_FN_FIELD_PHYSNAME (f
, j
);
1534 char *newname
= type_name_no_tag (type
);
1536 struct type
*ftype
= TYPE_FN_FIELD_TYPE (f
, j
);
1537 int nargs
= TYPE_NFIELDS (ftype
); /* number of args */
1538 struct extra extras
, *pextras
= &extras
;
1541 if (TYPE_FN_FIELD_STATIC_P (f
, j
)) /* j for sublist within this list */
1544 /* add args here! */
1545 if (nargs
<= 1) /* no args besides this */
1549 for (k
= 1; k
< nargs
; k
++)
1552 t
= TYPE_FIELD_TYPE (ftype
, k
);
1553 add_mangled_type (pextras
, t
);
1557 printf ("add_mangled_type: %s\n", extras
.str
); /* FIXME */
1558 xasprintf (&arm_mangled_name
, "%s%s", mangled_name
, extras
.str
);
1559 xfree (mangled_name
);
1560 mangled_name
= arm_mangled_name
;
1566 /* End of new code added to support parsing of Cfront stabs strings */
1568 /* Parse a type expression in the string [P..P+LENGTH). If an error occurs,
1569 silently return builtin_type_void. */
1572 safe_parse_type (char *p
, int length
)
1574 struct ui_file
*saved_gdb_stderr
;
1577 /* Suppress error messages. */
1578 saved_gdb_stderr
= gdb_stderr
;
1579 gdb_stderr
= ui_file_new ();
1581 /* Call parse_and_eval_type() without fear of longjmp()s. */
1582 if (!gdb_parse_and_eval_type (p
, length
, &type
))
1583 type
= builtin_type_void
;
1585 /* Stop suppressing error messages. */
1586 ui_file_delete (gdb_stderr
);
1587 gdb_stderr
= saved_gdb_stderr
;
1592 /* Ugly hack to convert method stubs into method types.
1594 He ain't kiddin'. This demangles the name of the method into a string
1595 including argument types, parses out each argument type, generates
1596 a string casting a zero to that type, evaluates the string, and stuffs
1597 the resulting type into an argtype vector!!! Then it knows the type
1598 of the whole function (including argument types for overloading),
1599 which info used to be in the stab's but was removed to hack back
1600 the space required for them. */
1603 check_stub_method (struct type
*type
, int method_id
, int signature_id
)
1606 char *mangled_name
= gdb_mangle_name (type
, method_id
, signature_id
);
1607 char *demangled_name
= cplus_demangle (mangled_name
,
1608 DMGL_PARAMS
| DMGL_ANSI
);
1609 char *argtypetext
, *p
;
1610 int depth
= 0, argcount
= 1;
1611 struct type
**argtypes
;
1614 /* Make sure we got back a function string that we can use. */
1616 p
= strchr (demangled_name
, '(');
1620 if (demangled_name
== NULL
|| p
== NULL
)
1621 error ("Internal: Cannot demangle mangled name `%s'.", mangled_name
);
1623 /* Now, read in the parameters that define this type. */
1628 if (*p
== '(' || *p
== '<')
1632 else if (*p
== ')' || *p
== '>')
1636 else if (*p
== ',' && depth
== 0)
1644 /* We need two more slots: one for the THIS pointer, and one for the
1645 NULL [...] or void [end of arglist]. */
1647 argtypes
= (struct type
**)
1648 TYPE_ALLOC (type
, (argcount
+ 2) * sizeof (struct type
*));
1650 /* FIXME: This is wrong for static member functions. */
1651 argtypes
[0] = lookup_pointer_type (type
);
1654 if (*p
!= ')') /* () means no args, skip while */
1659 if (depth
<= 0 && (*p
== ',' || *p
== ')'))
1661 /* Avoid parsing of ellipsis, they will be handled below. */
1662 if (strncmp (argtypetext
, "...", p
- argtypetext
) != 0)
1664 argtypes
[argcount
] =
1665 safe_parse_type (argtypetext
, p
- argtypetext
);
1668 argtypetext
= p
+ 1;
1671 if (*p
== '(' || *p
== '<')
1675 else if (*p
== ')' || *p
== '>')
1684 if (p
[-2] != '.') /* Not '...' */
1686 argtypes
[argcount
] = builtin_type_void
; /* List terminator */
1690 argtypes
[argcount
] = NULL
; /* Ellist terminator */
1693 xfree (demangled_name
);
1695 f
= TYPE_FN_FIELDLIST1 (type
, method_id
);
1697 TYPE_FN_FIELD_PHYSNAME (f
, signature_id
) = mangled_name
;
1699 /* Now update the old "stub" type into a real type. */
1700 mtype
= TYPE_FN_FIELD_TYPE (f
, signature_id
);
1701 TYPE_DOMAIN_TYPE (mtype
) = type
;
1702 TYPE_ARG_TYPES (mtype
) = argtypes
;
1703 TYPE_FLAGS (mtype
) &= ~TYPE_FLAG_STUB
;
1704 TYPE_FN_FIELD_STUB (f
, signature_id
) = 0;
1707 const struct cplus_struct_type cplus_struct_default
;
1710 allocate_cplus_struct_type (struct type
*type
)
1712 if (!HAVE_CPLUS_STRUCT (type
))
1714 TYPE_CPLUS_SPECIFIC (type
) = (struct cplus_struct_type
*)
1715 TYPE_ALLOC (type
, sizeof (struct cplus_struct_type
));
1716 *(TYPE_CPLUS_SPECIFIC (type
)) = cplus_struct_default
;
1720 /* Helper function to initialize the standard scalar types.
1722 If NAME is non-NULL and OBJFILE is non-NULL, then we make a copy
1723 of the string pointed to by name in the type_obstack for that objfile,
1724 and initialize the type name to that copy. There are places (mipsread.c
1725 in particular, where init_type is called with a NULL value for NAME). */
1728 init_type (enum type_code code
, int length
, int flags
, char *name
,
1729 struct objfile
*objfile
)
1731 register struct type
*type
;
1733 type
= alloc_type (objfile
);
1734 TYPE_CODE (type
) = code
;
1735 TYPE_LENGTH (type
) = length
;
1736 TYPE_FLAGS (type
) |= flags
;
1737 if ((name
!= NULL
) && (objfile
!= NULL
))
1740 obsavestring (name
, strlen (name
), &objfile
->type_obstack
);
1744 TYPE_NAME (type
) = name
;
1749 if (code
== TYPE_CODE_STRUCT
|| code
== TYPE_CODE_UNION
)
1751 INIT_CPLUS_SPECIFIC (type
);
1756 /* Helper function. Create an empty composite type. */
1759 init_composite_type (char *name
, enum type_code code
)
1762 gdb_assert (code
== TYPE_CODE_STRUCT
1763 || code
== TYPE_CODE_UNION
);
1764 t
= init_type (code
, 0, 0, NULL
, NULL
);
1765 TYPE_TAG_NAME (t
) = name
;
1769 /* Helper function. Append a field to a composite type. */
1772 append_composite_type_field (struct type
*t
, char *name
, struct type
*field
)
1775 TYPE_NFIELDS (t
) = TYPE_NFIELDS (t
) + 1;
1776 TYPE_FIELDS (t
) = xrealloc (TYPE_FIELDS (t
),
1777 sizeof (struct field
) * TYPE_NFIELDS (t
));
1778 f
= &(TYPE_FIELDS (t
)[TYPE_NFIELDS (t
) - 1]);
1779 memset (f
, 0, sizeof f
[0]);
1780 FIELD_TYPE (f
[0]) = field
;
1781 FIELD_NAME (f
[0]) = name
;
1782 if (TYPE_CODE (t
) == TYPE_CODE_UNION
)
1784 if (TYPE_LENGTH (t
) > TYPE_LENGTH (field
))
1785 TYPE_LENGTH (t
) = TYPE_LENGTH (field
);
1787 else if (TYPE_CODE (t
) == TYPE_CODE_STRUCT
)
1789 TYPE_LENGTH (t
) = TYPE_LENGTH (t
) + TYPE_LENGTH (field
);
1790 if (TYPE_NFIELDS (t
) > 1)
1792 FIELD_BITPOS (f
[0]) = (FIELD_BITPOS (f
[-1])
1793 + TYPE_LENGTH (field
) * TARGET_CHAR_BIT
);
1798 /* Look up a fundamental type for the specified objfile.
1799 May need to construct such a type if this is the first use.
1801 Some object file formats (ELF, COFF, etc) do not define fundamental
1802 types such as "int" or "double". Others (stabs for example), do
1803 define fundamental types.
1805 For the formats which don't provide fundamental types, gdb can create
1806 such types, using defaults reasonable for the current language and
1807 the current target machine.
1809 NOTE: This routine is obsolescent. Each debugging format reader
1810 should manage it's own fundamental types, either creating them from
1811 suitable defaults or reading them from the debugging information,
1812 whichever is appropriate. The DWARF reader has already been
1813 fixed to do this. Once the other readers are fixed, this routine
1814 will go away. Also note that fundamental types should be managed
1815 on a compilation unit basis in a multi-language environment, not
1816 on a linkage unit basis as is done here. */
1820 lookup_fundamental_type (struct objfile
*objfile
, int typeid)
1822 register struct type
**typep
;
1823 register int nbytes
;
1825 if (typeid < 0 || typeid >= FT_NUM_MEMBERS
)
1827 error ("internal error - invalid fundamental type id %d", typeid);
1830 /* If this is the first time we need a fundamental type for this objfile
1831 then we need to initialize the vector of type pointers. */
1833 if (objfile
->fundamental_types
== NULL
)
1835 nbytes
= FT_NUM_MEMBERS
* sizeof (struct type
*);
1836 objfile
->fundamental_types
= (struct type
**)
1837 obstack_alloc (&objfile
->type_obstack
, nbytes
);
1838 memset ((char *) objfile
->fundamental_types
, 0, nbytes
);
1839 OBJSTAT (objfile
, n_types
+= FT_NUM_MEMBERS
);
1842 /* Look for this particular type in the fundamental type vector. If one is
1843 not found, create and install one appropriate for the current language. */
1845 typep
= objfile
->fundamental_types
+ typeid;
1848 *typep
= create_fundamental_type (objfile
, typeid);
1855 can_dereference (struct type
*t
)
1857 /* FIXME: Should we return true for references as well as pointers? */
1861 && TYPE_CODE (t
) == TYPE_CODE_PTR
1862 && TYPE_CODE (TYPE_TARGET_TYPE (t
)) != TYPE_CODE_VOID
);
1866 is_integral_type (struct type
*t
)
1871 && ((TYPE_CODE (t
) == TYPE_CODE_INT
)
1872 || (TYPE_CODE (t
) == TYPE_CODE_ENUM
)
1873 || (TYPE_CODE (t
) == TYPE_CODE_CHAR
)
1874 || (TYPE_CODE (t
) == TYPE_CODE_RANGE
)
1875 || (TYPE_CODE (t
) == TYPE_CODE_BOOL
)));
1878 /* Chill varying string and arrays are represented as follows:
1880 struct { int __var_length; ELEMENT_TYPE[MAX_SIZE] __var_data};
1882 Return true if TYPE is such a Chill varying type. */
1885 chill_varying_type (struct type
*type
)
1887 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
1888 || TYPE_NFIELDS (type
) != 2
1889 || strcmp (TYPE_FIELD_NAME (type
, 0), "__var_length") != 0)
1894 /* Check whether BASE is an ancestor or base class or DCLASS
1895 Return 1 if so, and 0 if not.
1896 Note: callers may want to check for identity of the types before
1897 calling this function -- identical types are considered to satisfy
1898 the ancestor relationship even if they're identical */
1901 is_ancestor (struct type
*base
, struct type
*dclass
)
1905 CHECK_TYPEDEF (base
);
1906 CHECK_TYPEDEF (dclass
);
1910 if (TYPE_NAME (base
) && TYPE_NAME (dclass
) &&
1911 !strcmp (TYPE_NAME (base
), TYPE_NAME (dclass
)))
1914 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1915 if (is_ancestor (base
, TYPE_BASECLASS (dclass
, i
)))
1923 /* See whether DCLASS has a virtual table. This routine is aimed at
1924 the HP/Taligent ANSI C++ runtime model, and may not work with other
1925 runtime models. Return 1 => Yes, 0 => No. */
1928 has_vtable (struct type
*dclass
)
1930 /* In the HP ANSI C++ runtime model, a class has a vtable only if it
1931 has virtual functions or virtual bases. */
1935 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
1938 /* First check for the presence of virtual bases */
1939 if (TYPE_FIELD_VIRTUAL_BITS (dclass
))
1940 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1941 if (B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass
), i
))
1944 /* Next check for virtual functions */
1945 if (TYPE_FN_FIELDLISTS (dclass
))
1946 for (i
= 0; i
< TYPE_NFN_FIELDS (dclass
); i
++)
1947 if (TYPE_FN_FIELD_VIRTUAL_P (TYPE_FN_FIELDLIST1 (dclass
, i
), 0))
1950 /* Recurse on non-virtual bases to see if any of them needs a vtable */
1951 if (TYPE_FIELD_VIRTUAL_BITS (dclass
))
1952 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1953 if ((!B_TST (TYPE_FIELD_VIRTUAL_BITS (dclass
), i
)) &&
1954 (has_vtable (TYPE_FIELD_TYPE (dclass
, i
))))
1957 /* Well, maybe we don't need a virtual table */
1961 /* Return a pointer to the "primary base class" of DCLASS.
1963 A NULL return indicates that DCLASS has no primary base, or that it
1964 couldn't be found (insufficient information).
1966 This routine is aimed at the HP/Taligent ANSI C++ runtime model,
1967 and may not work with other runtime models. */
1970 primary_base_class (struct type
*dclass
)
1972 /* In HP ANSI C++'s runtime model, a "primary base class" of a class
1973 is the first directly inherited, non-virtual base class that
1974 requires a virtual table */
1978 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
1981 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
1982 if (!TYPE_FIELD_VIRTUAL (dclass
, i
) &&
1983 has_vtable (TYPE_FIELD_TYPE (dclass
, i
)))
1984 return TYPE_FIELD_TYPE (dclass
, i
);
1989 /* Global manipulated by virtual_base_list[_aux]() */
1991 static struct vbase
*current_vbase_list
= NULL
;
1993 /* Return a pointer to a null-terminated list of struct vbase
1994 items. The vbasetype pointer of each item in the list points to the
1995 type information for a virtual base of the argument DCLASS.
1997 Helper function for virtual_base_list().
1998 Note: the list goes backward, right-to-left. virtual_base_list()
1999 copies the items out in reverse order. */
2002 virtual_base_list_aux (struct type
*dclass
)
2004 struct vbase
*tmp_vbase
;
2007 if (TYPE_CODE (dclass
) != TYPE_CODE_CLASS
)
2010 for (i
= 0; i
< TYPE_N_BASECLASSES (dclass
); i
++)
2012 /* Recurse on this ancestor, first */
2013 virtual_base_list_aux (TYPE_FIELD_TYPE (dclass
, i
));
2015 /* If this current base is itself virtual, add it to the list */
2016 if (BASETYPE_VIA_VIRTUAL (dclass
, i
))
2018 struct type
*basetype
= TYPE_FIELD_TYPE (dclass
, i
);
2020 /* Check if base already recorded */
2021 tmp_vbase
= current_vbase_list
;
2024 if (tmp_vbase
->vbasetype
== basetype
)
2025 break; /* found it */
2026 tmp_vbase
= tmp_vbase
->next
;
2029 if (!tmp_vbase
) /* normal exit from loop */
2031 /* Allocate new item for this virtual base */
2032 tmp_vbase
= (struct vbase
*) xmalloc (sizeof (struct vbase
));
2034 /* Stick it on at the end of the list */
2035 tmp_vbase
->vbasetype
= basetype
;
2036 tmp_vbase
->next
= current_vbase_list
;
2037 current_vbase_list
= tmp_vbase
;
2040 } /* for loop over bases */
2044 /* Compute the list of virtual bases in the right order. Virtual
2045 bases are laid out in the object's memory area in order of their
2046 occurrence in a depth-first, left-to-right search through the
2049 Argument DCLASS is the type whose virtual bases are required.
2050 Return value is the address of a null-terminated array of pointers
2051 to struct type items.
2053 This routine is aimed at the HP/Taligent ANSI C++ runtime model,
2054 and may not work with other runtime models.
2056 This routine merely hands off the argument to virtual_base_list_aux()
2057 and then copies the result into an array to save space. */
2060 virtual_base_list (struct type
*dclass
)
2062 register struct vbase
*tmp_vbase
;
2063 register struct vbase
*tmp_vbase_2
;
2066 struct type
**vbase_array
;
2068 current_vbase_list
= NULL
;
2069 virtual_base_list_aux (dclass
);
2071 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; i
++, tmp_vbase
= tmp_vbase
->next
)
2076 vbase_array
= (struct type
**) xmalloc ((count
+ 1) * sizeof (struct type
*));
2078 for (i
= count
- 1, tmp_vbase
= current_vbase_list
; i
>= 0; i
--, tmp_vbase
= tmp_vbase
->next
)
2079 vbase_array
[i
] = tmp_vbase
->vbasetype
;
2081 /* Get rid of constructed chain */
2082 tmp_vbase_2
= tmp_vbase
= current_vbase_list
;
2085 tmp_vbase
= tmp_vbase
->next
;
2086 xfree (tmp_vbase_2
);
2087 tmp_vbase_2
= tmp_vbase
;
2090 vbase_array
[count
] = NULL
;
2094 /* Return the length of the virtual base list of the type DCLASS. */
2097 virtual_base_list_length (struct type
*dclass
)
2100 register struct vbase
*tmp_vbase
;
2102 current_vbase_list
= NULL
;
2103 virtual_base_list_aux (dclass
);
2105 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; i
++, tmp_vbase
= tmp_vbase
->next
)
2110 /* Return the number of elements of the virtual base list of the type
2111 DCLASS, ignoring those appearing in the primary base (and its
2112 primary base, recursively). */
2115 virtual_base_list_length_skip_primaries (struct type
*dclass
)
2118 register struct vbase
*tmp_vbase
;
2119 struct type
*primary
;
2121 primary
= TYPE_RUNTIME_PTR (dclass
) ? TYPE_PRIMARY_BASE (dclass
) : NULL
;
2124 return virtual_base_list_length (dclass
);
2126 current_vbase_list
= NULL
;
2127 virtual_base_list_aux (dclass
);
2129 for (i
= 0, tmp_vbase
= current_vbase_list
; tmp_vbase
!= NULL
; tmp_vbase
= tmp_vbase
->next
)
2131 if (virtual_base_index (tmp_vbase
->vbasetype
, primary
) >= 0)
2139 /* Return the index (position) of type BASE, which is a virtual base
2140 class of DCLASS, in the latter's virtual base list. A return of -1
2141 indicates "not found" or a problem. */
2144 virtual_base_index (struct type
*base
, struct type
*dclass
)
2146 register struct type
*vbase
;
2149 if ((TYPE_CODE (dclass
) != TYPE_CODE_CLASS
) ||
2150 (TYPE_CODE (base
) != TYPE_CODE_CLASS
))
2154 vbase
= virtual_base_list (dclass
)[0];
2159 vbase
= virtual_base_list (dclass
)[++i
];
2162 return vbase
? i
: -1;
2167 /* Return the index (position) of type BASE, which is a virtual base
2168 class of DCLASS, in the latter's virtual base list. Skip over all
2169 bases that may appear in the virtual base list of the primary base
2170 class of DCLASS (recursively). A return of -1 indicates "not
2171 found" or a problem. */
2174 virtual_base_index_skip_primaries (struct type
*base
, struct type
*dclass
)
2176 register struct type
*vbase
;
2178 struct type
*primary
;
2180 if ((TYPE_CODE (dclass
) != TYPE_CODE_CLASS
) ||
2181 (TYPE_CODE (base
) != TYPE_CODE_CLASS
))
2184 primary
= TYPE_RUNTIME_PTR (dclass
) ? TYPE_PRIMARY_BASE (dclass
) : NULL
;
2188 vbase
= virtual_base_list (dclass
)[0];
2191 if (!primary
|| (virtual_base_index_skip_primaries (vbase
, primary
) < 0))
2195 vbase
= virtual_base_list (dclass
)[++i
];
2198 return vbase
? j
: -1;
2201 /* Return position of a derived class DCLASS in the list of
2202 * primary bases starting with the remotest ancestor.
2203 * Position returned is 0-based. */
2206 class_index_in_primary_list (struct type
*dclass
)
2208 struct type
*pbc
; /* primary base class */
2210 /* Simply recurse on primary base */
2211 pbc
= TYPE_PRIMARY_BASE (dclass
);
2213 return 1 + class_index_in_primary_list (pbc
);
2218 /* Return a count of the number of virtual functions a type has.
2219 * This includes all the virtual functions it inherits from its
2223 /* pai: FIXME This doesn't do the right thing: count redefined virtual
2224 * functions only once (latest redefinition)
2228 count_virtual_fns (struct type
*dclass
)
2230 int fn
, oi
; /* function and overloaded instance indices */
2231 int vfuncs
; /* count to return */
2233 /* recurse on bases that can share virtual table */
2234 struct type
*pbc
= primary_base_class (dclass
);
2236 vfuncs
= count_virtual_fns (pbc
);
2240 for (fn
= 0; fn
< TYPE_NFN_FIELDS (dclass
); fn
++)
2241 for (oi
= 0; oi
< TYPE_FN_FIELDLIST_LENGTH (dclass
, fn
); oi
++)
2242 if (TYPE_FN_FIELD_VIRTUAL_P (TYPE_FN_FIELDLIST1 (dclass
, fn
), oi
))
2250 /* Functions for overload resolution begin here */
2252 /* Compare two badness vectors A and B and return the result.
2253 * 0 => A and B are identical
2254 * 1 => A and B are incomparable
2255 * 2 => A is better than B
2256 * 3 => A is worse than B */
2259 compare_badness (struct badness_vector
*a
, struct badness_vector
*b
)
2263 short found_pos
= 0; /* any positives in c? */
2264 short found_neg
= 0; /* any negatives in c? */
2266 /* differing lengths => incomparable */
2267 if (a
->length
!= b
->length
)
2270 /* Subtract b from a */
2271 for (i
= 0; i
< a
->length
; i
++)
2273 tmp
= a
->rank
[i
] - b
->rank
[i
];
2283 return 1; /* incomparable */
2285 return 3; /* A > B */
2291 return 2; /* A < B */
2293 return 0; /* A == B */
2297 /* Rank a function by comparing its parameter types (PARMS, length NPARMS),
2298 * to the types of an argument list (ARGS, length NARGS).
2299 * Return a pointer to a badness vector. This has NARGS + 1 entries. */
2301 struct badness_vector
*
2302 rank_function (struct type
**parms
, int nparms
, struct type
**args
, int nargs
)
2305 struct badness_vector
*bv
;
2306 int min_len
= nparms
< nargs
? nparms
: nargs
;
2308 bv
= xmalloc (sizeof (struct badness_vector
));
2309 bv
->length
= nargs
+ 1; /* add 1 for the length-match rank */
2310 bv
->rank
= xmalloc ((nargs
+ 1) * sizeof (int));
2312 /* First compare the lengths of the supplied lists.
2313 * If there is a mismatch, set it to a high value. */
2315 /* pai/1997-06-03 FIXME: when we have debug info about default
2316 * arguments and ellipsis parameter lists, we should consider those
2317 * and rank the length-match more finely. */
2319 LENGTH_MATCH (bv
) = (nargs
!= nparms
) ? LENGTH_MISMATCH_BADNESS
: 0;
2321 /* Now rank all the parameters of the candidate function */
2322 for (i
= 1; i
<= min_len
; i
++)
2323 bv
->rank
[i
] = rank_one_type (parms
[i
-1], args
[i
-1]);
2325 /* If more arguments than parameters, add dummy entries */
2326 for (i
= min_len
+ 1; i
<= nargs
; i
++)
2327 bv
->rank
[i
] = TOO_FEW_PARAMS_BADNESS
;
2332 /* Compare one type (PARM) for compatibility with another (ARG).
2333 * PARM is intended to be the parameter type of a function; and
2334 * ARG is the supplied argument's type. This function tests if
2335 * the latter can be converted to the former.
2337 * Return 0 if they are identical types;
2338 * Otherwise, return an integer which corresponds to how compatible
2339 * PARM is to ARG. The higher the return value, the worse the match.
2340 * Generally the "bad" conversions are all uniformly assigned a 100 */
2343 rank_one_type (struct type
*parm
, struct type
*arg
)
2345 /* Identical type pointers */
2346 /* However, this still doesn't catch all cases of same type for arg
2347 * and param. The reason is that builtin types are different from
2348 * the same ones constructed from the object. */
2352 /* Resolve typedefs */
2353 if (TYPE_CODE (parm
) == TYPE_CODE_TYPEDEF
)
2354 parm
= check_typedef (parm
);
2355 if (TYPE_CODE (arg
) == TYPE_CODE_TYPEDEF
)
2356 arg
= check_typedef (arg
);
2359 Well, damnit, if the names are exactly the same,
2360 i'll say they are exactly the same. This happens when we generate
2361 method stubs. The types won't point to the same address, but they
2362 really are the same.
2365 if (TYPE_NAME (parm
) && TYPE_NAME (arg
) &&
2366 !strcmp (TYPE_NAME (parm
), TYPE_NAME (arg
)))
2369 /* Check if identical after resolving typedefs */
2373 /* See through references, since we can almost make non-references
2375 if (TYPE_CODE (arg
) == TYPE_CODE_REF
)
2376 return (rank_one_type (parm
, TYPE_TARGET_TYPE (arg
))
2377 + REFERENCE_CONVERSION_BADNESS
);
2378 if (TYPE_CODE (parm
) == TYPE_CODE_REF
)
2379 return (rank_one_type (TYPE_TARGET_TYPE (parm
), arg
)
2380 + REFERENCE_CONVERSION_BADNESS
);
2382 /* Debugging only. */
2383 fprintf_filtered (gdb_stderr
,"------ Arg is %s [%d], parm is %s [%d]\n",
2384 TYPE_NAME (arg
), TYPE_CODE (arg
), TYPE_NAME (parm
), TYPE_CODE (parm
));
2386 /* x -> y means arg of type x being supplied for parameter of type y */
2388 switch (TYPE_CODE (parm
))
2391 switch (TYPE_CODE (arg
))
2394 if (TYPE_CODE (TYPE_TARGET_TYPE (parm
)) == TYPE_CODE_VOID
)
2395 return VOID_PTR_CONVERSION_BADNESS
;
2397 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2398 case TYPE_CODE_ARRAY
:
2399 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2400 case TYPE_CODE_FUNC
:
2401 return rank_one_type (TYPE_TARGET_TYPE (parm
), arg
);
2403 case TYPE_CODE_ENUM
:
2404 case TYPE_CODE_CHAR
:
2405 case TYPE_CODE_RANGE
:
2406 case TYPE_CODE_BOOL
:
2407 return POINTER_CONVERSION_BADNESS
;
2409 return INCOMPATIBLE_TYPE_BADNESS
;
2411 case TYPE_CODE_ARRAY
:
2412 switch (TYPE_CODE (arg
))
2415 case TYPE_CODE_ARRAY
:
2416 return rank_one_type (TYPE_TARGET_TYPE (parm
), TYPE_TARGET_TYPE (arg
));
2418 return INCOMPATIBLE_TYPE_BADNESS
;
2420 case TYPE_CODE_FUNC
:
2421 switch (TYPE_CODE (arg
))
2423 case TYPE_CODE_PTR
: /* funcptr -> func */
2424 return rank_one_type (parm
, TYPE_TARGET_TYPE (arg
));
2426 return INCOMPATIBLE_TYPE_BADNESS
;
2429 switch (TYPE_CODE (arg
))
2432 if (TYPE_LENGTH (arg
) == TYPE_LENGTH (parm
))
2434 /* Deal with signed, unsigned, and plain chars and
2435 signed and unsigned ints */
2436 if (TYPE_NOSIGN (parm
))
2438 /* This case only for character types */
2439 if (TYPE_NOSIGN (arg
)) /* plain char -> plain char */
2442 return INTEGER_COERCION_BADNESS
; /* signed/unsigned char -> plain char */
2444 else if (TYPE_UNSIGNED (parm
))
2446 if (TYPE_UNSIGNED (arg
))
2448 if (!strcmp_iw (TYPE_NAME (parm
), TYPE_NAME (arg
)))
2449 return 0; /* unsigned int -> unsigned int, or unsigned long -> unsigned long */
2450 else if (!strcmp_iw (TYPE_NAME (arg
), "int") && !strcmp_iw (TYPE_NAME (parm
), "long"))
2451 return INTEGER_PROMOTION_BADNESS
; /* unsigned int -> unsigned long */
2453 return INTEGER_COERCION_BADNESS
; /* unsigned long -> unsigned int */
2457 if (!strcmp_iw (TYPE_NAME (arg
), "long") && !strcmp_iw (TYPE_NAME (parm
), "int"))
2458 return INTEGER_COERCION_BADNESS
; /* signed long -> unsigned int */
2460 return INTEGER_CONVERSION_BADNESS
; /* signed int/long -> unsigned int/long */
2463 else if (!TYPE_NOSIGN (arg
) && !TYPE_UNSIGNED (arg
))
2465 if (!strcmp_iw (TYPE_NAME (parm
), TYPE_NAME (arg
)))
2467 else if (!strcmp_iw (TYPE_NAME (arg
), "int") && !strcmp_iw (TYPE_NAME (parm
), "long"))
2468 return INTEGER_PROMOTION_BADNESS
;
2470 return INTEGER_COERCION_BADNESS
;
2473 return INTEGER_COERCION_BADNESS
;
2475 else if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2476 return INTEGER_PROMOTION_BADNESS
;
2478 return INTEGER_COERCION_BADNESS
;
2479 case TYPE_CODE_ENUM
:
2480 case TYPE_CODE_CHAR
:
2481 case TYPE_CODE_RANGE
:
2482 case TYPE_CODE_BOOL
:
2483 return INTEGER_PROMOTION_BADNESS
;
2485 return INT_FLOAT_CONVERSION_BADNESS
;
2487 return NS_POINTER_CONVERSION_BADNESS
;
2489 return INCOMPATIBLE_TYPE_BADNESS
;
2492 case TYPE_CODE_ENUM
:
2493 switch (TYPE_CODE (arg
))
2496 case TYPE_CODE_CHAR
:
2497 case TYPE_CODE_RANGE
:
2498 case TYPE_CODE_BOOL
:
2499 case TYPE_CODE_ENUM
:
2500 return INTEGER_COERCION_BADNESS
;
2502 return INT_FLOAT_CONVERSION_BADNESS
;
2504 return INCOMPATIBLE_TYPE_BADNESS
;
2507 case TYPE_CODE_CHAR
:
2508 switch (TYPE_CODE (arg
))
2510 case TYPE_CODE_RANGE
:
2511 case TYPE_CODE_BOOL
:
2512 case TYPE_CODE_ENUM
:
2513 return INTEGER_COERCION_BADNESS
;
2515 return INT_FLOAT_CONVERSION_BADNESS
;
2517 if (TYPE_LENGTH (arg
) > TYPE_LENGTH (parm
))
2518 return INTEGER_COERCION_BADNESS
;
2519 else if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2520 return INTEGER_PROMOTION_BADNESS
;
2521 /* >>> !! else fall through !! <<< */
2522 case TYPE_CODE_CHAR
:
2523 /* Deal with signed, unsigned, and plain chars for C++
2524 and with int cases falling through from previous case */
2525 if (TYPE_NOSIGN (parm
))
2527 if (TYPE_NOSIGN (arg
))
2530 return INTEGER_COERCION_BADNESS
;
2532 else if (TYPE_UNSIGNED (parm
))
2534 if (TYPE_UNSIGNED (arg
))
2537 return INTEGER_PROMOTION_BADNESS
;
2539 else if (!TYPE_NOSIGN (arg
) && !TYPE_UNSIGNED (arg
))
2542 return INTEGER_COERCION_BADNESS
;
2544 return INCOMPATIBLE_TYPE_BADNESS
;
2547 case TYPE_CODE_RANGE
:
2548 switch (TYPE_CODE (arg
))
2551 case TYPE_CODE_CHAR
:
2552 case TYPE_CODE_RANGE
:
2553 case TYPE_CODE_BOOL
:
2554 case TYPE_CODE_ENUM
:
2555 return INTEGER_COERCION_BADNESS
;
2557 return INT_FLOAT_CONVERSION_BADNESS
;
2559 return INCOMPATIBLE_TYPE_BADNESS
;
2562 case TYPE_CODE_BOOL
:
2563 switch (TYPE_CODE (arg
))
2566 case TYPE_CODE_CHAR
:
2567 case TYPE_CODE_RANGE
:
2568 case TYPE_CODE_ENUM
:
2571 return BOOLEAN_CONVERSION_BADNESS
;
2572 case TYPE_CODE_BOOL
:
2575 return INCOMPATIBLE_TYPE_BADNESS
;
2579 switch (TYPE_CODE (arg
))
2582 if (TYPE_LENGTH (arg
) < TYPE_LENGTH (parm
))
2583 return FLOAT_PROMOTION_BADNESS
;
2584 else if (TYPE_LENGTH (arg
) == TYPE_LENGTH (parm
))
2587 return FLOAT_CONVERSION_BADNESS
;
2589 case TYPE_CODE_BOOL
:
2590 case TYPE_CODE_ENUM
:
2591 case TYPE_CODE_RANGE
:
2592 case TYPE_CODE_CHAR
:
2593 return INT_FLOAT_CONVERSION_BADNESS
;
2595 return INCOMPATIBLE_TYPE_BADNESS
;
2598 case TYPE_CODE_COMPLEX
:
2599 switch (TYPE_CODE (arg
))
2600 { /* Strictly not needed for C++, but... */
2602 return FLOAT_PROMOTION_BADNESS
;
2603 case TYPE_CODE_COMPLEX
:
2606 return INCOMPATIBLE_TYPE_BADNESS
;
2609 case TYPE_CODE_STRUCT
:
2610 /* currently same as TYPE_CODE_CLASS */
2611 switch (TYPE_CODE (arg
))
2613 case TYPE_CODE_STRUCT
:
2614 /* Check for derivation */
2615 if (is_ancestor (parm
, arg
))
2616 return BASE_CONVERSION_BADNESS
;
2617 /* else fall through */
2619 return INCOMPATIBLE_TYPE_BADNESS
;
2622 case TYPE_CODE_UNION
:
2623 switch (TYPE_CODE (arg
))
2625 case TYPE_CODE_UNION
:
2627 return INCOMPATIBLE_TYPE_BADNESS
;
2630 case TYPE_CODE_MEMBER
:
2631 switch (TYPE_CODE (arg
))
2634 return INCOMPATIBLE_TYPE_BADNESS
;
2637 case TYPE_CODE_METHOD
:
2638 switch (TYPE_CODE (arg
))
2642 return INCOMPATIBLE_TYPE_BADNESS
;
2646 switch (TYPE_CODE (arg
))
2650 return INCOMPATIBLE_TYPE_BADNESS
;
2655 switch (TYPE_CODE (arg
))
2659 return rank_one_type (TYPE_FIELD_TYPE (parm
, 0), TYPE_FIELD_TYPE (arg
, 0));
2661 return INCOMPATIBLE_TYPE_BADNESS
;
2664 case TYPE_CODE_VOID
:
2666 return INCOMPATIBLE_TYPE_BADNESS
;
2667 } /* switch (TYPE_CODE (arg)) */
2671 /* End of functions for overload resolution */
2674 print_bit_vector (B_TYPE
*bits
, int nbits
)
2678 for (bitno
= 0; bitno
< nbits
; bitno
++)
2680 if ((bitno
% 8) == 0)
2682 puts_filtered (" ");
2684 if (B_TST (bits
, bitno
))
2686 printf_filtered ("1");
2690 printf_filtered ("0");
2695 /* The args list is a strange beast. It is either terminated by a NULL
2696 pointer for varargs functions, or by a pointer to a TYPE_CODE_VOID
2697 type for normal fixed argcount functions. (FIXME someday)
2698 Also note the first arg should be the "this" pointer, we may not want to
2699 include it since we may get into a infinitely recursive situation. */
2702 print_arg_types (struct type
**args
, int spaces
)
2706 while (*args
!= NULL
)
2708 recursive_dump_type (*args
, spaces
+ 2);
2709 if ((*args
++)->code
== TYPE_CODE_VOID
)
2718 dump_fn_fieldlists (struct type
*type
, int spaces
)
2724 printfi_filtered (spaces
, "fn_fieldlists ");
2725 gdb_print_host_address (TYPE_FN_FIELDLISTS (type
), gdb_stdout
);
2726 printf_filtered ("\n");
2727 for (method_idx
= 0; method_idx
< TYPE_NFN_FIELDS (type
); method_idx
++)
2729 f
= TYPE_FN_FIELDLIST1 (type
, method_idx
);
2730 printfi_filtered (spaces
+ 2, "[%d] name '%s' (",
2732 TYPE_FN_FIELDLIST_NAME (type
, method_idx
));
2733 gdb_print_host_address (TYPE_FN_FIELDLIST_NAME (type
, method_idx
),
2735 printf_filtered (") length %d\n",
2736 TYPE_FN_FIELDLIST_LENGTH (type
, method_idx
));
2737 for (overload_idx
= 0;
2738 overload_idx
< TYPE_FN_FIELDLIST_LENGTH (type
, method_idx
);
2741 printfi_filtered (spaces
+ 4, "[%d] physname '%s' (",
2743 TYPE_FN_FIELD_PHYSNAME (f
, overload_idx
));
2744 gdb_print_host_address (TYPE_FN_FIELD_PHYSNAME (f
, overload_idx
),
2746 printf_filtered (")\n");
2747 printfi_filtered (spaces
+ 8, "type ");
2748 gdb_print_host_address (TYPE_FN_FIELD_TYPE (f
, overload_idx
), gdb_stdout
);
2749 printf_filtered ("\n");
2751 recursive_dump_type (TYPE_FN_FIELD_TYPE (f
, overload_idx
),
2754 printfi_filtered (spaces
+ 8, "args ");
2755 gdb_print_host_address (TYPE_FN_FIELD_ARGS (f
, overload_idx
), gdb_stdout
);
2756 printf_filtered ("\n");
2758 print_arg_types (TYPE_FN_FIELD_ARGS (f
, overload_idx
), spaces
);
2759 printfi_filtered (spaces
+ 8, "fcontext ");
2760 gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f
, overload_idx
),
2762 printf_filtered ("\n");
2764 printfi_filtered (spaces
+ 8, "is_const %d\n",
2765 TYPE_FN_FIELD_CONST (f
, overload_idx
));
2766 printfi_filtered (spaces
+ 8, "is_volatile %d\n",
2767 TYPE_FN_FIELD_VOLATILE (f
, overload_idx
));
2768 printfi_filtered (spaces
+ 8, "is_private %d\n",
2769 TYPE_FN_FIELD_PRIVATE (f
, overload_idx
));
2770 printfi_filtered (spaces
+ 8, "is_protected %d\n",
2771 TYPE_FN_FIELD_PROTECTED (f
, overload_idx
));
2772 printfi_filtered (spaces
+ 8, "is_stub %d\n",
2773 TYPE_FN_FIELD_STUB (f
, overload_idx
));
2774 printfi_filtered (spaces
+ 8, "voffset %u\n",
2775 TYPE_FN_FIELD_VOFFSET (f
, overload_idx
));
2781 print_cplus_stuff (struct type
*type
, int spaces
)
2783 printfi_filtered (spaces
, "n_baseclasses %d\n",
2784 TYPE_N_BASECLASSES (type
));
2785 printfi_filtered (spaces
, "nfn_fields %d\n",
2786 TYPE_NFN_FIELDS (type
));
2787 printfi_filtered (spaces
, "nfn_fields_total %d\n",
2788 TYPE_NFN_FIELDS_TOTAL (type
));
2789 if (TYPE_N_BASECLASSES (type
) > 0)
2791 printfi_filtered (spaces
, "virtual_field_bits (%d bits at *",
2792 TYPE_N_BASECLASSES (type
));
2793 gdb_print_host_address (TYPE_FIELD_VIRTUAL_BITS (type
), gdb_stdout
);
2794 printf_filtered (")");
2796 print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type
),
2797 TYPE_N_BASECLASSES (type
));
2798 puts_filtered ("\n");
2800 if (TYPE_NFIELDS (type
) > 0)
2802 if (TYPE_FIELD_PRIVATE_BITS (type
) != NULL
)
2804 printfi_filtered (spaces
, "private_field_bits (%d bits at *",
2805 TYPE_NFIELDS (type
));
2806 gdb_print_host_address (TYPE_FIELD_PRIVATE_BITS (type
), gdb_stdout
);
2807 printf_filtered (")");
2808 print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type
),
2809 TYPE_NFIELDS (type
));
2810 puts_filtered ("\n");
2812 if (TYPE_FIELD_PROTECTED_BITS (type
) != NULL
)
2814 printfi_filtered (spaces
, "protected_field_bits (%d bits at *",
2815 TYPE_NFIELDS (type
));
2816 gdb_print_host_address (TYPE_FIELD_PROTECTED_BITS (type
), gdb_stdout
);
2817 printf_filtered (")");
2818 print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type
),
2819 TYPE_NFIELDS (type
));
2820 puts_filtered ("\n");
2823 if (TYPE_NFN_FIELDS (type
) > 0)
2825 dump_fn_fieldlists (type
, spaces
);
2830 print_bound_type (int bt
)
2834 case BOUND_CANNOT_BE_DETERMINED
:
2835 printf_filtered ("(BOUND_CANNOT_BE_DETERMINED)");
2837 case BOUND_BY_REF_ON_STACK
:
2838 printf_filtered ("(BOUND_BY_REF_ON_STACK)");
2840 case BOUND_BY_VALUE_ON_STACK
:
2841 printf_filtered ("(BOUND_BY_VALUE_ON_STACK)");
2843 case BOUND_BY_REF_IN_REG
:
2844 printf_filtered ("(BOUND_BY_REF_IN_REG)");
2846 case BOUND_BY_VALUE_IN_REG
:
2847 printf_filtered ("(BOUND_BY_VALUE_IN_REG)");
2850 printf_filtered ("(BOUND_SIMPLE)");
2853 printf_filtered ("(unknown bound type)");
2858 static struct obstack dont_print_type_obstack
;
2861 recursive_dump_type (struct type
*type
, int spaces
)
2866 obstack_begin (&dont_print_type_obstack
, 0);
2868 if (TYPE_NFIELDS (type
) > 0
2869 || (TYPE_CPLUS_SPECIFIC (type
) && TYPE_NFN_FIELDS (type
) > 0))
2871 struct type
**first_dont_print
2872 = (struct type
**) obstack_base (&dont_print_type_obstack
);
2874 int i
= (struct type
**) obstack_next_free (&dont_print_type_obstack
)
2879 if (type
== first_dont_print
[i
])
2881 printfi_filtered (spaces
, "type node ");
2882 gdb_print_host_address (type
, gdb_stdout
);
2883 printf_filtered (" <same as already seen type>\n");
2888 obstack_ptr_grow (&dont_print_type_obstack
, type
);
2891 printfi_filtered (spaces
, "type node ");
2892 gdb_print_host_address (type
, gdb_stdout
);
2893 printf_filtered ("\n");
2894 printfi_filtered (spaces
, "name '%s' (",
2895 TYPE_NAME (type
) ? TYPE_NAME (type
) : "<NULL>");
2896 gdb_print_host_address (TYPE_NAME (type
), gdb_stdout
);
2897 printf_filtered (")\n");
2898 printfi_filtered (spaces
, "tagname '%s' (",
2899 TYPE_TAG_NAME (type
) ? TYPE_TAG_NAME (type
) : "<NULL>");
2900 gdb_print_host_address (TYPE_TAG_NAME (type
), gdb_stdout
);
2901 printf_filtered (")\n");
2902 printfi_filtered (spaces
, "code 0x%x ", TYPE_CODE (type
));
2903 switch (TYPE_CODE (type
))
2905 case TYPE_CODE_UNDEF
:
2906 printf_filtered ("(TYPE_CODE_UNDEF)");
2909 printf_filtered ("(TYPE_CODE_PTR)");
2911 case TYPE_CODE_ARRAY
:
2912 printf_filtered ("(TYPE_CODE_ARRAY)");
2914 case TYPE_CODE_STRUCT
:
2915 printf_filtered ("(TYPE_CODE_STRUCT)");
2917 case TYPE_CODE_UNION
:
2918 printf_filtered ("(TYPE_CODE_UNION)");
2920 case TYPE_CODE_ENUM
:
2921 printf_filtered ("(TYPE_CODE_ENUM)");
2923 case TYPE_CODE_FUNC
:
2924 printf_filtered ("(TYPE_CODE_FUNC)");
2927 printf_filtered ("(TYPE_CODE_INT)");
2930 printf_filtered ("(TYPE_CODE_FLT)");
2932 case TYPE_CODE_VOID
:
2933 printf_filtered ("(TYPE_CODE_VOID)");
2936 printf_filtered ("(TYPE_CODE_SET)");
2938 case TYPE_CODE_RANGE
:
2939 printf_filtered ("(TYPE_CODE_RANGE)");
2941 case TYPE_CODE_STRING
:
2942 printf_filtered ("(TYPE_CODE_STRING)");
2944 case TYPE_CODE_BITSTRING
:
2945 printf_filtered ("(TYPE_CODE_BITSTRING)");
2947 case TYPE_CODE_ERROR
:
2948 printf_filtered ("(TYPE_CODE_ERROR)");
2950 case TYPE_CODE_MEMBER
:
2951 printf_filtered ("(TYPE_CODE_MEMBER)");
2953 case TYPE_CODE_METHOD
:
2954 printf_filtered ("(TYPE_CODE_METHOD)");
2957 printf_filtered ("(TYPE_CODE_REF)");
2959 case TYPE_CODE_CHAR
:
2960 printf_filtered ("(TYPE_CODE_CHAR)");
2962 case TYPE_CODE_BOOL
:
2963 printf_filtered ("(TYPE_CODE_BOOL)");
2965 case TYPE_CODE_COMPLEX
:
2966 printf_filtered ("(TYPE_CODE_COMPLEX)");
2968 case TYPE_CODE_TYPEDEF
:
2969 printf_filtered ("(TYPE_CODE_TYPEDEF)");
2971 case TYPE_CODE_TEMPLATE
:
2972 printf_filtered ("(TYPE_CODE_TEMPLATE)");
2974 case TYPE_CODE_TEMPLATE_ARG
:
2975 printf_filtered ("(TYPE_CODE_TEMPLATE_ARG)");
2978 printf_filtered ("(UNKNOWN TYPE CODE)");
2981 puts_filtered ("\n");
2982 printfi_filtered (spaces
, "length %d\n", TYPE_LENGTH (type
));
2983 printfi_filtered (spaces
, "upper_bound_type 0x%x ",
2984 TYPE_ARRAY_UPPER_BOUND_TYPE (type
));
2985 print_bound_type (TYPE_ARRAY_UPPER_BOUND_TYPE (type
));
2986 puts_filtered ("\n");
2987 printfi_filtered (spaces
, "lower_bound_type 0x%x ",
2988 TYPE_ARRAY_LOWER_BOUND_TYPE (type
));
2989 print_bound_type (TYPE_ARRAY_LOWER_BOUND_TYPE (type
));
2990 puts_filtered ("\n");
2991 printfi_filtered (spaces
, "objfile ");
2992 gdb_print_host_address (TYPE_OBJFILE (type
), gdb_stdout
);
2993 printf_filtered ("\n");
2994 printfi_filtered (spaces
, "target_type ");
2995 gdb_print_host_address (TYPE_TARGET_TYPE (type
), gdb_stdout
);
2996 printf_filtered ("\n");
2997 if (TYPE_TARGET_TYPE (type
) != NULL
)
2999 recursive_dump_type (TYPE_TARGET_TYPE (type
), spaces
+ 2);
3001 printfi_filtered (spaces
, "pointer_type ");
3002 gdb_print_host_address (TYPE_POINTER_TYPE (type
), gdb_stdout
);
3003 printf_filtered ("\n");
3004 printfi_filtered (spaces
, "reference_type ");
3005 gdb_print_host_address (TYPE_REFERENCE_TYPE (type
), gdb_stdout
);
3006 printf_filtered ("\n");
3007 printfi_filtered (spaces
, "cv_type ");
3008 gdb_print_host_address (TYPE_CV_TYPE (type
), gdb_stdout
);
3009 printf_filtered ("\n");
3010 printfi_filtered (spaces
, "as_type ");
3011 gdb_print_host_address (TYPE_AS_TYPE (type
), gdb_stdout
);
3012 printf_filtered ("\n");
3013 printfi_filtered (spaces
, "flags 0x%x", TYPE_FLAGS (type
));
3014 if (TYPE_UNSIGNED (type
))
3016 puts_filtered (" TYPE_FLAG_UNSIGNED");
3018 if (TYPE_NOSIGN (type
))
3020 puts_filtered (" TYPE_FLAG_NOSIGN");
3022 if (TYPE_STUB (type
))
3024 puts_filtered (" TYPE_FLAG_STUB");
3026 if (TYPE_TARGET_STUB (type
))
3028 puts_filtered (" TYPE_FLAG_TARGET_STUB");
3030 if (TYPE_STATIC (type
))
3032 puts_filtered (" TYPE_FLAG_STATIC");
3034 if (TYPE_CONST (type
))
3036 puts_filtered (" TYPE_FLAG_CONST");
3038 if (TYPE_VOLATILE (type
))
3040 puts_filtered (" TYPE_FLAG_VOLATILE");
3042 if (TYPE_PROTOTYPED (type
))
3044 puts_filtered (" TYPE_FLAG_PROTOTYPED");
3046 if (TYPE_INCOMPLETE (type
))
3048 puts_filtered (" TYPE_FLAG_INCOMPLETE");
3050 if (TYPE_CODE_SPACE (type
))
3052 puts_filtered (" TYPE_FLAG_CODE_SPACE");
3054 if (TYPE_DATA_SPACE (type
))
3056 puts_filtered (" TYPE_FLAG_DATA_SPACE");
3058 if (TYPE_VARARGS (type
))
3060 puts_filtered (" TYPE_FLAG_VARARGS");
3062 puts_filtered ("\n");
3063 printfi_filtered (spaces
, "nfields %d ", TYPE_NFIELDS (type
));
3064 gdb_print_host_address (TYPE_FIELDS (type
), gdb_stdout
);
3065 puts_filtered ("\n");
3066 for (idx
= 0; idx
< TYPE_NFIELDS (type
); idx
++)
3068 printfi_filtered (spaces
+ 2,
3069 "[%d] bitpos %d bitsize %d type ",
3070 idx
, TYPE_FIELD_BITPOS (type
, idx
),
3071 TYPE_FIELD_BITSIZE (type
, idx
));
3072 gdb_print_host_address (TYPE_FIELD_TYPE (type
, idx
), gdb_stdout
);
3073 printf_filtered (" name '%s' (",
3074 TYPE_FIELD_NAME (type
, idx
) != NULL
3075 ? TYPE_FIELD_NAME (type
, idx
)
3077 gdb_print_host_address (TYPE_FIELD_NAME (type
, idx
), gdb_stdout
);
3078 printf_filtered (")\n");
3079 if (TYPE_FIELD_TYPE (type
, idx
) != NULL
)
3081 recursive_dump_type (TYPE_FIELD_TYPE (type
, idx
), spaces
+ 4);
3084 printfi_filtered (spaces
, "vptr_basetype ");
3085 gdb_print_host_address (TYPE_VPTR_BASETYPE (type
), gdb_stdout
);
3086 puts_filtered ("\n");
3087 if (TYPE_VPTR_BASETYPE (type
) != NULL
)
3089 recursive_dump_type (TYPE_VPTR_BASETYPE (type
), spaces
+ 2);
3091 printfi_filtered (spaces
, "vptr_fieldno %d\n", TYPE_VPTR_FIELDNO (type
));
3092 switch (TYPE_CODE (type
))
3094 case TYPE_CODE_METHOD
:
3095 case TYPE_CODE_FUNC
:
3096 printfi_filtered (spaces
, "arg_types ");
3097 gdb_print_host_address (TYPE_ARG_TYPES (type
), gdb_stdout
);
3098 puts_filtered ("\n");
3099 print_arg_types (TYPE_ARG_TYPES (type
), spaces
);
3102 case TYPE_CODE_STRUCT
:
3103 printfi_filtered (spaces
, "cplus_stuff ");
3104 gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type
), gdb_stdout
);
3105 puts_filtered ("\n");
3106 print_cplus_stuff (type
, spaces
);
3110 printfi_filtered (spaces
, "floatformat ");
3111 if (TYPE_FLOATFORMAT (type
) == NULL
3112 || TYPE_FLOATFORMAT (type
)->name
== NULL
)
3113 puts_filtered ("(null)");
3115 puts_filtered (TYPE_FLOATFORMAT (type
)->name
);
3116 puts_filtered ("\n");
3120 /* We have to pick one of the union types to be able print and test
3121 the value. Pick cplus_struct_type, even though we know it isn't
3122 any particular one. */
3123 printfi_filtered (spaces
, "type_specific ");
3124 gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type
), gdb_stdout
);
3125 if (TYPE_CPLUS_SPECIFIC (type
) != NULL
)
3127 printf_filtered (" (unknown data form)");
3129 printf_filtered ("\n");
3134 obstack_free (&dont_print_type_obstack
, NULL
);
3137 static void build_gdbtypes (void);
3139 build_gdbtypes (void)
3142 init_type (TYPE_CODE_VOID
, 1,
3144 "void", (struct objfile
*) NULL
);
3146 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3148 | (TARGET_CHAR_SIGNED
? 0 : TYPE_FLAG_UNSIGNED
)),
3149 "char", (struct objfile
*) NULL
);
3150 builtin_type_true_char
=
3151 init_type (TYPE_CODE_CHAR
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3153 "true character", (struct objfile
*) NULL
);
3154 builtin_type_signed_char
=
3155 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3157 "signed char", (struct objfile
*) NULL
);
3158 builtin_type_unsigned_char
=
3159 init_type (TYPE_CODE_INT
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3161 "unsigned char", (struct objfile
*) NULL
);
3162 builtin_type_short
=
3163 init_type (TYPE_CODE_INT
, TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
3165 "short", (struct objfile
*) NULL
);
3166 builtin_type_unsigned_short
=
3167 init_type (TYPE_CODE_INT
, TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
3169 "unsigned short", (struct objfile
*) NULL
);
3171 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
3173 "int", (struct objfile
*) NULL
);
3174 builtin_type_unsigned_int
=
3175 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
3177 "unsigned int", (struct objfile
*) NULL
);
3179 init_type (TYPE_CODE_INT
, TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
3181 "long", (struct objfile
*) NULL
);
3182 builtin_type_unsigned_long
=
3183 init_type (TYPE_CODE_INT
, TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
3185 "unsigned long", (struct objfile
*) NULL
);
3186 builtin_type_long_long
=
3187 init_type (TYPE_CODE_INT
, TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
3189 "long long", (struct objfile
*) NULL
);
3190 builtin_type_unsigned_long_long
=
3191 init_type (TYPE_CODE_INT
, TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
3193 "unsigned long long", (struct objfile
*) NULL
);
3194 builtin_type_float
=
3195 init_type (TYPE_CODE_FLT
, TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
3197 "float", (struct objfile
*) NULL
);
3198 /* vinschen@redhat.com 2002-02-08:
3199 The below lines are disabled since they are doing the wrong
3200 thing for non-multiarch targets. They are setting the correct
3201 type of floats for the target but while on multiarch targets
3202 this is done everytime the architecture changes, it's done on
3203 non-multiarch targets only on startup, leaving the wrong values
3204 in even if the architecture changes (eg. from big-endian to
3207 TYPE_FLOATFORMAT (builtin_type_float
) = TARGET_FLOAT_FORMAT
;
3209 builtin_type_double
=
3210 init_type (TYPE_CODE_FLT
, TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
3212 "double", (struct objfile
*) NULL
);
3214 TYPE_FLOATFORMAT (builtin_type_double
) = TARGET_DOUBLE_FORMAT
;
3216 builtin_type_long_double
=
3217 init_type (TYPE_CODE_FLT
, TARGET_LONG_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
3219 "long double", (struct objfile
*) NULL
);
3221 TYPE_FLOATFORMAT (builtin_type_long_double
) = TARGET_LONG_DOUBLE_FORMAT
;
3223 builtin_type_complex
=
3224 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
3226 "complex", (struct objfile
*) NULL
);
3227 TYPE_TARGET_TYPE (builtin_type_complex
) = builtin_type_float
;
3228 builtin_type_double_complex
=
3229 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
3231 "double complex", (struct objfile
*) NULL
);
3232 TYPE_TARGET_TYPE (builtin_type_double_complex
) = builtin_type_double
;
3233 builtin_type_string
=
3234 init_type (TYPE_CODE_STRING
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3236 "string", (struct objfile
*) NULL
);
3238 init_type (TYPE_CODE_INT
, 8 / 8,
3240 "int8_t", (struct objfile
*) NULL
);
3241 builtin_type_uint8
=
3242 init_type (TYPE_CODE_INT
, 8 / 8,
3244 "uint8_t", (struct objfile
*) NULL
);
3245 builtin_type_int16
=
3246 init_type (TYPE_CODE_INT
, 16 / 8,
3248 "int16_t", (struct objfile
*) NULL
);
3249 builtin_type_uint16
=
3250 init_type (TYPE_CODE_INT
, 16 / 8,
3252 "uint16_t", (struct objfile
*) NULL
);
3253 builtin_type_int32
=
3254 init_type (TYPE_CODE_INT
, 32 / 8,
3256 "int32_t", (struct objfile
*) NULL
);
3257 builtin_type_uint32
=
3258 init_type (TYPE_CODE_INT
, 32 / 8,
3260 "uint32_t", (struct objfile
*) NULL
);
3261 builtin_type_int64
=
3262 init_type (TYPE_CODE_INT
, 64 / 8,
3264 "int64_t", (struct objfile
*) NULL
);
3265 builtin_type_uint64
=
3266 init_type (TYPE_CODE_INT
, 64 / 8,
3268 "uint64_t", (struct objfile
*) NULL
);
3269 builtin_type_int128
=
3270 init_type (TYPE_CODE_INT
, 128 / 8,
3272 "int128_t", (struct objfile
*) NULL
);
3273 builtin_type_uint128
=
3274 init_type (TYPE_CODE_INT
, 128 / 8,
3276 "uint128_t", (struct objfile
*) NULL
);
3278 init_type (TYPE_CODE_BOOL
, TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3280 "bool", (struct objfile
*) NULL
);
3282 /* Add user knob for controlling resolution of opaque types */
3284 (add_set_cmd ("opaque-type-resolution", class_support
, var_boolean
, (char *) &opaque_type_resolution
,
3285 "Set resolution of opaque struct/class/union types (if set before loading symbols).",
3288 opaque_type_resolution
= 1;
3290 /* Build SIMD types. */
3292 = init_simd_type ("__builtin_v4sf", builtin_type_float
, "f", 4);
3294 = init_simd_type ("__builtin_v4si", builtin_type_int32
, "f", 4);
3296 = init_simd_type ("__builtin_v16qi", builtin_type_int8
, "f", 16);
3298 = init_simd_type ("__builtin_v8qi", builtin_type_int8
, "f", 8);
3300 = init_simd_type ("__builtin_v8hi", builtin_type_int16
, "f", 8);
3302 = init_simd_type ("__builtin_v4hi", builtin_type_int16
, "f", 4);
3304 = init_simd_type ("__builtin_v2si", builtin_type_int32
, "f", 2);
3308 = build_builtin_type_vec128 ();
3310 /* Pointer/Address types. */
3312 /* NOTE: on some targets, addresses and pointers are not necessarily
3313 the same --- for example, on the D10V, pointers are 16 bits long,
3314 but addresses are 32 bits long. See doc/gdbint.texinfo,
3315 ``Pointers Are Not Always Addresses''.
3318 - gdb's `struct type' always describes the target's
3320 - gdb's `struct value' objects should always hold values in
3322 - gdb's CORE_ADDR values are addresses in the unified virtual
3323 address space that the assembler and linker work with. Thus,
3324 since target_read_memory takes a CORE_ADDR as an argument, it
3325 can access any memory on the target, even if the processor has
3326 separate code and data address spaces.
3329 - If v is a value holding a D10V code pointer, its contents are
3330 in target form: a big-endian address left-shifted two bits.
3331 - If p is a D10V pointer type, TYPE_LENGTH (p) == 2, just as
3332 sizeof (void *) == 2 on the target.
3334 In this context, builtin_type_CORE_ADDR is a bit odd: it's a
3335 target type for a value the target will never see. It's only
3336 used to hold the values of (typeless) linker symbols, which are
3337 indeed in the unified virtual address space. */
3338 builtin_type_void_data_ptr
= make_pointer_type (builtin_type_void
, NULL
);
3339 builtin_type_void_func_ptr
3340 = lookup_pointer_type (lookup_function_type (builtin_type_void
));
3341 builtin_type_CORE_ADDR
=
3342 init_type (TYPE_CODE_INT
, TARGET_ADDR_BIT
/ 8,
3344 "__CORE_ADDR", (struct objfile
*) NULL
);
3345 builtin_type_bfd_vma
=
3346 init_type (TYPE_CODE_INT
, TARGET_BFD_VMA_BIT
/ 8,
3348 "__bfd_vma", (struct objfile
*) NULL
);
3352 extern void _initialize_gdbtypes (void);
3354 _initialize_gdbtypes (void)
3356 struct cmd_list_element
*c
;
3359 /* FIXME - For the moment, handle types by swapping them in and out.
3360 Should be using the per-architecture data-pointer and a large
3362 register_gdbarch_swap (&builtin_type_void
, sizeof (struct type
*), NULL
);
3363 register_gdbarch_swap (&builtin_type_char
, sizeof (struct type
*), NULL
);
3364 register_gdbarch_swap (&builtin_type_short
, sizeof (struct type
*), NULL
);
3365 register_gdbarch_swap (&builtin_type_int
, sizeof (struct type
*), NULL
);
3366 register_gdbarch_swap (&builtin_type_long
, sizeof (struct type
*), NULL
);
3367 register_gdbarch_swap (&builtin_type_long_long
, sizeof (struct type
*), NULL
);
3368 register_gdbarch_swap (&builtin_type_signed_char
, sizeof (struct type
*), NULL
);
3369 register_gdbarch_swap (&builtin_type_unsigned_char
, sizeof (struct type
*), NULL
);
3370 register_gdbarch_swap (&builtin_type_unsigned_short
, sizeof (struct type
*), NULL
);
3371 register_gdbarch_swap (&builtin_type_unsigned_int
, sizeof (struct type
*), NULL
);
3372 register_gdbarch_swap (&builtin_type_unsigned_long
, sizeof (struct type
*), NULL
);
3373 register_gdbarch_swap (&builtin_type_unsigned_long_long
, sizeof (struct type
*), NULL
);
3374 register_gdbarch_swap (&builtin_type_float
, sizeof (struct type
*), NULL
);
3375 register_gdbarch_swap (&builtin_type_double
, sizeof (struct type
*), NULL
);
3376 register_gdbarch_swap (&builtin_type_long_double
, sizeof (struct type
*), NULL
);
3377 register_gdbarch_swap (&builtin_type_complex
, sizeof (struct type
*), NULL
);
3378 register_gdbarch_swap (&builtin_type_double_complex
, sizeof (struct type
*), NULL
);
3379 register_gdbarch_swap (&builtin_type_string
, sizeof (struct type
*), NULL
);
3380 register_gdbarch_swap (&builtin_type_int8
, sizeof (struct type
*), NULL
);
3381 register_gdbarch_swap (&builtin_type_uint8
, sizeof (struct type
*), NULL
);
3382 register_gdbarch_swap (&builtin_type_int16
, sizeof (struct type
*), NULL
);
3383 register_gdbarch_swap (&builtin_type_uint16
, sizeof (struct type
*), NULL
);
3384 register_gdbarch_swap (&builtin_type_int32
, sizeof (struct type
*), NULL
);
3385 register_gdbarch_swap (&builtin_type_uint32
, sizeof (struct type
*), NULL
);
3386 register_gdbarch_swap (&builtin_type_int64
, sizeof (struct type
*), NULL
);
3387 register_gdbarch_swap (&builtin_type_uint64
, sizeof (struct type
*), NULL
);
3388 register_gdbarch_swap (&builtin_type_int128
, sizeof (struct type
*), NULL
);
3389 register_gdbarch_swap (&builtin_type_uint128
, sizeof (struct type
*), NULL
);
3390 register_gdbarch_swap (&builtin_type_v4sf
, sizeof (struct type
*), NULL
);
3391 register_gdbarch_swap (&builtin_type_v4si
, sizeof (struct type
*), NULL
);
3392 register_gdbarch_swap (&builtin_type_v16qi
, sizeof (struct type
*), NULL
);
3393 register_gdbarch_swap (&builtin_type_v8qi
, sizeof (struct type
*), NULL
);
3394 register_gdbarch_swap (&builtin_type_v8hi
, sizeof (struct type
*), NULL
);
3395 register_gdbarch_swap (&builtin_type_v4hi
, sizeof (struct type
*), NULL
);
3396 register_gdbarch_swap (&builtin_type_v2si
, sizeof (struct type
*), NULL
);
3397 register_gdbarch_swap (&builtin_type_vec128
, sizeof (struct type
*), NULL
);
3398 REGISTER_GDBARCH_SWAP (builtin_type_void_data_ptr
);
3399 REGISTER_GDBARCH_SWAP (builtin_type_void_func_ptr
);
3400 REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR
);
3401 REGISTER_GDBARCH_SWAP (builtin_type_bfd_vma
);
3402 register_gdbarch_swap (NULL
, 0, build_gdbtypes
);
3404 /* Note: These types do not need to be swapped - they are target
3406 builtin_type_ieee_single_big
=
3407 init_type (TYPE_CODE_FLT
, floatformat_ieee_single_big
.totalsize
/ 8,
3408 0, "builtin_type_ieee_single_big", NULL
);
3409 TYPE_FLOATFORMAT (builtin_type_ieee_single_big
) = &floatformat_ieee_single_big
;
3410 builtin_type_ieee_single_little
=
3411 init_type (TYPE_CODE_FLT
, floatformat_ieee_single_little
.totalsize
/ 8,
3412 0, "builtin_type_ieee_single_little", NULL
);
3413 TYPE_FLOATFORMAT (builtin_type_ieee_single_little
) = &floatformat_ieee_single_little
;
3414 builtin_type_ieee_double_big
=
3415 init_type (TYPE_CODE_FLT
, floatformat_ieee_double_big
.totalsize
/ 8,
3416 0, "builtin_type_ieee_double_big", NULL
);
3417 TYPE_FLOATFORMAT (builtin_type_ieee_double_big
) = &floatformat_ieee_double_big
;
3418 builtin_type_ieee_double_little
=
3419 init_type (TYPE_CODE_FLT
, floatformat_ieee_double_little
.totalsize
/ 8,
3420 0, "builtin_type_ieee_double_little", NULL
);
3421 TYPE_FLOATFORMAT (builtin_type_ieee_double_little
) = &floatformat_ieee_double_little
;
3422 builtin_type_ieee_double_littlebyte_bigword
=
3423 init_type (TYPE_CODE_FLT
, floatformat_ieee_double_littlebyte_bigword
.totalsize
/ 8,
3424 0, "builtin_type_ieee_double_littlebyte_bigword", NULL
);
3425 TYPE_FLOATFORMAT (builtin_type_ieee_double_littlebyte_bigword
) = &floatformat_ieee_double_littlebyte_bigword
;
3426 builtin_type_i387_ext
=
3427 init_type (TYPE_CODE_FLT
, floatformat_i387_ext
.totalsize
/ 8,
3428 0, "builtin_type_i387_ext", NULL
);
3429 TYPE_FLOATFORMAT (builtin_type_i387_ext
) = &floatformat_i387_ext
;
3430 builtin_type_m68881_ext
=
3431 init_type (TYPE_CODE_FLT
, floatformat_m68881_ext
.totalsize
/ 8,
3432 0, "builtin_type_m68881_ext", NULL
);
3433 TYPE_FLOATFORMAT (builtin_type_m68881_ext
) = &floatformat_m68881_ext
;
3434 builtin_type_i960_ext
=
3435 init_type (TYPE_CODE_FLT
, floatformat_i960_ext
.totalsize
/ 8,
3436 0, "builtin_type_i960_ext", NULL
);
3437 TYPE_FLOATFORMAT (builtin_type_i960_ext
) = &floatformat_i960_ext
;
3438 builtin_type_m88110_ext
=
3439 init_type (TYPE_CODE_FLT
, floatformat_m88110_ext
.totalsize
/ 8,
3440 0, "builtin_type_m88110_ext", NULL
);
3441 TYPE_FLOATFORMAT (builtin_type_m88110_ext
) = &floatformat_m88110_ext
;
3442 builtin_type_m88110_harris_ext
=
3443 init_type (TYPE_CODE_FLT
, floatformat_m88110_harris_ext
.totalsize
/ 8,
3444 0, "builtin_type_m88110_harris_ext", NULL
);
3445 TYPE_FLOATFORMAT (builtin_type_m88110_harris_ext
) = &floatformat_m88110_harris_ext
;
3446 builtin_type_arm_ext_big
=
3447 init_type (TYPE_CODE_FLT
, floatformat_arm_ext_big
.totalsize
/ 8,
3448 0, "builtin_type_arm_ext_big", NULL
);
3449 TYPE_FLOATFORMAT (builtin_type_arm_ext_big
) = &floatformat_arm_ext_big
;
3450 builtin_type_arm_ext_littlebyte_bigword
=
3451 init_type (TYPE_CODE_FLT
, floatformat_arm_ext_littlebyte_bigword
.totalsize
/ 8,
3452 0, "builtin_type_arm_ext_littlebyte_bigword", NULL
);
3453 TYPE_FLOATFORMAT (builtin_type_arm_ext_littlebyte_bigword
) = &floatformat_arm_ext_littlebyte_bigword
;
3454 builtin_type_ia64_spill_big
=
3455 init_type (TYPE_CODE_FLT
, floatformat_ia64_spill_big
.totalsize
/ 8,
3456 0, "builtin_type_ia64_spill_big", NULL
);
3457 TYPE_FLOATFORMAT (builtin_type_ia64_spill_big
) = &floatformat_ia64_spill_big
;
3458 builtin_type_ia64_spill_little
=
3459 init_type (TYPE_CODE_FLT
, floatformat_ia64_spill_little
.totalsize
/ 8,
3460 0, "builtin_type_ia64_spill_little", NULL
);
3461 TYPE_FLOATFORMAT (builtin_type_ia64_spill_little
) = &floatformat_ia64_spill_little
;
3462 builtin_type_ia64_quad_big
=
3463 init_type (TYPE_CODE_FLT
, floatformat_ia64_quad_big
.totalsize
/ 8,
3464 0, "builtin_type_ia64_quad_big", NULL
);
3465 TYPE_FLOATFORMAT (builtin_type_ia64_quad_big
) = &floatformat_ia64_quad_big
;
3466 builtin_type_ia64_quad_little
=
3467 init_type (TYPE_CODE_FLT
, floatformat_ia64_quad_little
.totalsize
/ 8,
3468 0, "builtin_type_ia64_quad_little", NULL
);
3469 TYPE_FLOATFORMAT (builtin_type_ia64_quad_little
) = &floatformat_ia64_quad_little
;
3472 add_set_cmd ("overload", no_class
, var_zinteger
, (char *) &overload_debug
,
3473 "Set debugging of C++ overloading.\n\
3474 When enabled, ranking of the functions\n\
3475 is displayed.", &setdebuglist
),