2 /* Internal type definitions for GDB.
4 Copyright (C) 1992-2023 Free Software Foundation, Inc.
6 Contributed by Cygnus Support, using pieces from other GDB modules.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #if !defined (GDBTYPES_H)
26 /* * \page gdbtypes GDB Types
28 GDB represents all the different kinds of types in programming
29 languages using a common representation defined in gdbtypes.h.
31 The main data structure is main_type; it consists of a code (such
32 as #TYPE_CODE_ENUM for enumeration types), a number of
33 generally-useful fields such as the printable name, and finally a
34 field main_type::type_specific that is a union of info specific to
35 particular languages or other special cases (such as calling
38 The available type codes are defined in enum #type_code. The enum
39 includes codes both for types that are common across a variety
40 of languages, and for types that are language-specific.
42 Most accesses to type fields go through macros such as
43 #TYPE_CODE(thistype) and #TYPE_FN_FIELD_CONST(thisfn, n). These are
44 written such that they can be used as both rvalues and lvalues.
48 #include "gdbsupport/array-view.h"
49 #include "gdbsupport/gdb-hashtab.h"
51 #include "gdbsupport/offset-type.h"
52 #include "gdbsupport/enum-flags.h"
53 #include "gdbsupport/underlying.h"
54 #include "gdbsupport/print-utils.h"
55 #include "gdbsupport/function-view.h"
57 #include "gdbsupport/gdb_obstack.h"
58 #include "gmp-utils.h"
60 /* Forward declarations for prototypes. */
63 struct value_print_options
;
65 struct dwarf2_per_cu_data
;
66 struct dwarf2_per_objfile
;
67 struct dwarf2_property_baton
;
69 /* * Different kinds of data types are distinguished by the `code'
74 TYPE_CODE_UNDEF
= 0, /**< Not used; catches errors */
77 #include "type-codes.def"
82 /* * Some bits for the type's instance_flags word. See the macros
83 below for documentation on each bit. */
85 enum type_instance_flag_value
: unsigned
87 TYPE_INSTANCE_FLAG_CONST
= (1 << 0),
88 TYPE_INSTANCE_FLAG_VOLATILE
= (1 << 1),
89 TYPE_INSTANCE_FLAG_CODE_SPACE
= (1 << 2),
90 TYPE_INSTANCE_FLAG_DATA_SPACE
= (1 << 3),
91 TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
= (1 << 4),
92 TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2
= (1 << 5),
93 TYPE_INSTANCE_FLAG_NOTTEXT
= (1 << 6),
94 TYPE_INSTANCE_FLAG_RESTRICT
= (1 << 7),
95 TYPE_INSTANCE_FLAG_ATOMIC
= (1 << 8)
98 DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value
, type_instance_flags
);
100 /* * Not textual. By default, GDB treats all single byte integers as
101 characters (or elements of strings) unless this flag is set. */
103 #define TYPE_NOTTEXT(t) (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_NOTTEXT)
105 /* * Constant type. If this is set, the corresponding type has a
108 #define TYPE_CONST(t) ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CONST) != 0)
110 /* * Volatile type. If this is set, the corresponding type has a
111 volatile modifier. */
113 #define TYPE_VOLATILE(t) \
114 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_VOLATILE) != 0)
116 /* * Restrict type. If this is set, the corresponding type has a
117 restrict modifier. */
119 #define TYPE_RESTRICT(t) \
120 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_RESTRICT) != 0)
122 /* * Atomic type. If this is set, the corresponding type has an
125 #define TYPE_ATOMIC(t) \
126 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_ATOMIC) != 0)
128 /* * True if this type represents either an lvalue or lvalue reference type. */
130 #define TYPE_IS_REFERENCE(t) \
131 ((t)->code () == TYPE_CODE_REF || (t)->code () == TYPE_CODE_RVALUE_REF)
133 /* * True if this type is allocatable. */
134 #define TYPE_IS_ALLOCATABLE(t) \
135 ((t)->dyn_prop (DYN_PROP_ALLOCATED) != NULL)
137 /* * True if this type has variant parts. */
138 #define TYPE_HAS_VARIANT_PARTS(t) \
139 ((t)->dyn_prop (DYN_PROP_VARIANT_PARTS) != nullptr)
141 /* * True if this type has a dynamic length. */
142 #define TYPE_HAS_DYNAMIC_LENGTH(t) \
143 ((t)->dyn_prop (DYN_PROP_BYTE_SIZE) != nullptr)
145 /* * Instruction-space delimited type. This is for Harvard architectures
146 which have separate instruction and data address spaces (and perhaps
149 GDB usually defines a flat address space that is a superset of the
150 architecture's two (or more) address spaces, but this is an extension
151 of the architecture's model.
153 If TYPE_INSTANCE_FLAG_CODE_SPACE is set, an object of the corresponding type
154 resides in instruction memory, even if its address (in the extended
155 flat address space) does not reflect this.
157 Similarly, if TYPE_INSTANCE_FLAG_DATA_SPACE is set, then an object of the
158 corresponding type resides in the data memory space, even if
159 this is not indicated by its (flat address space) address.
161 If neither flag is set, the default space for functions / methods
162 is instruction space, and for data objects is data memory. */
164 #define TYPE_CODE_SPACE(t) \
165 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CODE_SPACE) != 0)
167 #define TYPE_DATA_SPACE(t) \
168 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_DATA_SPACE) != 0)
170 /* * Address class flags. Some environments provide for pointers
171 whose size is different from that of a normal pointer or address
172 types where the bits are interpreted differently than normal
173 addresses. The TYPE_INSTANCE_FLAG_ADDRESS_CLASS_n flags may be used in
174 target specific ways to represent these different types of address
177 #define TYPE_ADDRESS_CLASS_1(t) (((t)->instance_flags ()) \
178 & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
179 #define TYPE_ADDRESS_CLASS_2(t) (((t)->instance_flags ()) \
180 & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
181 #define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL \
182 (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
183 #define TYPE_ADDRESS_CLASS_ALL(t) (((t)->instance_flags ()) \
184 & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
186 /* * Information about a single discriminant. */
188 struct discriminant_range
190 /* * The range of values for the variant. This is an inclusive
194 /* * Return true if VALUE is contained in this range. IS_UNSIGNED
195 is true if this should be an unsigned comparison; false for
197 bool contains (ULONGEST value
, bool is_unsigned
) const
200 return value
>= low
&& value
<= high
;
201 LONGEST valuel
= (LONGEST
) value
;
202 return valuel
>= (LONGEST
) low
&& valuel
<= (LONGEST
) high
;
208 /* * A single variant. A variant has a list of discriminant values.
209 When the discriminator matches one of these, the variant is
210 enabled. Each variant controls zero or more fields; and may also
211 control other variant parts as well. This struct corresponds to
212 DW_TAG_variant in DWARF. */
214 struct variant
: allocate_on_obstack
216 /* * The discriminant ranges for this variant. */
217 gdb::array_view
<discriminant_range
> discriminants
;
219 /* * The fields controlled by this variant. This is inclusive on
220 the low end and exclusive on the high end. A variant may not
221 control any fields, in which case the two values will be equal.
222 These are indexes into the type's array of fields. */
226 /* * Variant parts controlled by this variant. */
227 gdb::array_view
<variant_part
> parts
;
229 /* * Return true if this is the default variant. The default
230 variant can be recognized because it has no associated
232 bool is_default () const
234 return discriminants
.empty ();
237 /* * Return true if this variant matches VALUE. IS_UNSIGNED is true
238 if this should be an unsigned comparison; false for signed. */
239 bool matches (ULONGEST value
, bool is_unsigned
) const;
242 /* * A variant part. Each variant part has an optional discriminant
243 and holds an array of variants. This struct corresponds to
244 DW_TAG_variant_part in DWARF. */
246 struct variant_part
: allocate_on_obstack
248 /* * The index of the discriminant field in the outer type. This is
249 an index into the type's array of fields. If this is -1, there
250 is no discriminant, and only the default variant can be
251 considered to be selected. */
252 int discriminant_index
;
254 /* * True if this discriminant is unsigned; false if signed. This
255 comes from the type of the discriminant. */
258 /* * The variants that are controlled by this variant part. Note
259 that these will always be sorted by field number. */
260 gdb::array_view
<variant
> variants
;
264 enum dynamic_prop_kind
266 PROP_UNDEFINED
, /* Not defined. */
267 PROP_CONST
, /* Constant. */
268 PROP_ADDR_OFFSET
, /* Address offset. */
269 PROP_LOCEXPR
, /* Location expression. */
270 PROP_LOCLIST
, /* Location list. */
271 PROP_VARIANT_PARTS
, /* Variant parts. */
272 PROP_TYPE
, /* Type. */
273 PROP_VARIABLE_NAME
, /* Variable name. */
276 union dynamic_prop_data
278 /* Storage for constant property. */
282 /* Storage for dynamic property. */
284 const dwarf2_property_baton
*baton
;
286 /* Storage of variant parts for a type. A type with variant parts
287 has all its fields "linearized" -- stored in a single field
288 array, just as if they had all been declared that way. The
289 variant parts are attached via a dynamic property, and then are
290 used to control which fields end up in the final type during
291 dynamic type resolution. */
293 const gdb::array_view
<variant_part
> *variant_parts
;
295 /* Once a variant type is resolved, we may want to be able to go
296 from the resolved type to the original type. In this case we
297 rewrite the property's kind and set this field. */
299 struct type
*original_type
;
301 /* Name of a variable to look up; the variable holds the value of
304 const char *variable_name
;
307 /* * Used to store a dynamic property. */
311 dynamic_prop_kind
kind () const
316 void set_undefined ()
318 m_kind
= PROP_UNDEFINED
;
321 LONGEST
const_val () const
323 gdb_assert (m_kind
== PROP_CONST
);
325 return m_data
.const_val
;
328 void set_const_val (LONGEST const_val
)
331 m_data
.const_val
= const_val
;
334 /* Return true if this property has a constant value, false
336 bool is_constant () const
337 { return m_kind
== PROP_CONST
; }
339 const dwarf2_property_baton
*baton () const
341 gdb_assert (m_kind
== PROP_LOCEXPR
342 || m_kind
== PROP_LOCLIST
343 || m_kind
== PROP_ADDR_OFFSET
);
348 void set_locexpr (const dwarf2_property_baton
*baton
)
350 m_kind
= PROP_LOCEXPR
;
351 m_data
.baton
= baton
;
354 void set_loclist (const dwarf2_property_baton
*baton
)
356 m_kind
= PROP_LOCLIST
;
357 m_data
.baton
= baton
;
360 void set_addr_offset (const dwarf2_property_baton
*baton
)
362 m_kind
= PROP_ADDR_OFFSET
;
363 m_data
.baton
= baton
;
366 const gdb::array_view
<variant_part
> *variant_parts () const
368 gdb_assert (m_kind
== PROP_VARIANT_PARTS
);
370 return m_data
.variant_parts
;
373 void set_variant_parts (gdb::array_view
<variant_part
> *variant_parts
)
375 m_kind
= PROP_VARIANT_PARTS
;
376 m_data
.variant_parts
= variant_parts
;
379 struct type
*original_type () const
381 gdb_assert (m_kind
== PROP_TYPE
);
383 return m_data
.original_type
;
386 void set_original_type (struct type
*original_type
)
389 m_data
.original_type
= original_type
;
392 /* Return the name of the variable that holds this property's value.
393 Only valid for PROP_VARIABLE_NAME. */
394 const char *variable_name () const
396 gdb_assert (m_kind
== PROP_VARIABLE_NAME
);
397 return m_data
.variable_name
;
400 /* Set the name of the variable that holds this property's value,
401 and set this property to be of kind PROP_VARIABLE_NAME. */
402 void set_variable_name (const char *name
)
404 m_kind
= PROP_VARIABLE_NAME
;
405 m_data
.variable_name
= name
;
408 /* Determine which field of the union dynamic_prop.data is used. */
409 enum dynamic_prop_kind m_kind
;
411 /* Storage for dynamic or static value. */
412 union dynamic_prop_data m_data
;
415 /* Compare two dynamic_prop objects for equality. dynamic_prop
416 instances are equal iff they have the same type and storage. */
417 extern bool operator== (const dynamic_prop
&l
, const dynamic_prop
&r
);
419 /* Compare two dynamic_prop objects for inequality. */
420 static inline bool operator!= (const dynamic_prop
&l
, const dynamic_prop
&r
)
425 /* * Define a type's dynamic property node kind. */
426 enum dynamic_prop_node_kind
428 /* A property providing a type's data location.
429 Evaluating this field yields to the location of an object's data. */
430 DYN_PROP_DATA_LOCATION
,
432 /* A property representing DW_AT_allocated. The presence of this attribute
433 indicates that the object of the type can be allocated/deallocated. */
436 /* A property representing DW_AT_associated. The presence of this attribute
437 indicated that the object of the type can be associated. */
440 /* A property providing an array's byte stride. */
441 DYN_PROP_BYTE_STRIDE
,
443 /* A property holding variant parts. */
444 DYN_PROP_VARIANT_PARTS
,
446 /* A property representing DW_AT_rank. The presence of this attribute
447 indicates that the object is of assumed rank array type. */
450 /* A property holding the size of the type. */
454 /* * List for dynamic type attributes. */
455 struct dynamic_prop_list
457 /* The kind of dynamic prop in this node. */
458 enum dynamic_prop_node_kind prop_kind
;
460 /* The dynamic property itself. */
461 struct dynamic_prop prop
;
463 /* A pointer to the next dynamic property. */
464 struct dynamic_prop_list
*next
;
467 /* * Determine which field of the union main_type.fields[x].loc is
472 FIELD_LOC_KIND_BITPOS
, /**< bitpos */
473 FIELD_LOC_KIND_ENUMVAL
, /**< enumval */
474 FIELD_LOC_KIND_PHYSADDR
, /**< physaddr */
475 FIELD_LOC_KIND_PHYSNAME
, /**< physname */
476 FIELD_LOC_KIND_DWARF_BLOCK
/**< dwarf_block */
479 /* * A discriminant to determine which field in the
480 main_type.type_specific union is being used, if any.
482 For types such as TYPE_CODE_FLT, the use of this
483 discriminant is really redundant, as we know from the type code
484 which field is going to be used. As such, it would be possible to
485 reduce the size of this enum in order to save a bit or two for
486 other fields of struct main_type. But, since we still have extra
487 room , and for the sake of clarity and consistency, we treat all fields
488 of the union the same way. */
490 enum type_specific_kind
493 TYPE_SPECIFIC_CPLUS_STUFF
,
494 TYPE_SPECIFIC_GNAT_STUFF
,
495 TYPE_SPECIFIC_FLOATFORMAT
,
496 /* Note: This is used by TYPE_CODE_FUNC and TYPE_CODE_METHOD. */
498 TYPE_SPECIFIC_SELF_TYPE
,
500 TYPE_SPECIFIC_FIXED_POINT
,
505 struct objfile
*objfile
;
506 struct gdbarch
*gdbarch
;
511 /* * Position of this field, counting in bits from start of
512 containing structure. For big-endian targets, it is the bit
513 offset to the MSB. For little-endian targets, it is the bit
514 offset to the LSB. */
521 /* * For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then
522 physaddr is the location (in the target) of the static
523 field. Otherwise, physname is the mangled label of the
527 const char *physname
;
529 /* * The field location can be computed by evaluating the
530 following DWARF block. Its DATA is allocated on
531 objfile_obstack - no CU load is needed to access it. */
533 struct dwarf2_locexpr_baton
*dwarf_block
;
536 /* Accessibility of a member. */
537 enum class accessibility
: unsigned char
539 /* It's important that this be 0 so that fields default to
548 struct type
*type () const
553 void set_type (struct type
*type
)
558 const char *name () const
563 void set_name (const char *name
)
568 bool is_artificial () const
573 void set_is_artificial (bool is_artificial
)
575 m_artificial
= is_artificial
;
578 unsigned int bitsize () const
583 void set_bitsize (unsigned int bitsize
)
588 bool is_packed () const
590 return m_bitsize
!= 0;
593 /* Return true if this field is static; false if not. */
594 bool is_static () const
596 /* "static" fields are the fields whose location is not relative
597 to the address of the enclosing struct. It would be nice to
598 have a dedicated flag that would be set for static fields when
599 the type is being created. But in practice, checking the field
600 loc_kind should give us an accurate answer. */
601 return (m_loc_kind
== FIELD_LOC_KIND_PHYSNAME
602 || m_loc_kind
== FIELD_LOC_KIND_PHYSADDR
);
605 /* Location getters / setters. */
607 field_loc_kind
loc_kind () const
612 LONGEST
loc_bitpos () const
614 gdb_assert (m_loc_kind
== FIELD_LOC_KIND_BITPOS
);
618 void set_loc_bitpos (LONGEST bitpos
)
620 m_loc_kind
= FIELD_LOC_KIND_BITPOS
;
621 m_loc
.bitpos
= bitpos
;
624 LONGEST
loc_enumval () const
626 gdb_assert (m_loc_kind
== FIELD_LOC_KIND_ENUMVAL
);
627 return m_loc
.enumval
;
630 void set_loc_enumval (LONGEST enumval
)
632 m_loc_kind
= FIELD_LOC_KIND_ENUMVAL
;
633 m_loc
.enumval
= enumval
;
636 CORE_ADDR
loc_physaddr () const
638 gdb_assert (m_loc_kind
== FIELD_LOC_KIND_PHYSADDR
);
639 return m_loc
.physaddr
;
642 void set_loc_physaddr (CORE_ADDR physaddr
)
644 m_loc_kind
= FIELD_LOC_KIND_PHYSADDR
;
645 m_loc
.physaddr
= physaddr
;
648 const char *loc_physname () const
650 gdb_assert (m_loc_kind
== FIELD_LOC_KIND_PHYSNAME
);
651 return m_loc
.physname
;
654 void set_loc_physname (const char *physname
)
656 m_loc_kind
= FIELD_LOC_KIND_PHYSNAME
;
657 m_loc
.physname
= physname
;
660 dwarf2_locexpr_baton
*loc_dwarf_block () const
662 gdb_assert (m_loc_kind
== FIELD_LOC_KIND_DWARF_BLOCK
);
663 return m_loc
.dwarf_block
;
666 void set_loc_dwarf_block (dwarf2_locexpr_baton
*dwarf_block
)
668 m_loc_kind
= FIELD_LOC_KIND_DWARF_BLOCK
;
669 m_loc
.dwarf_block
= dwarf_block
;
672 /* Set the field's accessibility. */
673 void set_accessibility (accessibility acc
)
674 { m_accessibility
= acc
; }
676 /* Fetch the field's accessibility. */
677 enum accessibility
accessibility () const
678 { return m_accessibility
; }
680 /* True if this field is 'public'. */
681 bool is_public () const
682 { return m_accessibility
== accessibility::PUBLIC
; }
684 /* True if this field is 'private'. */
685 bool is_private () const
686 { return m_accessibility
== accessibility::PRIVATE
; }
688 /* True if this field is 'protected'. */
689 bool is_protected () const
690 { return m_accessibility
== accessibility::PROTECTED
; }
692 /* True if this field is 'virtual'. */
693 bool is_virtual () const
694 { return m_virtual
; }
696 /* Set the field's "virtual" flag. */
698 { m_virtual
= true; }
700 /* True if this field is 'ignored'. */
701 bool is_ignored () const
702 { return m_ignored
; }
704 /* Set the field's "ignored" flag. Note that the 'ignored' bit is
705 deprecated. It was used by some unknown stabs generator, and has
706 been replaced by the optimized-out approach -- however, it
707 remains because the stabs reader was never updated. */
709 { m_ignored
= true; }
711 union field_location m_loc
;
713 /* * For a function or member type, this is 1 if the argument is
714 marked artificial. Artificial arguments should not be shown
715 to the user. For TYPE_CODE_RANGE it is set if the specific
716 bound is not defined. */
718 unsigned int m_artificial
: 1;
720 /* Whether the field is 'virtual'. */
722 /* Whether the field is 'ignored'. */
725 /* * Discriminant for union field_location. */
727 ENUM_BITFIELD(field_loc_kind
) m_loc_kind
: 3;
729 /* Accessibility of the field. */
730 enum accessibility m_accessibility
;
732 /* * Size of this field, in bits, or zero if not packed.
733 If non-zero in an array type, indicates the element size in
734 bits (used only in Ada at the moment).
735 For an unpacked field, the field's type's length
736 says how many bytes the field occupies. */
738 unsigned int m_bitsize
;
740 /* * In a struct or union type, type of this field.
741 - In a function or member type, type of this argument.
742 - In an array type, the domain-type of the array. */
746 /* * Name of field, value or argument.
747 NULL for range bounds, array domains, and member function
755 ULONGEST
bit_stride () const
757 if (this->flag_is_byte_stride
)
758 return this->stride
.const_val () * 8;
760 return this->stride
.const_val ();
763 /* * Low bound of range. */
765 struct dynamic_prop low
;
767 /* * High bound of range. */
769 struct dynamic_prop high
;
771 /* The stride value for this range. This can be stored in bits or bytes
772 based on the value of BYTE_STRIDE_P. It is optional to have a stride
773 value, if this range has no stride value defined then this will be set
774 to the constant zero. */
776 struct dynamic_prop stride
;
778 /* * The bias. Sometimes a range value is biased before storage.
779 The bias is added to the stored bits to form the true value. */
783 /* True if HIGH range bound contains the number of elements in the
784 subrange. This affects how the final high bound is computed. */
786 unsigned int flag_upper_bound_is_count
: 1;
788 /* True if LOW or/and HIGH are resolved into a static bound from
791 unsigned int flag_bound_evaluated
: 1;
793 /* If this is true this STRIDE is in bytes, otherwise STRIDE is in bits. */
795 unsigned int flag_is_byte_stride
: 1;
798 /* Compare two range_bounds objects for equality. Simply does
799 memberwise comparison. */
800 extern bool operator== (const range_bounds
&l
, const range_bounds
&r
);
802 /* Compare two range_bounds objects for inequality. */
803 static inline bool operator!= (const range_bounds
&l
, const range_bounds
&r
)
810 /* * CPLUS_STUFF is for TYPE_CODE_STRUCT. It is initialized to
811 point to cplus_struct_default, a default static instance of a
812 struct cplus_struct_type. */
814 struct cplus_struct_type
*cplus_stuff
;
816 /* * GNAT_STUFF is for types for which the GNAT Ada compiler
817 provides additional information. */
819 struct gnat_aux_type
*gnat_stuff
;
821 /* * FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to a
822 floatformat object that describes the floating-point value
823 that resides within the type. */
825 const struct floatformat
*floatformat
;
827 /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types. */
829 struct func_type
*func_stuff
;
831 /* * For types that are pointer to member types (TYPE_CODE_METHODPTR,
832 TYPE_CODE_MEMBERPTR), SELF_TYPE is the type that this pointer
835 struct type
*self_type
;
837 /* * For TYPE_CODE_FIXED_POINT types, the info necessary to decode
838 values of that type. */
839 struct fixed_point_type_info
*fixed_point_info
;
841 /* * An integer-like scalar type may be stored in just part of its
842 enclosing storage bytes. This structure describes this
846 /* * The bit size of the integer. This can be 0. For integers
847 that fill their storage (the ordinary case), this field holds
848 the byte size times 8. */
849 unsigned short bit_size
;
850 /* * The bit offset of the integer. This is ordinarily 0, and can
851 only be non-zero if the bit size is less than the storage
853 unsigned short bit_offset
;
857 /* * Main structure representing a type in GDB.
859 This structure is space-critical. Its layout has been tweaked to
860 reduce the space used. */
864 /* * Code for kind of type. */
866 ENUM_BITFIELD(type_code
) code
: 8;
868 /* * Flags about this type. These fields appear at this location
869 because they packs nicely here. See the TYPE_* macros for
870 documentation about these fields. */
872 unsigned int m_flag_unsigned
: 1;
873 unsigned int m_flag_nosign
: 1;
874 unsigned int m_flag_stub
: 1;
875 unsigned int m_flag_target_stub
: 1;
876 unsigned int m_flag_prototyped
: 1;
877 unsigned int m_flag_varargs
: 1;
878 unsigned int m_flag_vector
: 1;
879 unsigned int m_flag_stub_supported
: 1;
880 unsigned int m_flag_gnu_ifunc
: 1;
881 unsigned int m_flag_fixed_instance
: 1;
882 unsigned int m_flag_objfile_owned
: 1;
883 unsigned int m_flag_endianity_not_default
: 1;
885 /* * True if this type was declared with "class" rather than
888 unsigned int m_flag_declared_class
: 1;
890 /* * True if this is an enum type with disjoint values. This
891 affects how the enum is printed. */
893 unsigned int m_flag_flag_enum
: 1;
895 /* * For TYPE_CODE_ARRAY, this is true if this type is part of a
896 multi-dimensional array. Multi-dimensional arrays are
897 represented internally as arrays of arrays, and this flag lets
898 gdb distinguish between multiple dimensions and an ordinary array
899 of arrays. The flag is set on each inner dimension, but not the
900 outermost dimension. */
902 unsigned int m_multi_dimensional
: 1;
904 /* * A discriminant telling us which field of the type_specific
905 union is being used for this type, if any. */
907 ENUM_BITFIELD(type_specific_kind
) type_specific_field
: 3;
909 /* The language for this type. */
911 ENUM_BITFIELD(language
) m_lang
: LANGUAGE_BITS
;
913 /* * Number of fields described for this type. This field appears
914 at this location because it packs nicely here. */
916 unsigned int m_nfields
;
918 /* * Name of this type, or NULL if none.
920 This is used for printing only. For looking up a name, look for
921 a symbol in the VAR_DOMAIN. This is generally allocated in the
922 objfile's obstack. However coffread.c uses malloc. */
926 /* * Every type is now associated with a particular objfile, and the
927 type is allocated on the objfile_obstack for that objfile. One
928 problem however, is that there are times when gdb allocates new
929 types while it is not in the process of reading symbols from a
930 particular objfile. Fortunately, these happen when the type
931 being created is a derived type of an existing type, such as in
932 lookup_pointer_type(). So we can just allocate the new type
933 using the same objfile as the existing type, but to do this we
934 need a backpointer to the objfile from the existing type. Yes
935 this is somewhat ugly, but without major overhaul of the internal
936 type system, it can't be avoided for now. */
938 union type_owner m_owner
;
940 /* * For a pointer type, describes the type of object pointed to.
941 - For an array type, describes the type of the elements.
942 - For a function or method type, describes the type of the return value.
943 - For a range type, describes the type of the full range.
944 - For a complex type, describes the type of each coordinate.
945 - For a special record or union type encoding a dynamic-sized type
946 in GNAT, a memoized pointer to a corresponding static version of
948 - Unused otherwise. */
950 struct type
*m_target_type
;
952 /* * For structure and union types, a description of each field.
953 For set and pascal array types, there is one "field",
954 whose type is the domain type of the set or array.
955 For range types, there are two "fields",
956 the minimum and maximum values (both inclusive).
957 For enum types, each possible value is described by one "field".
958 For a function or method type, a "field" for each parameter.
959 For C++ classes, there is one field for each base class (if it is
960 a derived class) plus one field for each class data member. Member
961 functions are recorded elsewhere.
963 Using a pointer to a separate array of fields
964 allows all types to have the same size, which is useful
965 because we can allocate the space for a type before
966 we know what to put in it. */
970 struct field
*fields
;
972 /* * Union member used for range types. */
974 struct range_bounds
*bounds
;
976 /* If this is a scalar type, then this is its corresponding
978 struct type
*complex_type
;
982 /* * Slot to point to additional language-specific fields of this
985 union type_specific type_specific
;
987 /* * Contains all dynamic type properties. */
988 struct dynamic_prop_list
*dyn_prop_list
;
991 /* * Number of bits allocated for alignment. */
993 #define TYPE_ALIGN_BITS 8
995 /* * A ``struct type'' describes a particular instance of a type, with
996 some particular qualification. */
1000 /* Get the type code of this type.
1002 Note that the code can be TYPE_CODE_TYPEDEF, so if you want the real
1003 type, you need to do `check_typedef (type)->code ()`. */
1004 type_code
code () const
1006 return this->main_type
->code
;
1009 /* Set the type code of this type. */
1010 void set_code (type_code code
)
1012 this->main_type
->code
= code
;
1015 /* Get the name of this type. */
1016 const char *name () const
1018 return this->main_type
->name
;
1021 /* Set the name of this type. */
1022 void set_name (const char *name
)
1024 this->main_type
->name
= name
;
1027 /* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
1028 But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
1029 so you only have to call check_typedef once. Since value::allocate
1030 calls check_typedef, X->type ()->length () is safe. */
1031 ULONGEST
length () const
1033 return this->m_length
;
1036 void set_length (ULONGEST length
)
1038 this->m_length
= length
;
1041 /* Get the number of fields of this type. */
1042 unsigned int num_fields () const
1044 return this->main_type
->m_nfields
;
1047 /* Set the number of fields of this type. */
1048 void set_num_fields (unsigned int num_fields
)
1050 this->main_type
->m_nfields
= num_fields
;
1053 /* Get the fields array of this type. */
1054 struct field
*fields () const
1056 return this->main_type
->flds_bnds
.fields
;
1059 /* Get the field at index IDX. */
1060 struct field
&field (int idx
) const
1062 gdb_assert (idx
>= 0 && idx
< num_fields ());
1063 return this->fields ()[idx
];
1066 /* Set the fields array of this type. */
1067 void set_fields (struct field
*fields
)
1069 this->main_type
->flds_bnds
.fields
= fields
;
1072 /* Allocate the fields array of this type, with NFIELDS elements. If INIT,
1073 zero-initialize the allocated memory. */
1074 void alloc_fields (unsigned int nfields
, bool init
= true);
1076 /* Allocate the fields array of this type, and copy the fields from SRC. */
1077 void copy_fields (struct type
*src
);
1078 void copy_fields (std::vector
<struct field
> &src
);
1080 type
*index_type () const
1082 return this->field (0).type ();
1085 struct type
*target_type () const
1087 return this->main_type
->m_target_type
;
1090 void set_target_type (struct type
*target_type
)
1092 this->main_type
->m_target_type
= target_type
;
1095 void set_index_type (type
*index_type
)
1097 this->field (0).set_type (index_type
);
1100 /* Return the instance flags converted to the correct type. */
1101 const type_instance_flags
instance_flags () const
1103 return (enum type_instance_flag_value
) this->m_instance_flags
;
1106 /* Set the instance flags. */
1107 void set_instance_flags (type_instance_flags flags
)
1109 this->m_instance_flags
= flags
;
1112 /* Get the bounds bounds of this type. The type must be a range type. */
1113 range_bounds
*bounds () const
1115 switch (this->code ())
1117 case TYPE_CODE_RANGE
:
1118 return this->main_type
->flds_bnds
.bounds
;
1120 case TYPE_CODE_ARRAY
:
1121 case TYPE_CODE_STRING
:
1122 return this->index_type ()->bounds ();
1125 gdb_assert_not_reached
1126 ("type::bounds called on type with invalid code");
1130 /* Set the bounds of this type. The type must be a range type. */
1131 void set_bounds (range_bounds
*bounds
)
1133 gdb_assert (this->code () == TYPE_CODE_RANGE
);
1135 this->main_type
->flds_bnds
.bounds
= bounds
;
1138 ULONGEST
bit_stride () const
1140 if (this->code () == TYPE_CODE_ARRAY
&& this->field (0).bitsize () != 0)
1141 return this->field (0).bitsize ();
1142 return this->bounds ()->bit_stride ();
1145 /* Unsigned integer type. If this is not set for a TYPE_CODE_INT,
1146 the type is signed (unless TYPE_NOSIGN is set). */
1148 bool is_unsigned () const
1150 return this->main_type
->m_flag_unsigned
;
1153 void set_is_unsigned (bool is_unsigned
)
1155 this->main_type
->m_flag_unsigned
= is_unsigned
;
1158 /* No sign for this type. In C++, "char", "signed char", and
1159 "unsigned char" are distinct types; so we need an extra flag to
1160 indicate the absence of a sign! */
1162 bool has_no_signedness () const
1164 return this->main_type
->m_flag_nosign
;
1167 void set_has_no_signedness (bool has_no_signedness
)
1169 this->main_type
->m_flag_nosign
= has_no_signedness
;
1172 /* This appears in a type's flags word if it is a stub type (e.g.,
1173 if someone referenced a type that wasn't defined in a source file
1174 via (struct sir_not_appearing_in_this_film *)). */
1176 bool is_stub () const
1178 return this->main_type
->m_flag_stub
;
1181 void set_is_stub (bool is_stub
)
1183 this->main_type
->m_flag_stub
= is_stub
;
1186 /* The target type of this type is a stub type, and this type needs
1187 to be updated if it gets un-stubbed in check_typedef. Used for
1188 arrays and ranges, in which TYPE_LENGTH of the array/range gets set
1189 based on the TYPE_LENGTH of the target type. Also, set for
1190 TYPE_CODE_TYPEDEF. */
1192 bool target_is_stub () const
1194 return this->main_type
->m_flag_target_stub
;
1197 void set_target_is_stub (bool target_is_stub
)
1199 this->main_type
->m_flag_target_stub
= target_is_stub
;
1202 /* This is a function type which appears to have a prototype. We
1203 need this for function calls in order to tell us if it's necessary
1204 to coerce the args, or to just do the standard conversions. This
1205 is used with a short field. */
1207 bool is_prototyped () const
1209 return this->main_type
->m_flag_prototyped
;
1212 void set_is_prototyped (bool is_prototyped
)
1214 this->main_type
->m_flag_prototyped
= is_prototyped
;
1217 /* FIXME drow/2002-06-03: Only used for methods, but applies as well
1220 bool has_varargs () const
1222 return this->main_type
->m_flag_varargs
;
1225 void set_has_varargs (bool has_varargs
)
1227 this->main_type
->m_flag_varargs
= has_varargs
;
1230 /* Identify a vector type. Gcc is handling this by adding an extra
1231 attribute to the array type. We slurp that in as a new flag of a
1232 type. This is used only in dwarf2read.c. */
1234 bool is_vector () const
1236 return this->main_type
->m_flag_vector
;
1239 void set_is_vector (bool is_vector
)
1241 this->main_type
->m_flag_vector
= is_vector
;
1244 /* This debug target supports TYPE_STUB(t). In the unsupported case
1245 we have to rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE().
1246 TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only
1247 guessed the TYPE_STUB(t) value (see dwarfread.c). */
1249 bool stub_is_supported () const
1251 return this->main_type
->m_flag_stub_supported
;
1254 void set_stub_is_supported (bool stub_is_supported
)
1256 this->main_type
->m_flag_stub_supported
= stub_is_supported
;
1259 /* Used only for TYPE_CODE_FUNC where it specifies the real function
1260 address is returned by this function call. The target_type method
1261 determines the final returned function type to be presented to
1264 bool is_gnu_ifunc () const
1266 return this->main_type
->m_flag_gnu_ifunc
;
1269 void set_is_gnu_ifunc (bool is_gnu_ifunc
)
1271 this->main_type
->m_flag_gnu_ifunc
= is_gnu_ifunc
;
1274 /* The debugging formats (especially STABS) do not contain enough
1275 information to represent all Ada types---especially those whose
1276 size depends on dynamic quantities. Therefore, the GNAT Ada
1277 compiler includes extra information in the form of additional type
1278 definitions connected by naming conventions. This flag indicates
1279 that the type is an ordinary (unencoded) GDB type that has been
1280 created from the necessary run-time information, and does not need
1281 further interpretation. Optionally marks ordinary, fixed-size GDB
1284 bool is_fixed_instance () const
1286 return this->main_type
->m_flag_fixed_instance
;
1289 void set_is_fixed_instance (bool is_fixed_instance
)
1291 this->main_type
->m_flag_fixed_instance
= is_fixed_instance
;
1294 /* A compiler may supply dwarf instrumentation that indicates the desired
1295 endian interpretation of the variable differs from the native endian
1298 bool endianity_is_not_default () const
1300 return this->main_type
->m_flag_endianity_not_default
;
1303 void set_endianity_is_not_default (bool endianity_is_not_default
)
1305 this->main_type
->m_flag_endianity_not_default
= endianity_is_not_default
;
1309 /* True if this type was declared using the "class" keyword. This is
1310 only valid for C++ structure and enum types. If false, a structure
1311 was declared as a "struct"; if true it was declared "class". For
1312 enum types, this is true when "enum class" or "enum struct" was
1313 used to declare the type. */
1315 bool is_declared_class () const
1317 return this->main_type
->m_flag_declared_class
;
1320 void set_is_declared_class (bool is_declared_class
) const
1322 this->main_type
->m_flag_declared_class
= is_declared_class
;
1325 /* True if this type is a "flag" enum. A flag enum is one where all
1326 the values are pairwise disjoint when "and"ed together. This
1327 affects how enum values are printed. */
1329 bool is_flag_enum () const
1331 return this->main_type
->m_flag_flag_enum
;
1334 void set_is_flag_enum (bool is_flag_enum
)
1336 this->main_type
->m_flag_flag_enum
= is_flag_enum
;
1339 /* True if this array type is part of a multi-dimensional array. */
1341 bool is_multi_dimensional () const
1343 return this->main_type
->m_multi_dimensional
;
1346 void set_is_multi_dimensional (bool value
)
1348 this->main_type
->m_multi_dimensional
= value
;
1351 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return a reference
1352 to this type's fixed_point_info. */
1354 struct fixed_point_type_info
&fixed_point_info () const
1356 gdb_assert (this->code () == TYPE_CODE_FIXED_POINT
);
1357 gdb_assert (this->main_type
->type_specific
.fixed_point_info
!= nullptr);
1359 return *this->main_type
->type_specific
.fixed_point_info
;
1362 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, set this type's
1363 fixed_point_info to INFO. */
1365 void set_fixed_point_info (struct fixed_point_type_info
*info
) const
1367 gdb_assert (this->code () == TYPE_CODE_FIXED_POINT
);
1369 this->main_type
->type_specific
.fixed_point_info
= info
;
1372 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return its base type.
1374 In other words, this returns the type after having peeled all
1375 intermediate type layers (such as TYPE_CODE_RANGE, for instance).
1376 The TYPE_CODE of the type returned is guaranteed to be
1377 a TYPE_CODE_FIXED_POINT. */
1379 struct type
*fixed_point_type_base_type ();
1381 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return its scaling
1384 const gdb_mpq
&fixed_point_scaling_factor ();
1386 /* * Return the dynamic property of the requested KIND from this type's
1387 list of dynamic properties. */
1388 dynamic_prop
*dyn_prop (dynamic_prop_node_kind kind
) const;
1390 /* * Given a dynamic property PROP of a given KIND, add this dynamic
1391 property to this type.
1393 This function assumes that this type is objfile-owned. */
1394 void add_dyn_prop (dynamic_prop_node_kind kind
, dynamic_prop prop
);
1396 /* * Remove dynamic property of kind KIND from this type, if it exists. */
1397 void remove_dyn_prop (dynamic_prop_node_kind kind
);
1399 /* Return true if this type is owned by an objfile. Return false if it is
1400 owned by an architecture. */
1401 bool is_objfile_owned () const
1403 return this->main_type
->m_flag_objfile_owned
;
1406 /* Set the owner of the type to be OBJFILE. */
1407 void set_owner (objfile
*objfile
)
1409 gdb_assert (objfile
!= nullptr);
1411 this->main_type
->m_owner
.objfile
= objfile
;
1412 this->main_type
->m_flag_objfile_owned
= true;
1415 /* Set the owner of the type to be ARCH. */
1416 void set_owner (gdbarch
*arch
)
1418 gdb_assert (arch
!= nullptr);
1420 this->main_type
->m_owner
.gdbarch
= arch
;
1421 this->main_type
->m_flag_objfile_owned
= false;
1424 /* Return the objfile owner of this type.
1426 Return nullptr if this type is not objfile-owned. */
1427 struct objfile
*objfile_owner () const
1429 if (!this->is_objfile_owned ())
1432 return this->main_type
->m_owner
.objfile
;
1435 /* Return the gdbarch owner of this type.
1437 Return nullptr if this type is not gdbarch-owned. */
1438 gdbarch
*arch_owner () const
1440 if (this->is_objfile_owned ())
1443 return this->main_type
->m_owner
.gdbarch
;
1446 /* Return the type's architecture. For types owned by an
1447 architecture, that architecture is returned. For types owned by an
1448 objfile, that objfile's architecture is returned.
1450 The return value is always non-nullptr. */
1451 gdbarch
*arch () const;
1453 /* * Return true if this is an integer type whose logical (bit) size
1454 differs from its storage size; false otherwise. Always return
1455 false for non-integer (i.e., non-TYPE_SPECIFIC_INT) types. */
1456 bool bit_size_differs_p () const
1458 return (main_type
->type_specific_field
== TYPE_SPECIFIC_INT
1459 && main_type
->type_specific
.int_stuff
.bit_size
!= 8 * length ());
1462 /* * Return the logical (bit) size for this integer type. Only
1463 valid for integer (TYPE_SPECIFIC_INT) types. */
1464 unsigned short bit_size () const
1466 gdb_assert (main_type
->type_specific_field
== TYPE_SPECIFIC_INT
);
1467 return main_type
->type_specific
.int_stuff
.bit_size
;
1470 /* * Return the bit offset for this integer type. Only valid for
1471 integer (TYPE_SPECIFIC_INT) types. */
1472 unsigned short bit_offset () const
1474 gdb_assert (main_type
->type_specific_field
== TYPE_SPECIFIC_INT
);
1475 return main_type
->type_specific
.int_stuff
.bit_offset
;
1478 /* Return true if this is a pointer or reference type. */
1479 bool is_pointer_or_reference () const
1481 return this->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (this);
1484 /* Return true if this type is "string-like", according to its
1485 defining language. */
1486 bool is_string_like ();
1488 /* Return true if this type is "array-like". This includes arrays,
1489 but also some forms of structure type that are recognized as
1490 representations of arrays by the type's language. */
1491 bool is_array_like ();
1493 /* Return the language that this type came from. */
1494 enum language
language () const
1495 { return main_type
->m_lang
; }
1497 /* * Type that is a pointer to this type.
1498 NULL if no such pointer-to type is known yet.
1499 The debugger may add the address of such a type
1500 if it has to construct one later. */
1502 struct type
*pointer_type
;
1504 /* * C++: also need a reference type. */
1506 struct type
*reference_type
;
1508 /* * A C++ rvalue reference type added in C++11. */
1510 struct type
*rvalue_reference_type
;
1512 /* * Variant chain. This points to a type that differs from this
1513 one only in qualifiers and length. Currently, the possible
1514 qualifiers are const, volatile, code-space, data-space, and
1515 address class. The length may differ only when one of the
1516 address class flags are set. The variants are linked in a
1517 circular ring and share MAIN_TYPE. */
1521 /* * The alignment for this type. Zero means that the alignment was
1522 not specified in the debug info. Note that this is stored in a
1523 funny way: as the log base 2 (plus 1) of the alignment; so a
1524 value of 1 means the alignment is 1, and a value of 9 means the
1525 alignment is 256. */
1527 unsigned align_log2
: TYPE_ALIGN_BITS
;
1529 /* * Flags specific to this instance of the type, indicating where
1532 For TYPE_CODE_TYPEDEF the flags of the typedef type should be
1533 binary or-ed with the target type, with a special case for
1534 address class and space class. For example if this typedef does
1535 not specify any new qualifiers, TYPE_INSTANCE_FLAGS is 0 and the
1536 instance flags are completely inherited from the target type. No
1537 qualifiers can be cleared by the typedef. See also
1539 unsigned m_instance_flags
: 9;
1541 /* * Length of storage for a value of this type. The value is the
1542 expression in host bytes of what sizeof(type) would return. This
1543 size includes padding. For example, an i386 extended-precision
1544 floating point value really only occupies ten bytes, but most
1545 ABI's declare its size to be 12 bytes, to preserve alignment.
1546 A `struct type' representing such a floating-point type would
1547 have a `length' value of 12, even though the last two bytes are
1550 Since this field is expressed in host bytes, its value is appropriate
1551 to pass to memcpy and such (it is assumed that GDB itself always runs
1552 on an 8-bits addressable architecture). However, when using it for
1553 target address arithmetic (e.g. adding it to a target address), the
1554 type_length_units function should be used in order to get the length
1555 expressed in target addressable memory units. */
1559 /* * Core type, shared by a group of qualified types. */
1561 struct main_type
*main_type
;
1567 /* * The overloaded name.
1568 This is generally allocated in the objfile's obstack.
1569 However stabsread.c sometimes uses malloc. */
1573 /* * The number of methods with this name. */
1577 /* * The list of methods. */
1579 struct fn_field
*fn_fields
;
1586 /* * If is_stub is clear, this is the mangled name which we can look
1587 up to find the address of the method (FIXME: it would be cleaner
1588 to have a pointer to the struct symbol here instead).
1590 If is_stub is set, this is the portion of the mangled name which
1591 specifies the arguments. For example, "ii", if there are two int
1592 arguments, or "" if there are no arguments. See gdb_mangle_name
1593 for the conversion from this format to the one used if is_stub is
1596 const char *physname
;
1598 /* * The function type for the method.
1600 (This comment used to say "The return value of the method", but
1601 that's wrong. The function type is expected here, i.e. something
1602 with TYPE_CODE_METHOD, and *not* the return-value type). */
1606 /* * For virtual functions. First baseclass that defines this
1607 virtual function. */
1609 struct type
*fcontext
;
1613 unsigned int is_const
:1;
1614 unsigned int is_volatile
:1;
1615 unsigned int is_artificial
:1;
1617 /* * A stub method only has some fields valid (but they are enough
1618 to reconstruct the rest of the fields). */
1620 unsigned int is_stub
:1;
1622 /* * True if this function is a constructor, false otherwise. */
1624 unsigned int is_constructor
: 1;
1626 /* * True if this function is deleted, false otherwise. */
1628 unsigned int is_deleted
: 1;
1630 /* * DW_AT_defaulted attribute for this function. The value is one
1631 of the DW_DEFAULTED constants. */
1633 ENUM_BITFIELD (dwarf_defaulted_attribute
) defaulted
: 2;
1635 /* Accessibility of the field. */
1636 enum accessibility accessibility
;
1638 /* * Index into that baseclass's virtual function table, minus 2;
1639 else if static: VOFFSET_STATIC; else: 0. */
1641 unsigned int voffset
:16;
1643 #define VOFFSET_STATIC 1
1649 /* * Unqualified name to be prefixed by owning class qualified
1654 /* * Type this typedef named NAME represents. */
1658 /* Accessibility of the field. */
1659 enum accessibility accessibility
;
1662 /* * C++ language-specific information for TYPE_CODE_STRUCT and
1663 TYPE_CODE_UNION nodes. */
1665 struct cplus_struct_type
1667 /* * Number of base classes this type derives from. The
1668 baseclasses are stored in the first N_BASECLASSES fields
1669 (i.e. the `fields' field of the struct type). The only fields
1670 of struct field that are used are: type, name, loc.bitpos. */
1672 short n_baseclasses
;
1674 /* * Field number of the virtual function table pointer in VPTR_BASETYPE.
1675 All access to this field must be through TYPE_VPTR_FIELDNO as one
1676 thing it does is check whether the field has been initialized.
1677 Initially TYPE_RAW_CPLUS_SPECIFIC has the value of cplus_struct_default,
1678 which for portability reasons doesn't initialize this field.
1679 TYPE_VPTR_FIELDNO returns -1 for this case.
1681 If -1, we were unable to find the virtual function table pointer in
1682 initial symbol reading, and get_vptr_fieldno should be called to find
1683 it if possible. get_vptr_fieldno will update this field if possible.
1684 Otherwise the value is left at -1.
1686 Unused if this type does not have virtual functions. */
1690 /* * Number of methods with unique names. All overloaded methods
1691 with the same name count only once. */
1695 /* * Number of template arguments. */
1697 unsigned short n_template_arguments
;
1699 /* * One if this struct is a dynamic class, as defined by the
1700 Itanium C++ ABI: if it requires a virtual table pointer,
1701 because it or any of its base classes have one or more virtual
1702 member functions or virtual base classes. Minus one if not
1703 dynamic. Zero if not yet computed. */
1707 /* * The calling convention for this type, fetched from the
1708 DW_AT_calling_convention attribute. The value is one of the
1711 ENUM_BITFIELD (dwarf_calling_convention
) calling_convention
: 8;
1713 /* * The base class which defined the virtual function table pointer. */
1715 struct type
*vptr_basetype
;
1717 /* * For classes, structures, and unions, a description of each
1718 field, which consists of an overloaded name, followed by the
1719 types of arguments that the method expects, and then the name
1720 after it has been renamed to make it distinct.
1722 fn_fieldlists points to an array of nfn_fields of these. */
1724 struct fn_fieldlist
*fn_fieldlists
;
1726 /* * typedefs defined inside this class. typedef_field points to
1727 an array of typedef_field_count elements. */
1729 struct decl_field
*typedef_field
;
1731 unsigned typedef_field_count
;
1733 /* * The nested types defined by this type. nested_types points to
1734 an array of nested_types_count elements. */
1736 struct decl_field
*nested_types
;
1738 unsigned nested_types_count
;
1740 /* * The template arguments. This is an array with
1741 N_TEMPLATE_ARGUMENTS elements. This is NULL for non-template
1744 struct symbol
**template_arguments
;
1747 /* * Struct used to store conversion rankings. */
1753 /* * When two conversions are of the same type and therefore have
1754 the same rank, subrank is used to differentiate the two.
1756 Eg: Two derived-class-pointer to base-class-pointer conversions
1757 would both have base pointer conversion rank, but the
1758 conversion with the shorter distance to the ancestor is
1759 preferable. 'subrank' would be used to reflect that. */
1764 /* * Used for ranking a function for overload resolution. */
1766 typedef std::vector
<rank
> badness_vector
;
1768 /* * GNAT Ada-specific information for various Ada types. */
1770 struct gnat_aux_type
1772 /* * Parallel type used to encode information about dynamic types
1773 used in Ada (such as variant records, variable-size array,
1775 struct type
* descriptive_type
;
1778 /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types. */
1782 /* * The calling convention for targets supporting multiple ABIs.
1783 Right now this is only fetched from the Dwarf-2
1784 DW_AT_calling_convention attribute. The value is one of the
1787 ENUM_BITFIELD (dwarf_calling_convention
) calling_convention
: 8;
1789 /* * Whether this function normally returns to its caller. It is
1790 set from the DW_AT_noreturn attribute if set on the
1791 DW_TAG_subprogram. */
1793 unsigned int is_noreturn
: 1;
1795 /* * Only those DW_TAG_call_site's in this function that have
1796 DW_AT_call_tail_call set are linked in this list. Function
1797 without its tail call list complete
1798 (DW_AT_call_all_tail_calls or its superset
1799 DW_AT_call_all_calls) has TAIL_CALL_LIST NULL, even if some
1800 DW_TAG_call_site's exist in such function. */
1802 struct call_site
*tail_call_list
;
1804 /* * For method types (TYPE_CODE_METHOD), the aggregate type that
1805 contains the method. */
1807 struct type
*self_type
;
1810 /* The type-specific info for TYPE_CODE_FIXED_POINT types. */
1812 struct fixed_point_type_info
1814 /* The fixed point type's scaling factor. */
1815 gdb_mpq scaling_factor
;
1818 /* * The default value of TYPE_CPLUS_SPECIFIC(T) points to this shared
1819 static structure. */
1821 extern const struct cplus_struct_type cplus_struct_default
;
1823 extern void allocate_cplus_struct_type (struct type
*);
1825 #define INIT_CPLUS_SPECIFIC(type) \
1826 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_CPLUS_STUFF, \
1827 TYPE_RAW_CPLUS_SPECIFIC (type) = (struct cplus_struct_type*) \
1828 &cplus_struct_default)
1830 #define ALLOCATE_CPLUS_STRUCT_TYPE(type) allocate_cplus_struct_type (type)
1832 #define HAVE_CPLUS_STRUCT(type) \
1833 (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_CPLUS_STUFF \
1834 && TYPE_RAW_CPLUS_SPECIFIC (type) != &cplus_struct_default)
1836 #define INIT_NONE_SPECIFIC(type) \
1837 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_NONE, \
1838 TYPE_MAIN_TYPE (type)->type_specific = {})
1840 extern const struct gnat_aux_type gnat_aux_default
;
1842 extern void allocate_gnat_aux_type (struct type
*);
1844 #define INIT_GNAT_SPECIFIC(type) \
1845 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_GNAT_STUFF, \
1846 TYPE_GNAT_SPECIFIC (type) = (struct gnat_aux_type *) &gnat_aux_default)
1847 #define ALLOCATE_GNAT_AUX_TYPE(type) allocate_gnat_aux_type (type)
1848 /* * A macro that returns non-zero if the type-specific data should be
1849 read as "gnat-stuff". */
1850 #define HAVE_GNAT_AUX_INFO(type) \
1851 (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF)
1853 /* * True if TYPE is known to be an Ada type of some kind. */
1854 #define ADA_TYPE_P(type) \
1855 (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF \
1856 || (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE \
1857 && (type)->is_fixed_instance ()))
1859 #define INIT_FUNC_SPECIFIC(type) \
1860 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC, \
1861 TYPE_MAIN_TYPE (type)->type_specific.func_stuff = (struct func_type *) \
1862 TYPE_ZALLOC (type, \
1863 sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
1865 /* "struct fixed_point_type_info" has a field that has a destructor.
1866 See allocate_fixed_point_type_info to understand how this is
1868 #define INIT_FIXED_POINT_SPECIFIC(type) \
1869 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \
1870 allocate_fixed_point_type_info (type))
1872 #define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
1873 #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
1874 #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
1875 #define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type
1876 #define TYPE_CHAIN(thistype) (thistype)->chain
1878 /* * Return the alignment of the type in target addressable memory
1879 units, or 0 if no alignment was specified. */
1880 #define TYPE_RAW_ALIGN(thistype) type_raw_align (thistype)
1882 /* * Return the alignment of the type in target addressable memory
1883 units, or 0 if no alignment was specified. */
1884 extern unsigned type_raw_align (struct type
*);
1886 /* * Return the alignment of the type in target addressable memory
1887 units. Return 0 if the alignment cannot be determined; but note
1888 that this makes an effort to compute the alignment even it it was
1889 not specified in the debug info. */
1890 extern unsigned type_align (struct type
*);
1892 /* * Set the alignment of the type. The alignment must be a power of
1893 2. Returns false if the given value does not fit in the available
1894 space in struct type. */
1895 extern bool set_type_align (struct type
*, ULONGEST
);
1897 /* Property accessors for the type data location. */
1898 #define TYPE_DATA_LOCATION(thistype) \
1899 ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION))
1900 #define TYPE_DATA_LOCATION_BATON(thistype) \
1901 TYPE_DATA_LOCATION (thistype)->data.baton
1902 #define TYPE_DATA_LOCATION_ADDR(thistype) \
1903 (TYPE_DATA_LOCATION (thistype)->const_val ())
1904 #define TYPE_DATA_LOCATION_KIND(thistype) \
1905 (TYPE_DATA_LOCATION (thistype)->kind ())
1906 #define TYPE_DYNAMIC_LENGTH(thistype) \
1907 ((thistype)->dyn_prop (DYN_PROP_BYTE_SIZE))
1909 /* Property accessors for the type allocated/associated. */
1910 #define TYPE_ALLOCATED_PROP(thistype) \
1911 ((thistype)->dyn_prop (DYN_PROP_ALLOCATED))
1912 #define TYPE_ASSOCIATED_PROP(thistype) \
1913 ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED))
1914 #define TYPE_RANK_PROP(thistype) \
1915 ((thistype)->dyn_prop (DYN_PROP_RANK))
1919 #define TYPE_SELF_TYPE(thistype) internal_type_self_type (thistype)
1920 /* Do not call this, use TYPE_SELF_TYPE. */
1921 extern struct type
*internal_type_self_type (struct type
*);
1922 extern void set_type_self_type (struct type
*, struct type
*);
1924 extern int internal_type_vptr_fieldno (struct type
*);
1925 extern void set_type_vptr_fieldno (struct type
*, int);
1926 extern struct type
*internal_type_vptr_basetype (struct type
*);
1927 extern void set_type_vptr_basetype (struct type
*, struct type
*);
1928 #define TYPE_VPTR_FIELDNO(thistype) internal_type_vptr_fieldno (thistype)
1929 #define TYPE_VPTR_BASETYPE(thistype) internal_type_vptr_basetype (thistype)
1931 #define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
1932 #define TYPE_SPECIFIC_FIELD(thistype) \
1933 TYPE_MAIN_TYPE(thistype)->type_specific_field
1934 /* We need this tap-dance with the TYPE_RAW_SPECIFIC because of the case
1935 where we're trying to print an Ada array using the C language.
1936 In that case, there is no "cplus_stuff", but the C language assumes
1937 that there is. What we do, in that case, is pretend that there is
1938 an implicit one which is the default cplus stuff. */
1939 #define TYPE_CPLUS_SPECIFIC(thistype) \
1940 (!HAVE_CPLUS_STRUCT(thistype) \
1941 ? (struct cplus_struct_type*)&cplus_struct_default \
1942 : TYPE_RAW_CPLUS_SPECIFIC(thistype))
1943 #define TYPE_RAW_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
1944 #define TYPE_CPLUS_CALLING_CONVENTION(thistype) \
1945 TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff->calling_convention
1946 #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
1947 #define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
1948 #define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
1949 #define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->calling_convention
1950 #define TYPE_NO_RETURN(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->is_noreturn
1951 #define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->tail_call_list
1952 #define TYPE_BASECLASS(thistype,index) ((thistype)->field (index).type ())
1953 #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
1954 #define TYPE_BASECLASS_NAME(thistype,index) (thistype->field (index).name ())
1955 #define TYPE_BASECLASS_BITPOS(thistype,index) (thistype->field (index).loc_bitpos ())
1956 #define BASETYPE_VIA_PUBLIC(thistype, index) \
1957 ((thistype)->field (index).is_public ())
1958 #define TYPE_CPLUS_DYNAMIC(thistype) TYPE_CPLUS_SPECIFIC (thistype)->is_dynamic
1960 #define BASETYPE_VIA_VIRTUAL(thistype, index) \
1961 ((thistype)->field (index).is_virtual ())
1963 #define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists
1964 #define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n]
1965 #define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields
1966 #define TYPE_FN_FIELDLIST_NAME(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].name
1967 #define TYPE_FN_FIELDLIST_LENGTH(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].length
1969 #define TYPE_N_TEMPLATE_ARGUMENTS(thistype) \
1970 TYPE_CPLUS_SPECIFIC (thistype)->n_template_arguments
1971 #define TYPE_TEMPLATE_ARGUMENTS(thistype) \
1972 TYPE_CPLUS_SPECIFIC (thistype)->template_arguments
1973 #define TYPE_TEMPLATE_ARGUMENT(thistype, n) \
1974 TYPE_CPLUS_SPECIFIC (thistype)->template_arguments[n]
1976 #define TYPE_FN_FIELD(thisfn, n) (thisfn)[n]
1977 #define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname
1978 #define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type
1979 #define TYPE_FN_FIELD_ARGS(thisfn, n) (((thisfn)[n].type)->fields ())
1980 #define TYPE_FN_FIELD_CONST(thisfn, n) ((thisfn)[n].is_const)
1981 #define TYPE_FN_FIELD_VOLATILE(thisfn, n) ((thisfn)[n].is_volatile)
1982 #define TYPE_FN_FIELD_PRIVATE(thisfn, n) \
1983 ((thisfn)[n].accessibility == accessibility::PRIVATE)
1984 #define TYPE_FN_FIELD_PROTECTED(thisfn, n) \
1985 ((thisfn)[n].accessibility == accessibility::PROTECTED)
1986 #define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n) ((thisfn)[n].is_artificial)
1987 #define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
1988 #define TYPE_FN_FIELD_CONSTRUCTOR(thisfn, n) ((thisfn)[n].is_constructor)
1989 #define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext)
1990 #define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
1991 #define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
1992 #define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
1993 #define TYPE_FN_FIELD_DEFAULTED(thisfn, n) ((thisfn)[n].defaulted)
1994 #define TYPE_FN_FIELD_DELETED(thisfn, n) ((thisfn)[n].is_deleted)
1996 /* Accessors for typedefs defined by a class. */
1997 #define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \
1998 TYPE_CPLUS_SPECIFIC (thistype)->typedef_field
1999 #define TYPE_TYPEDEF_FIELD(thistype, n) \
2000 TYPE_CPLUS_SPECIFIC (thistype)->typedef_field[n]
2001 #define TYPE_TYPEDEF_FIELD_NAME(thistype, n) \
2002 TYPE_TYPEDEF_FIELD (thistype, n).name
2003 #define TYPE_TYPEDEF_FIELD_TYPE(thistype, n) \
2004 TYPE_TYPEDEF_FIELD (thistype, n).type
2005 #define TYPE_TYPEDEF_FIELD_COUNT(thistype) \
2006 TYPE_CPLUS_SPECIFIC (thistype)->typedef_field_count
2007 #define TYPE_TYPEDEF_FIELD_PROTECTED(thistype, n) \
2008 (TYPE_TYPEDEF_FIELD (thistype, n).accessibility == accessibility::PROTECTED)
2009 #define TYPE_TYPEDEF_FIELD_PRIVATE(thistype, n) \
2010 (TYPE_TYPEDEF_FIELD (thistype, n).accessibility == accessibility::PRIVATE)
2012 #define TYPE_NESTED_TYPES_ARRAY(thistype) \
2013 TYPE_CPLUS_SPECIFIC (thistype)->nested_types
2014 #define TYPE_NESTED_TYPES_FIELD(thistype, n) \
2015 TYPE_CPLUS_SPECIFIC (thistype)->nested_types[n]
2016 #define TYPE_NESTED_TYPES_FIELD_NAME(thistype, n) \
2017 TYPE_NESTED_TYPES_FIELD (thistype, n).name
2018 #define TYPE_NESTED_TYPES_FIELD_TYPE(thistype, n) \
2019 TYPE_NESTED_TYPES_FIELD (thistype, n).type
2020 #define TYPE_NESTED_TYPES_COUNT(thistype) \
2021 TYPE_CPLUS_SPECIFIC (thistype)->nested_types_count
2022 #define TYPE_NESTED_TYPES_FIELD_PROTECTED(thistype, n) \
2023 (TYPE_NESTED_TYPES_FIELD (thistype, n).accessibility \
2024 == accessibility::PROTECTED)
2025 #define TYPE_NESTED_TYPES_FIELD_PRIVATE(thistype, n) \
2026 (TYPE_NESTED_TYPES_FIELD (thistype, n).accessibility \
2027 == accessibility::PRIVATE)
2029 #define TYPE_IS_OPAQUE(thistype) \
2030 ((((thistype)->code () == TYPE_CODE_STRUCT) \
2031 || ((thistype)->code () == TYPE_CODE_UNION)) \
2032 && ((thistype)->num_fields () == 0) \
2033 && (!HAVE_CPLUS_STRUCT (thistype) \
2034 || TYPE_NFN_FIELDS (thistype) == 0) \
2035 && ((thistype)->is_stub () || !(thistype)->stub_is_supported ()))
2037 /* * A helper macro that returns the name of a type or "unnamed type"
2038 if the type has no name. */
2040 #define TYPE_SAFE_NAME(type) \
2041 (type->name () != nullptr ? type->name () : _("<unnamed type>"))
2043 /* * A helper macro that returns the name of an error type. If the
2044 type has a name, it is used; otherwise, a default is used. */
2046 #define TYPE_ERROR_NAME(type) \
2047 (type->name () ? type->name () : _("<error type>"))
2049 /* Given TYPE, return its floatformat. */
2050 const struct floatformat
*floatformat_from_type (const struct type
*type
);
2054 /* Integral types. */
2056 /* Implicit size/sign (based on the architecture's ABI). */
2057 struct type
*builtin_void
= nullptr;
2058 struct type
*builtin_char
= nullptr;
2059 struct type
*builtin_short
= nullptr;
2060 struct type
*builtin_int
= nullptr;
2061 struct type
*builtin_long
= nullptr;
2062 struct type
*builtin_signed_char
= nullptr;
2063 struct type
*builtin_unsigned_char
= nullptr;
2064 struct type
*builtin_unsigned_short
= nullptr;
2065 struct type
*builtin_unsigned_int
= nullptr;
2066 struct type
*builtin_unsigned_long
= nullptr;
2067 struct type
*builtin_bfloat16
= nullptr;
2068 struct type
*builtin_half
= nullptr;
2069 struct type
*builtin_float
= nullptr;
2070 struct type
*builtin_double
= nullptr;
2071 struct type
*builtin_long_double
= nullptr;
2072 struct type
*builtin_complex
= nullptr;
2073 struct type
*builtin_double_complex
= nullptr;
2074 struct type
*builtin_string
= nullptr;
2075 struct type
*builtin_bool
= nullptr;
2076 struct type
*builtin_long_long
= nullptr;
2077 struct type
*builtin_unsigned_long_long
= nullptr;
2078 struct type
*builtin_decfloat
= nullptr;
2079 struct type
*builtin_decdouble
= nullptr;
2080 struct type
*builtin_declong
= nullptr;
2082 /* "True" character types.
2083 We use these for the '/c' print format, because c_char is just a
2084 one-byte integral type, which languages less laid back than C
2085 will print as ... well, a one-byte integral type. */
2086 struct type
*builtin_true_char
= nullptr;
2087 struct type
*builtin_true_unsigned_char
= nullptr;
2089 /* Explicit sizes - see C9X <intypes.h> for naming scheme. The "int0"
2090 is for when an architecture needs to describe a register that has
2092 struct type
*builtin_int0
= nullptr;
2093 struct type
*builtin_int8
= nullptr;
2094 struct type
*builtin_uint8
= nullptr;
2095 struct type
*builtin_int16
= nullptr;
2096 struct type
*builtin_uint16
= nullptr;
2097 struct type
*builtin_int24
= nullptr;
2098 struct type
*builtin_uint24
= nullptr;
2099 struct type
*builtin_int32
= nullptr;
2100 struct type
*builtin_uint32
= nullptr;
2101 struct type
*builtin_int64
= nullptr;
2102 struct type
*builtin_uint64
= nullptr;
2103 struct type
*builtin_int128
= nullptr;
2104 struct type
*builtin_uint128
= nullptr;
2106 /* Wide character types. */
2107 struct type
*builtin_char16
= nullptr;
2108 struct type
*builtin_char32
= nullptr;
2109 struct type
*builtin_wchar
= nullptr;
2111 /* Pointer types. */
2113 /* * `pointer to data' type. Some target platforms use an implicitly
2114 {sign,zero} -extended 32-bit ABI pointer on a 64-bit ISA. */
2115 struct type
*builtin_data_ptr
= nullptr;
2117 /* * `pointer to function (returning void)' type. Harvard
2118 architectures mean that ABI function and code pointers are not
2119 interconvertible. Similarly, since ANSI, C standards have
2120 explicitly said that pointers to functions and pointers to data
2121 are not interconvertible --- that is, you can't cast a function
2122 pointer to void * and back, and expect to get the same value.
2123 However, all function pointer types are interconvertible, so void
2124 (*) () can server as a generic function pointer. */
2126 struct type
*builtin_func_ptr
= nullptr;
2128 /* * `function returning pointer to function (returning void)' type.
2129 The final void return type is not significant for it. */
2131 struct type
*builtin_func_func
= nullptr;
2133 /* Special-purpose types. */
2135 /* * This type is used to represent a GDB internal function. */
2137 struct type
*internal_fn
= nullptr;
2139 /* * This type is used to represent an xmethod. */
2140 struct type
*xmethod
= nullptr;
2142 /* * This type is used to represent symbol addresses. */
2143 struct type
*builtin_core_addr
= nullptr;
2145 /* * This type represents a type that was unrecognized in symbol
2147 struct type
*builtin_error
= nullptr;
2149 /* * Types used for symbols with no debug information. */
2150 struct type
*nodebug_text_symbol
= nullptr;
2151 struct type
*nodebug_text_gnu_ifunc_symbol
= nullptr;
2152 struct type
*nodebug_got_plt_symbol
= nullptr;
2153 struct type
*nodebug_data_symbol
= nullptr;
2154 struct type
*nodebug_unknown_symbol
= nullptr;
2155 struct type
*nodebug_tls_symbol
= nullptr;
2158 /* * Return the type table for the specified architecture. */
2160 extern const struct builtin_type
*builtin_type (struct gdbarch
*gdbarch
);
2162 /* * Return the type table for the specified objfile. */
2164 extern const struct builtin_type
*builtin_type (struct objfile
*objfile
);
2166 /* Explicit floating-point formats. See "floatformat.h". */
2167 extern const struct floatformat
*floatformats_ieee_half
[BFD_ENDIAN_UNKNOWN
];
2168 extern const struct floatformat
*floatformats_ieee_single
[BFD_ENDIAN_UNKNOWN
];
2169 extern const struct floatformat
*floatformats_ieee_double
[BFD_ENDIAN_UNKNOWN
];
2170 extern const struct floatformat
*floatformats_ieee_quad
[BFD_ENDIAN_UNKNOWN
];
2171 extern const struct floatformat
*floatformats_ieee_double_littlebyte_bigword
[BFD_ENDIAN_UNKNOWN
];
2172 extern const struct floatformat
*floatformats_i387_ext
[BFD_ENDIAN_UNKNOWN
];
2173 extern const struct floatformat
*floatformats_m68881_ext
[BFD_ENDIAN_UNKNOWN
];
2174 extern const struct floatformat
*floatformats_arm_ext
[BFD_ENDIAN_UNKNOWN
];
2175 extern const struct floatformat
*floatformats_ia64_spill
[BFD_ENDIAN_UNKNOWN
];
2176 extern const struct floatformat
*floatformats_vax_f
[BFD_ENDIAN_UNKNOWN
];
2177 extern const struct floatformat
*floatformats_vax_d
[BFD_ENDIAN_UNKNOWN
];
2178 extern const struct floatformat
*floatformats_ibm_long_double
[BFD_ENDIAN_UNKNOWN
];
2179 extern const struct floatformat
*floatformats_bfloat16
[BFD_ENDIAN_UNKNOWN
];
2181 /* Allocate space for storing data associated with a particular
2182 type. We ensure that the space is allocated using the same
2183 mechanism that was used to allocate the space for the type
2184 structure itself. I.e. if the type is on an objfile's
2185 objfile_obstack, then the space for data associated with that type
2186 will also be allocated on the objfile_obstack. If the type is
2187 associated with a gdbarch, then the space for data associated with that
2188 type will also be allocated on the gdbarch_obstack.
2190 If a type is not associated with neither an objfile or a gdbarch then
2191 you should not use this macro to allocate space for data, instead you
2192 should call xmalloc directly, and ensure the memory is correctly freed
2193 when it is no longer needed. */
2195 #define TYPE_ALLOC(t,size) \
2196 (obstack_alloc (((t)->is_objfile_owned () \
2197 ? &((t)->objfile_owner ()->objfile_obstack) \
2198 : gdbarch_obstack ((t)->arch_owner ())), \
2202 /* See comment on TYPE_ALLOC. */
2204 #define TYPE_ZALLOC(t,size) (memset (TYPE_ALLOC (t, size), 0, size))
2206 /* * This returns the target type (or NULL) of TYPE, also skipping
2209 extern struct type
*get_target_type (struct type
*type
);
2211 /* Return the equivalent of TYPE_LENGTH, but in number of target
2212 addressable memory units of the associated gdbarch instead of bytes. */
2214 extern unsigned int type_length_units (struct type
*type
);
2216 /* An object of this type is passed when allocating certain types. It
2217 determines where the new type is allocated. Ultimately a type is
2218 either allocated on a on an objfile obstack or on a gdbarch
2219 obstack. However, it's also possible to request that a new type be
2220 allocated on the same obstack as some existing type, or that a
2221 "new" type instead overwrite a supplied type object. */
2223 class type_allocator
2227 /* Create new types on OBJFILE. */
2228 type_allocator (objfile
*objfile
, enum language lang
)
2229 : m_is_objfile (true),
2232 m_data
.objfile
= objfile
;
2235 /* Create new types on GDBARCH. */
2236 explicit type_allocator (gdbarch
*gdbarch
)
2237 : m_lang (language_minimal
)
2239 m_data
.gdbarch
= gdbarch
;
2242 /* This determines whether a passed-in type should be rewritten in
2243 place, or whether it should simply determine where the new type
2245 enum type_allocator_kind
2247 /* Allocate on same obstack as existing type. */
2249 /* Smash the existing type. */
2253 /* Create new types either on the same obstack as TYPE; or if SMASH
2254 is passed, overwrite TYPE. */
2255 explicit type_allocator (struct type
*type
,
2256 type_allocator_kind kind
= SAME
)
2257 : m_lang (type
->language ())
2261 if (type
->is_objfile_owned ())
2263 m_data
.objfile
= type
->objfile_owner ();
2264 m_is_objfile
= true;
2267 m_data
.gdbarch
= type
->arch_owner ();
2276 /* Create new types on the same obstack as TYPE. */
2277 explicit type_allocator (const struct type
*type
)
2278 : m_is_objfile (type
->is_objfile_owned ()),
2279 m_lang (type
->language ())
2281 if (type
->is_objfile_owned ())
2282 m_data
.objfile
= type
->objfile_owner ();
2284 m_data
.gdbarch
= type
->arch_owner ();
2287 /* Create a new type on the desired obstack. Note that a "new" type
2288 is not created if type-smashing was selected at construction. */
2291 /* Create a new type on the desired obstack, and fill in its code,
2292 length, and name. If NAME is non-null, it is copied to the
2293 destination obstack first. Note that a "new" type is not created
2294 if type-smashing was selected at construction. */
2295 type
*new_type (enum type_code code
, int bit
, const char *name
);
2297 /* Return the architecture associated with this allocator. This
2298 comes from whatever object was supplied to the constructor. */
2303 /* Where the type should wind up. */
2306 struct objfile
*objfile
;
2307 struct gdbarch
*gdbarch
;
2311 /* True if this allocator uses the objfile field above. */
2312 bool m_is_objfile
= false;
2313 /* True if this allocator uses the type field above, indicating that
2314 the "allocation" should be done in-place. */
2315 bool m_smash
= false;
2316 /* The language for types created by this allocator. */
2317 enum language m_lang
;
2320 /* Allocate a TYPE_CODE_INT type structure using ALLOC. BIT is the
2321 type size in bits. If UNSIGNED_P is non-zero, set the type's
2322 TYPE_UNSIGNED flag. NAME is the type name. */
2324 extern struct type
*init_integer_type (type_allocator
&alloc
, int bit
,
2325 int unsigned_p
, const char *name
);
2327 /* Allocate a TYPE_CODE_CHAR type structure using ALLOC. BIT is the
2328 type size in bits. If UNSIGNED_P is non-zero, set the type's
2329 TYPE_UNSIGNED flag. NAME is the type name. */
2331 extern struct type
*init_character_type (type_allocator
&alloc
, int bit
,
2332 int unsigned_p
, const char *name
);
2334 /* Allocate a TYPE_CODE_BOOL type structure using ALLOC. BIT is the
2335 type size in bits. If UNSIGNED_P is non-zero, set the type's
2336 TYPE_UNSIGNED flag. NAME is the type name. */
2338 extern struct type
*init_boolean_type (type_allocator
&alloc
, int bit
,
2339 int unsigned_p
, const char *name
);
2341 /* Allocate a TYPE_CODE_FLT type structure using ALLOC.
2342 BIT is the type size in bits; if BIT equals -1, the size is
2343 determined by the floatformat. NAME is the type name. Set the
2344 TYPE_FLOATFORMAT from FLOATFORMATS. BYTE_ORDER is the byte order
2345 to use. If it is BFD_ENDIAN_UNKNOWN (the default), then the byte
2346 order of the objfile's architecture is used. */
2348 extern struct type
*init_float_type
2349 (type_allocator
&alloc
, int bit
, const char *name
,
2350 const struct floatformat
**floatformats
,
2351 enum bfd_endian byte_order
= BFD_ENDIAN_UNKNOWN
);
2353 /* Allocate a TYPE_CODE_DECFLOAT type structure using ALLOC.
2354 BIT is the type size in bits. NAME is the type name. */
2356 extern struct type
*init_decfloat_type (type_allocator
&alloc
, int bit
,
2359 extern bool can_create_complex_type (struct type
*);
2360 extern struct type
*init_complex_type (const char *, struct type
*);
2362 /* Allocate a TYPE_CODE_PTR type structure using ALLOC.
2363 BIT is the pointer type size in bits. NAME is the type name.
2364 TARGET_TYPE is the pointer target type. Always sets the pointer type's
2365 TYPE_UNSIGNED flag. */
2367 extern struct type
*init_pointer_type (type_allocator
&alloc
, int bit
,
2369 struct type
*target_type
);
2371 extern struct type
*init_fixed_point_type (type_allocator
&, int, int,
2374 /* Helper functions to construct a struct or record type. An
2375 initially empty type is created using arch_composite_type().
2376 Fields are then added using append_composite_type_field*(). A union
2377 type has its size set to the largest field. A struct type has each
2378 field packed against the previous. */
2380 extern struct type
*arch_composite_type (struct gdbarch
*gdbarch
,
2381 const char *name
, enum type_code code
);
2382 extern void append_composite_type_field (struct type
*t
, const char *name
,
2383 struct type
*field
);
2384 extern void append_composite_type_field_aligned (struct type
*t
,
2388 struct field
*append_composite_type_field_raw (struct type
*t
, const char *name
,
2389 struct type
*field
);
2391 /* Helper functions to construct a bit flags type. An initially empty
2392 type is created using arch_flag_type(). Flags are then added using
2393 append_flag_type_field() and append_flag_type_flag(). */
2394 extern struct type
*arch_flags_type (struct gdbarch
*gdbarch
,
2395 const char *name
, int bit
);
2396 extern void append_flags_type_field (struct type
*type
,
2397 int start_bitpos
, int nr_bits
,
2398 struct type
*field_type
, const char *name
);
2399 extern void append_flags_type_flag (struct type
*type
, int bitpos
,
2402 extern void make_vector_type (struct type
*array_type
);
2403 extern struct type
*init_vector_type (struct type
*elt_type
, int n
);
2405 extern struct type
*lookup_reference_type (struct type
*, enum type_code
);
2406 extern struct type
*lookup_lvalue_reference_type (struct type
*);
2407 extern struct type
*lookup_rvalue_reference_type (struct type
*);
2410 extern struct type
*make_reference_type (struct type
*, struct type
**,
2413 extern struct type
*make_cv_type (int, int, struct type
*, struct type
**);
2415 extern struct type
*make_restrict_type (struct type
*);
2417 extern struct type
*make_unqualified_type (struct type
*);
2419 extern struct type
*make_atomic_type (struct type
*);
2421 extern void replace_type (struct type
*, struct type
*);
2423 extern type_instance_flags address_space_name_to_type_instance_flags
2424 (struct gdbarch
*, const char *);
2426 extern const char *address_space_type_instance_flags_to_name
2427 (struct gdbarch
*, type_instance_flags
);
2429 extern struct type
*make_type_with_address_space
2430 (struct type
*type
, type_instance_flags space_identifier
);
2432 extern struct type
*lookup_memberptr_type (struct type
*, struct type
*);
2434 extern struct type
*lookup_methodptr_type (struct type
*);
2436 extern void smash_to_method_type (struct type
*type
, struct type
*self_type
,
2437 struct type
*to_type
, struct field
*args
,
2438 int nargs
, int varargs
);
2440 extern void smash_to_memberptr_type (struct type
*, struct type
*,
2443 extern void smash_to_methodptr_type (struct type
*, struct type
*);
2445 extern const char *type_name_or_error (struct type
*type
);
2449 /* The field of the element, or NULL if no element was found. */
2450 struct field
*field
;
2452 /* The bit offset of the element in the parent structure. */
2456 /* Given a type TYPE, lookup the field and offset of the component named
2459 TYPE can be either a struct or union, or a pointer or reference to
2460 a struct or union. If it is a pointer or reference, its target
2461 type is automatically used. Thus '.' and '->' are interchangeable,
2462 as specified for the definitions of the expression element types
2463 STRUCTOP_STRUCT and STRUCTOP_PTR.
2465 If NOERR is nonzero, the returned structure will have field set to
2466 NULL if there is no component named NAME.
2468 If the component NAME is a field in an anonymous substructure of
2469 TYPE, the returned offset is a "global" offset relative to TYPE
2470 rather than an offset within the substructure. */
2472 extern struct_elt
lookup_struct_elt (struct type
*, const char *, int);
2474 /* Given a type TYPE, lookup the type of the component named NAME.
2476 TYPE can be either a struct or union, or a pointer or reference to
2477 a struct or union. If it is a pointer or reference, its target
2478 type is automatically used. Thus '.' and '->' are interchangeable,
2479 as specified for the definitions of the expression element types
2480 STRUCTOP_STRUCT and STRUCTOP_PTR.
2482 If NOERR is nonzero, return NULL if there is no component named
2485 extern struct type
*lookup_struct_elt_type (struct type
*, const char *, int);
2487 extern struct type
*make_pointer_type (struct type
*, struct type
**);
2489 extern struct type
*lookup_pointer_type (struct type
*);
2491 extern struct type
*make_function_type (struct type
*, struct type
**);
2493 extern struct type
*lookup_function_type (struct type
*);
2495 extern struct type
*lookup_function_type_with_arguments (struct type
*,
2499 /* Create a range type using ALLOC.
2501 Indices will be of type INDEX_TYPE, and will range from LOW_BOUND
2502 to HIGH_BOUND, inclusive. */
2504 extern struct type
*create_static_range_type (type_allocator
&alloc
,
2505 struct type
*index_type
,
2507 LONGEST high_bound
);
2509 /* Create an array type using ALLOC.
2511 Elements will be of type ELEMENT_TYPE, the indices will be of type
2514 BYTE_STRIDE_PROP, when not NULL, provides the array's byte stride.
2515 This byte stride property is added to the resulting array type
2516 as a DYN_PROP_BYTE_STRIDE. As a consequence, the BYTE_STRIDE_PROP
2517 argument can only be used to create types that are objfile-owned
2518 (see add_dyn_prop), meaning that either this function must be called
2519 with an objfile-owned RESULT_TYPE, or an objfile-owned RANGE_TYPE.
2521 BIT_STRIDE is taken into account only when BYTE_STRIDE_PROP is NULL.
2522 If BIT_STRIDE is not zero, build a packed array type whose element
2523 size is BIT_STRIDE. Otherwise, ignore this parameter. */
2525 extern struct type
*create_array_type_with_stride
2526 (type_allocator
&alloc
, struct type
*element_type
,
2527 struct type
*range_type
, struct dynamic_prop
*byte_stride_prop
,
2528 unsigned int bit_stride
);
2530 /* Create a range type using ALLOC with a dynamic range from LOW_BOUND
2531 to HIGH_BOUND, inclusive. INDEX_TYPE is the underlying type. BIAS
2532 is the bias to be applied when storing or retrieving values of this
2535 extern struct type
*create_range_type (type_allocator
&alloc
,
2536 struct type
*index_type
,
2537 const struct dynamic_prop
*low_bound
,
2538 const struct dynamic_prop
*high_bound
,
2541 /* Like CREATE_RANGE_TYPE but also sets up a stride. When BYTE_STRIDE_P
2542 is true the value in STRIDE is a byte stride, otherwise STRIDE is a bit
2545 extern struct type
*create_range_type_with_stride
2546 (type_allocator
&alloc
, struct type
*index_type
,
2547 const struct dynamic_prop
*low_bound
,
2548 const struct dynamic_prop
*high_bound
, LONGEST bias
,
2549 const struct dynamic_prop
*stride
, bool byte_stride_p
);
2551 /* Same as create_array_type_with_stride but with no bit_stride
2552 (BIT_STRIDE = 0), thus building an unpacked array. */
2554 extern struct type
*create_array_type (type_allocator
&alloc
,
2555 struct type
*element_type
,
2556 struct type
*range_type
);
2558 extern struct type
*lookup_array_range_type (struct type
*, LONGEST
, LONGEST
);
2560 /* Create a string type using ALLOC. String types are similar enough
2561 to array of char types that we can use create_array_type to build
2562 the basic type and then bash it into a string type.
2564 For fixed length strings, the range type contains 0 as the lower
2565 bound and the length of the string minus one as the upper bound. */
2567 extern struct type
*create_string_type (type_allocator
&alloc
,
2568 struct type
*string_char_type
,
2569 struct type
*range_type
);
2571 extern struct type
*lookup_string_range_type (struct type
*, LONGEST
, LONGEST
);
2573 extern struct type
*create_set_type (type_allocator
&alloc
,
2574 struct type
*domain_type
);
2576 extern struct type
*lookup_unsigned_typename (const struct language_defn
*,
2579 extern struct type
*lookup_signed_typename (const struct language_defn
*,
2582 extern ULONGEST
get_unsigned_type_max (struct type
*);
2584 extern void get_signed_type_minmax (struct type
*, LONGEST
*, LONGEST
*);
2586 extern CORE_ADDR
get_pointer_type_max (struct type
*);
2588 /* * Resolve all dynamic values of a type e.g. array bounds to static values.
2589 ADDR specifies the location of the variable the type is bound to.
2590 If TYPE has no dynamic properties return TYPE; otherwise a new type with
2591 static properties is returned.
2593 If FRAME is given, it is used when evaluating dynamic properties.
2594 This can be important when a static link is seen. If not given,
2595 the selected frame is used.
2597 For an array type, if the element type is dynamic, then that will
2598 not be resolved. This is done because each individual element may
2599 have a different type when resolved (depending on the contents of
2600 memory). In this situation, 'is_dynamic_type' will still return
2601 true for the return value of this function. */
2602 extern struct type
*resolve_dynamic_type
2603 (struct type
*type
, gdb::array_view
<const gdb_byte
> valaddr
,
2604 CORE_ADDR addr
, const frame_info_ptr
*frame
= nullptr);
2606 /* * Predicate if the type has dynamic values, which are not resolved yet.
2607 See the caveat in 'resolve_dynamic_type' to understand a scenario
2608 where an apparently-resolved type may still be considered
2610 extern int is_dynamic_type (struct type
*type
);
2612 extern struct type
*check_typedef (struct type
*);
2614 extern void check_stub_method_group (struct type
*, int);
2616 extern char *gdb_mangle_name (struct type
*, int, int);
2618 /* Lookup a typedef or primitive type named NAME, visible in lexical block
2619 BLOCK. If NOERR is nonzero, return zero if NAME is not suitably
2622 If this function finds a suitable type then check_typedef is called on
2623 the type, this ensures that if the type being returned is a typedef
2624 then the length of the type will be correct. The original typedef will
2625 still be returned, not the result of calling check_typedef. */
2627 extern struct type
*lookup_typename (const struct language_defn
*language
,
2629 const struct block
*block
, int noerr
);
2631 extern struct type
*lookup_template_type (const char *, struct type
*,
2632 const struct block
*);
2634 extern int get_vptr_fieldno (struct type
*, struct type
**);
2636 /* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type
2639 Return true if the two bounds are available, false otherwise. */
2641 extern bool get_discrete_bounds (struct type
*type
, LONGEST
*lowp
,
2644 /* If TYPE's low bound is a known constant, return it, else return nullopt. */
2646 extern std::optional
<LONGEST
> get_discrete_low_bound (struct type
*type
);
2648 /* If TYPE's high bound is a known constant, return it, else return nullopt. */
2650 extern std::optional
<LONGEST
> get_discrete_high_bound (struct type
*type
);
2652 /* Assuming TYPE is a simple, non-empty array type, compute its upper
2653 and lower bound. Save the low bound into LOW_BOUND if not NULL.
2654 Save the high bound into HIGH_BOUND if not NULL.
2656 Return true if the operation was successful. Return false otherwise,
2657 in which case the values of LOW_BOUND and HIGH_BOUNDS are unmodified. */
2659 extern bool get_array_bounds (struct type
*type
, LONGEST
*low_bound
,
2660 LONGEST
*high_bound
);
2662 extern std::optional
<LONGEST
> discrete_position (struct type
*type
,
2665 extern int class_types_same_p (const struct type
*, const struct type
*);
2667 extern int is_ancestor (struct type
*, struct type
*);
2669 extern int is_public_ancestor (struct type
*, struct type
*);
2671 extern int is_unique_ancestor (struct type
*, struct value
*);
2673 /* Overload resolution */
2675 /* * Badness if parameter list length doesn't match arg list length. */
2676 extern const struct rank LENGTH_MISMATCH_BADNESS
;
2678 /* * Dummy badness value for nonexistent parameter positions. */
2679 extern const struct rank TOO_FEW_PARAMS_BADNESS
;
2680 /* * Badness if no conversion among types. */
2681 extern const struct rank INCOMPATIBLE_TYPE_BADNESS
;
2683 /* * Badness of an exact match. */
2684 extern const struct rank EXACT_MATCH_BADNESS
;
2686 /* * Badness of integral promotion. */
2687 extern const struct rank INTEGER_PROMOTION_BADNESS
;
2688 /* * Badness of floating promotion. */
2689 extern const struct rank FLOAT_PROMOTION_BADNESS
;
2690 /* * Badness of converting a derived class pointer
2691 to a base class pointer. */
2692 extern const struct rank BASE_PTR_CONVERSION_BADNESS
;
2693 /* * Badness of integral conversion. */
2694 extern const struct rank INTEGER_CONVERSION_BADNESS
;
2695 /* * Badness of floating conversion. */
2696 extern const struct rank FLOAT_CONVERSION_BADNESS
;
2697 /* * Badness of integer<->floating conversions. */
2698 extern const struct rank INT_FLOAT_CONVERSION_BADNESS
;
2699 /* * Badness of conversion of pointer to void pointer. */
2700 extern const struct rank VOID_PTR_CONVERSION_BADNESS
;
2701 /* * Badness of conversion to boolean. */
2702 extern const struct rank BOOL_CONVERSION_BADNESS
;
2703 /* * Badness of converting derived to base class. */
2704 extern const struct rank BASE_CONVERSION_BADNESS
;
2705 /* * Badness of converting from non-reference to reference. Subrank
2706 is the type of reference conversion being done. */
2707 extern const struct rank REFERENCE_CONVERSION_BADNESS
;
2708 extern const struct rank REFERENCE_SEE_THROUGH_BADNESS
;
2709 /* * Conversion to rvalue reference. */
2710 #define REFERENCE_CONVERSION_RVALUE 1
2711 /* * Conversion to const lvalue reference. */
2712 #define REFERENCE_CONVERSION_CONST_LVALUE 2
2714 /* * Badness of converting integer 0 to NULL pointer. */
2715 extern const struct rank NULL_POINTER_CONVERSION
;
2716 /* * Badness of cv-conversion. Subrank is a flag describing the conversions
2718 extern const struct rank CV_CONVERSION_BADNESS
;
2719 #define CV_CONVERSION_CONST 1
2720 #define CV_CONVERSION_VOLATILE 2
2722 /* Non-standard conversions allowed by the debugger */
2724 /* * Converting a pointer to an int is usually OK. */
2725 extern const struct rank NS_POINTER_CONVERSION_BADNESS
;
2727 /* * Badness of converting a (non-zero) integer constant
2729 extern const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS
;
2731 extern struct rank
sum_ranks (struct rank a
, struct rank b
);
2732 extern int compare_ranks (struct rank a
, struct rank b
);
2734 extern int compare_badness (const badness_vector
&,
2735 const badness_vector
&);
2737 extern badness_vector
rank_function (gdb::array_view
<type
*> parms
,
2738 gdb::array_view
<value
*> args
);
2740 extern struct rank
rank_one_type (struct type
*, struct type
*,
2743 extern void recursive_dump_type (struct type
*, int);
2747 extern void print_scalar_formatted (const gdb_byte
*, struct type
*,
2748 const struct value_print_options
*,
2749 int, struct ui_file
*);
2751 extern int can_dereference (struct type
*);
2753 extern int is_integral_type (struct type
*);
2755 extern int is_floating_type (struct type
*);
2757 extern int is_scalar_type (struct type
*type
);
2759 extern int is_scalar_type_recursive (struct type
*);
2761 extern int class_or_union_p (const struct type
*);
2763 extern void maintenance_print_type (const char *, int);
2765 extern htab_up
create_copied_types_hash ();
2767 extern struct type
*copy_type_recursive (struct type
*type
,
2768 htab_t copied_types
);
2770 extern struct type
*copy_type (const struct type
*type
);
2772 extern bool types_equal (struct type
*, struct type
*);
2774 extern bool types_deeply_equal (struct type
*, struct type
*);
2776 extern int type_not_allocated (const struct type
*type
);
2778 extern int type_not_associated (const struct type
*type
);
2780 /* Return True if TYPE is a TYPE_CODE_FIXED_POINT or if TYPE is
2781 a range type whose base type is a TYPE_CODE_FIXED_POINT. */
2782 extern bool is_fixed_point_type (struct type
*type
);
2784 /* Allocate a fixed-point type info for TYPE. This should only be
2785 called by INIT_FIXED_POINT_SPECIFIC. */
2786 extern void allocate_fixed_point_type_info (struct type
*type
);
2788 /* * When the type includes explicit byte ordering, return that.
2789 Otherwise, the byte ordering from gdbarch_byte_order for
2790 the type's arch is returned. */
2792 extern enum bfd_endian
type_byte_order (const struct type
*type
);
2794 /* A flag to enable printing of debugging information of C++
2797 extern unsigned int overload_debug
;
2799 /* Return whether the function type represented by TYPE is marked as unsafe
2800 to call by the debugger.
2802 This usually indicates that the function does not follow the target's
2803 standard calling convention. */
2805 extern bool is_nocall_function (const struct type
*type
);
2807 #endif /* GDBTYPES_H */