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"
50 #include "gdbsupport/gdb_optional.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 /* Some macros for char-based bitfields. */
71 #define B_SET(a,x) ((a)[(x)>>3] |= (1 << ((x)&7)))
72 #define B_CLR(a,x) ((a)[(x)>>3] &= ~(1 << ((x)&7)))
73 #define B_TST(a,x) ((a)[(x)>>3] & (1 << ((x)&7)))
74 #define B_TYPE unsigned char
75 #define B_BYTES(x) ( 1 + ((x)>>3) )
76 #define B_CLRALL(a,x) memset ((a), 0, B_BYTES(x))
78 /* * Different kinds of data types are distinguished by the `code'
83 TYPE_CODE_UNDEF
= 0, /**< Not used; catches errors */
86 #include "type-codes.def"
91 /* * Some bits for the type's instance_flags word. See the macros
92 below for documentation on each bit. */
94 enum type_instance_flag_value
: unsigned
96 TYPE_INSTANCE_FLAG_CONST
= (1 << 0),
97 TYPE_INSTANCE_FLAG_VOLATILE
= (1 << 1),
98 TYPE_INSTANCE_FLAG_CODE_SPACE
= (1 << 2),
99 TYPE_INSTANCE_FLAG_DATA_SPACE
= (1 << 3),
100 TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
= (1 << 4),
101 TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2
= (1 << 5),
102 TYPE_INSTANCE_FLAG_NOTTEXT
= (1 << 6),
103 TYPE_INSTANCE_FLAG_RESTRICT
= (1 << 7),
104 TYPE_INSTANCE_FLAG_ATOMIC
= (1 << 8)
107 DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value
, type_instance_flags
);
109 /* * Not textual. By default, GDB treats all single byte integers as
110 characters (or elements of strings) unless this flag is set. */
112 #define TYPE_NOTTEXT(t) (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_NOTTEXT)
114 /* * Constant type. If this is set, the corresponding type has a
117 #define TYPE_CONST(t) ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CONST) != 0)
119 /* * Volatile type. If this is set, the corresponding type has a
120 volatile modifier. */
122 #define TYPE_VOLATILE(t) \
123 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_VOLATILE) != 0)
125 /* * Restrict type. If this is set, the corresponding type has a
126 restrict modifier. */
128 #define TYPE_RESTRICT(t) \
129 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_RESTRICT) != 0)
131 /* * Atomic type. If this is set, the corresponding type has an
134 #define TYPE_ATOMIC(t) \
135 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_ATOMIC) != 0)
137 /* * True if this type represents either an lvalue or lvalue reference type. */
139 #define TYPE_IS_REFERENCE(t) \
140 ((t)->code () == TYPE_CODE_REF || (t)->code () == TYPE_CODE_RVALUE_REF)
142 /* * True if this type is allocatable. */
143 #define TYPE_IS_ALLOCATABLE(t) \
144 ((t)->dyn_prop (DYN_PROP_ALLOCATED) != NULL)
146 /* * True if this type has variant parts. */
147 #define TYPE_HAS_VARIANT_PARTS(t) \
148 ((t)->dyn_prop (DYN_PROP_VARIANT_PARTS) != nullptr)
150 /* * True if this type has a dynamic length. */
151 #define TYPE_HAS_DYNAMIC_LENGTH(t) \
152 ((t)->dyn_prop (DYN_PROP_BYTE_SIZE) != nullptr)
154 /* * Instruction-space delimited type. This is for Harvard architectures
155 which have separate instruction and data address spaces (and perhaps
158 GDB usually defines a flat address space that is a superset of the
159 architecture's two (or more) address spaces, but this is an extension
160 of the architecture's model.
162 If TYPE_INSTANCE_FLAG_CODE_SPACE is set, an object of the corresponding type
163 resides in instruction memory, even if its address (in the extended
164 flat address space) does not reflect this.
166 Similarly, if TYPE_INSTANCE_FLAG_DATA_SPACE is set, then an object of the
167 corresponding type resides in the data memory space, even if
168 this is not indicated by its (flat address space) address.
170 If neither flag is set, the default space for functions / methods
171 is instruction space, and for data objects is data memory. */
173 #define TYPE_CODE_SPACE(t) \
174 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CODE_SPACE) != 0)
176 #define TYPE_DATA_SPACE(t) \
177 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_DATA_SPACE) != 0)
179 /* * Address class flags. Some environments provide for pointers
180 whose size is different from that of a normal pointer or address
181 types where the bits are interpreted differently than normal
182 addresses. The TYPE_INSTANCE_FLAG_ADDRESS_CLASS_n flags may be used in
183 target specific ways to represent these different types of address
186 #define TYPE_ADDRESS_CLASS_1(t) (((t)->instance_flags ()) \
187 & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
188 #define TYPE_ADDRESS_CLASS_2(t) (((t)->instance_flags ()) \
189 & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
190 #define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL \
191 (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
192 #define TYPE_ADDRESS_CLASS_ALL(t) (((t)->instance_flags ()) \
193 & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
195 /* * Information about a single discriminant. */
197 struct discriminant_range
199 /* * The range of values for the variant. This is an inclusive
203 /* * Return true if VALUE is contained in this range. IS_UNSIGNED
204 is true if this should be an unsigned comparison; false for
206 bool contains (ULONGEST value
, bool is_unsigned
) const
209 return value
>= low
&& value
<= high
;
210 LONGEST valuel
= (LONGEST
) value
;
211 return valuel
>= (LONGEST
) low
&& valuel
<= (LONGEST
) high
;
217 /* * A single variant. A variant has a list of discriminant values.
218 When the discriminator matches one of these, the variant is
219 enabled. Each variant controls zero or more fields; and may also
220 control other variant parts as well. This struct corresponds to
221 DW_TAG_variant in DWARF. */
223 struct variant
: allocate_on_obstack
225 /* * The discriminant ranges for this variant. */
226 gdb::array_view
<discriminant_range
> discriminants
;
228 /* * The fields controlled by this variant. This is inclusive on
229 the low end and exclusive on the high end. A variant may not
230 control any fields, in which case the two values will be equal.
231 These are indexes into the type's array of fields. */
235 /* * Variant parts controlled by this variant. */
236 gdb::array_view
<variant_part
> parts
;
238 /* * Return true if this is the default variant. The default
239 variant can be recognized because it has no associated
241 bool is_default () const
243 return discriminants
.empty ();
246 /* * Return true if this variant matches VALUE. IS_UNSIGNED is true
247 if this should be an unsigned comparison; false for signed. */
248 bool matches (ULONGEST value
, bool is_unsigned
) const;
251 /* * A variant part. Each variant part has an optional discriminant
252 and holds an array of variants. This struct corresponds to
253 DW_TAG_variant_part in DWARF. */
255 struct variant_part
: allocate_on_obstack
257 /* * The index of the discriminant field in the outer type. This is
258 an index into the type's array of fields. If this is -1, there
259 is no discriminant, and only the default variant can be
260 considered to be selected. */
261 int discriminant_index
;
263 /* * True if this discriminant is unsigned; false if signed. This
264 comes from the type of the discriminant. */
267 /* * The variants that are controlled by this variant part. Note
268 that these will always be sorted by field number. */
269 gdb::array_view
<variant
> variants
;
273 enum dynamic_prop_kind
275 PROP_UNDEFINED
, /* Not defined. */
276 PROP_CONST
, /* Constant. */
277 PROP_ADDR_OFFSET
, /* Address offset. */
278 PROP_LOCEXPR
, /* Location expression. */
279 PROP_LOCLIST
, /* Location list. */
280 PROP_VARIANT_PARTS
, /* Variant parts. */
281 PROP_TYPE
, /* Type. */
282 PROP_VARIABLE_NAME
, /* Variable name. */
285 union dynamic_prop_data
287 /* Storage for constant property. */
291 /* Storage for dynamic property. */
293 const dwarf2_property_baton
*baton
;
295 /* Storage of variant parts for a type. A type with variant parts
296 has all its fields "linearized" -- stored in a single field
297 array, just as if they had all been declared that way. The
298 variant parts are attached via a dynamic property, and then are
299 used to control which fields end up in the final type during
300 dynamic type resolution. */
302 const gdb::array_view
<variant_part
> *variant_parts
;
304 /* Once a variant type is resolved, we may want to be able to go
305 from the resolved type to the original type. In this case we
306 rewrite the property's kind and set this field. */
308 struct type
*original_type
;
310 /* Name of a variable to look up; the variable holds the value of
313 const char *variable_name
;
316 /* * Used to store a dynamic property. */
320 dynamic_prop_kind
kind () const
325 void set_undefined ()
327 m_kind
= PROP_UNDEFINED
;
330 LONGEST
const_val () const
332 gdb_assert (m_kind
== PROP_CONST
);
334 return m_data
.const_val
;
337 void set_const_val (LONGEST const_val
)
340 m_data
.const_val
= const_val
;
343 const dwarf2_property_baton
*baton () const
345 gdb_assert (m_kind
== PROP_LOCEXPR
346 || m_kind
== PROP_LOCLIST
347 || m_kind
== PROP_ADDR_OFFSET
);
352 void set_locexpr (const dwarf2_property_baton
*baton
)
354 m_kind
= PROP_LOCEXPR
;
355 m_data
.baton
= baton
;
358 void set_loclist (const dwarf2_property_baton
*baton
)
360 m_kind
= PROP_LOCLIST
;
361 m_data
.baton
= baton
;
364 void set_addr_offset (const dwarf2_property_baton
*baton
)
366 m_kind
= PROP_ADDR_OFFSET
;
367 m_data
.baton
= baton
;
370 const gdb::array_view
<variant_part
> *variant_parts () const
372 gdb_assert (m_kind
== PROP_VARIANT_PARTS
);
374 return m_data
.variant_parts
;
377 void set_variant_parts (gdb::array_view
<variant_part
> *variant_parts
)
379 m_kind
= PROP_VARIANT_PARTS
;
380 m_data
.variant_parts
= variant_parts
;
383 struct type
*original_type () const
385 gdb_assert (m_kind
== PROP_TYPE
);
387 return m_data
.original_type
;
390 void set_original_type (struct type
*original_type
)
393 m_data
.original_type
= original_type
;
396 /* Return the name of the variable that holds this property's value.
397 Only valid for PROP_VARIABLE_NAME. */
398 const char *variable_name () const
400 gdb_assert (m_kind
== PROP_VARIABLE_NAME
);
401 return m_data
.variable_name
;
404 /* Set the name of the variable that holds this property's value,
405 and set this property to be of kind PROP_VARIABLE_NAME. */
406 void set_variable_name (const char *name
)
408 m_kind
= PROP_VARIABLE_NAME
;
409 m_data
.variable_name
= name
;
412 /* Determine which field of the union dynamic_prop.data is used. */
413 enum dynamic_prop_kind m_kind
;
415 /* Storage for dynamic or static value. */
416 union dynamic_prop_data m_data
;
419 /* Compare two dynamic_prop objects for equality. dynamic_prop
420 instances are equal iff they have the same type and storage. */
421 extern bool operator== (const dynamic_prop
&l
, const dynamic_prop
&r
);
423 /* Compare two dynamic_prop objects for inequality. */
424 static inline bool operator!= (const dynamic_prop
&l
, const dynamic_prop
&r
)
429 /* * Define a type's dynamic property node kind. */
430 enum dynamic_prop_node_kind
432 /* A property providing a type's data location.
433 Evaluating this field yields to the location of an object's data. */
434 DYN_PROP_DATA_LOCATION
,
436 /* A property representing DW_AT_allocated. The presence of this attribute
437 indicates that the object of the type can be allocated/deallocated. */
440 /* A property representing DW_AT_associated. The presence of this attribute
441 indicated that the object of the type can be associated. */
444 /* A property providing an array's byte stride. */
445 DYN_PROP_BYTE_STRIDE
,
447 /* A property holding variant parts. */
448 DYN_PROP_VARIANT_PARTS
,
450 /* A property representing DW_AT_rank. The presence of this attribute
451 indicates that the object is of assumed rank array type. */
454 /* A property holding the size of the type. */
458 /* * List for dynamic type attributes. */
459 struct dynamic_prop_list
461 /* The kind of dynamic prop in this node. */
462 enum dynamic_prop_node_kind prop_kind
;
464 /* The dynamic property itself. */
465 struct dynamic_prop prop
;
467 /* A pointer to the next dynamic property. */
468 struct dynamic_prop_list
*next
;
471 /* * Determine which field of the union main_type.fields[x].loc is
476 FIELD_LOC_KIND_BITPOS
, /**< bitpos */
477 FIELD_LOC_KIND_ENUMVAL
, /**< enumval */
478 FIELD_LOC_KIND_PHYSADDR
, /**< physaddr */
479 FIELD_LOC_KIND_PHYSNAME
, /**< physname */
480 FIELD_LOC_KIND_DWARF_BLOCK
/**< dwarf_block */
483 /* * A discriminant to determine which field in the
484 main_type.type_specific union is being used, if any.
486 For types such as TYPE_CODE_FLT, the use of this
487 discriminant is really redundant, as we know from the type code
488 which field is going to be used. As such, it would be possible to
489 reduce the size of this enum in order to save a bit or two for
490 other fields of struct main_type. But, since we still have extra
491 room , and for the sake of clarity and consistency, we treat all fields
492 of the union the same way. */
494 enum type_specific_kind
497 TYPE_SPECIFIC_CPLUS_STUFF
,
498 TYPE_SPECIFIC_GNAT_STUFF
,
499 TYPE_SPECIFIC_FLOATFORMAT
,
500 /* Note: This is used by TYPE_CODE_FUNC and TYPE_CODE_METHOD. */
502 TYPE_SPECIFIC_SELF_TYPE
,
504 TYPE_SPECIFIC_FIXED_POINT
,
509 struct objfile
*objfile
;
510 struct gdbarch
*gdbarch
;
515 /* * Position of this field, counting in bits from start of
516 containing structure. For big-endian targets, it is the bit
517 offset to the MSB. For little-endian targets, it is the bit
518 offset to the LSB. */
525 /* * For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then
526 physaddr is the location (in the target) of the static
527 field. Otherwise, physname is the mangled label of the
531 const char *physname
;
533 /* * The field location can be computed by evaluating the
534 following DWARF block. Its DATA is allocated on
535 objfile_obstack - no CU load is needed to access it. */
537 struct dwarf2_locexpr_baton
*dwarf_block
;
542 struct type
*type () const
547 void set_type (struct type
*type
)
552 const char *name () const
557 void set_name (const char *name
)
562 /* Location getters / setters. */
564 field_loc_kind
loc_kind () const
569 LONGEST
loc_bitpos () const
571 gdb_assert (m_loc_kind
== FIELD_LOC_KIND_BITPOS
);
575 void set_loc_bitpos (LONGEST bitpos
)
577 m_loc_kind
= FIELD_LOC_KIND_BITPOS
;
578 m_loc
.bitpos
= bitpos
;
581 LONGEST
loc_enumval () const
583 gdb_assert (m_loc_kind
== FIELD_LOC_KIND_ENUMVAL
);
584 return m_loc
.enumval
;
587 void set_loc_enumval (LONGEST enumval
)
589 m_loc_kind
= FIELD_LOC_KIND_ENUMVAL
;
590 m_loc
.enumval
= enumval
;
593 CORE_ADDR
loc_physaddr () const
595 gdb_assert (m_loc_kind
== FIELD_LOC_KIND_PHYSADDR
);
596 return m_loc
.physaddr
;
599 void set_loc_physaddr (CORE_ADDR physaddr
)
601 m_loc_kind
= FIELD_LOC_KIND_PHYSADDR
;
602 m_loc
.physaddr
= physaddr
;
605 const char *loc_physname () const
607 gdb_assert (m_loc_kind
== FIELD_LOC_KIND_PHYSNAME
);
608 return m_loc
.physname
;
611 void set_loc_physname (const char *physname
)
613 m_loc_kind
= FIELD_LOC_KIND_PHYSNAME
;
614 m_loc
.physname
= physname
;
617 dwarf2_locexpr_baton
*loc_dwarf_block () const
619 gdb_assert (m_loc_kind
== FIELD_LOC_KIND_DWARF_BLOCK
);
620 return m_loc
.dwarf_block
;
623 void set_loc_dwarf_block (dwarf2_locexpr_baton
*dwarf_block
)
625 m_loc_kind
= FIELD_LOC_KIND_DWARF_BLOCK
;
626 m_loc
.dwarf_block
= dwarf_block
;
629 union field_location m_loc
;
631 /* * For a function or member type, this is 1 if the argument is
632 marked artificial. Artificial arguments should not be shown
633 to the user. For TYPE_CODE_RANGE it is set if the specific
634 bound is not defined. */
636 unsigned int artificial
: 1;
638 /* * Discriminant for union field_location. */
640 ENUM_BITFIELD(field_loc_kind
) m_loc_kind
: 3;
642 /* * Size of this field, in bits, or zero if not packed.
643 If non-zero in an array type, indicates the element size in
644 bits (used only in Ada at the moment).
645 For an unpacked field, the field's type's length
646 says how many bytes the field occupies. */
648 unsigned int bitsize
: 28;
650 /* * In a struct or union type, type of this field.
651 - In a function or member type, type of this argument.
652 - In an array type, the domain-type of the array. */
656 /* * Name of field, value or argument.
657 NULL for range bounds, array domains, and member function
665 ULONGEST
bit_stride () const
667 if (this->flag_is_byte_stride
)
668 return this->stride
.const_val () * 8;
670 return this->stride
.const_val ();
673 /* * Low bound of range. */
675 struct dynamic_prop low
;
677 /* * High bound of range. */
679 struct dynamic_prop high
;
681 /* The stride value for this range. This can be stored in bits or bytes
682 based on the value of BYTE_STRIDE_P. It is optional to have a stride
683 value, if this range has no stride value defined then this will be set
684 to the constant zero. */
686 struct dynamic_prop stride
;
688 /* * The bias. Sometimes a range value is biased before storage.
689 The bias is added to the stored bits to form the true value. */
693 /* True if HIGH range bound contains the number of elements in the
694 subrange. This affects how the final high bound is computed. */
696 unsigned int flag_upper_bound_is_count
: 1;
698 /* True if LOW or/and HIGH are resolved into a static bound from
701 unsigned int flag_bound_evaluated
: 1;
703 /* If this is true this STRIDE is in bytes, otherwise STRIDE is in bits. */
705 unsigned int flag_is_byte_stride
: 1;
708 /* Compare two range_bounds objects for equality. Simply does
709 memberwise comparison. */
710 extern bool operator== (const range_bounds
&l
, const range_bounds
&r
);
712 /* Compare two range_bounds objects for inequality. */
713 static inline bool operator!= (const range_bounds
&l
, const range_bounds
&r
)
720 /* * CPLUS_STUFF is for TYPE_CODE_STRUCT. It is initialized to
721 point to cplus_struct_default, a default static instance of a
722 struct cplus_struct_type. */
724 struct cplus_struct_type
*cplus_stuff
;
726 /* * GNAT_STUFF is for types for which the GNAT Ada compiler
727 provides additional information. */
729 struct gnat_aux_type
*gnat_stuff
;
731 /* * FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to a
732 floatformat object that describes the floating-point value
733 that resides within the type. */
735 const struct floatformat
*floatformat
;
737 /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types. */
739 struct func_type
*func_stuff
;
741 /* * For types that are pointer to member types (TYPE_CODE_METHODPTR,
742 TYPE_CODE_MEMBERPTR), SELF_TYPE is the type that this pointer
745 struct type
*self_type
;
747 /* * For TYPE_CODE_FIXED_POINT types, the info necessary to decode
748 values of that type. */
749 struct fixed_point_type_info
*fixed_point_info
;
751 /* * An integer-like scalar type may be stored in just part of its
752 enclosing storage bytes. This structure describes this
756 /* * The bit size of the integer. This can be 0. For integers
757 that fill their storage (the ordinary case), this field holds
758 the byte size times 8. */
759 unsigned short bit_size
;
760 /* * The bit offset of the integer. This is ordinarily 0, and can
761 only be non-zero if the bit size is less than the storage
763 unsigned short bit_offset
;
767 /* * Main structure representing a type in GDB.
769 This structure is space-critical. Its layout has been tweaked to
770 reduce the space used. */
774 /* * Code for kind of type. */
776 ENUM_BITFIELD(type_code
) code
: 8;
778 /* * Flags about this type. These fields appear at this location
779 because they packs nicely here. See the TYPE_* macros for
780 documentation about these fields. */
782 unsigned int m_flag_unsigned
: 1;
783 unsigned int m_flag_nosign
: 1;
784 unsigned int m_flag_stub
: 1;
785 unsigned int m_flag_target_stub
: 1;
786 unsigned int m_flag_prototyped
: 1;
787 unsigned int m_flag_varargs
: 1;
788 unsigned int m_flag_vector
: 1;
789 unsigned int m_flag_stub_supported
: 1;
790 unsigned int m_flag_gnu_ifunc
: 1;
791 unsigned int m_flag_fixed_instance
: 1;
792 unsigned int m_flag_objfile_owned
: 1;
793 unsigned int m_flag_endianity_not_default
: 1;
795 /* * True if this type was declared with "class" rather than
798 unsigned int m_flag_declared_class
: 1;
800 /* * True if this is an enum type with disjoint values. This
801 affects how the enum is printed. */
803 unsigned int m_flag_flag_enum
: 1;
805 /* * For TYPE_CODE_ARRAY, this is true if this type is part of a
806 multi-dimensional array. Multi-dimensional arrays are
807 represented internally as arrays of arrays, and this flag lets
808 gdb distinguish between multiple dimensions and an ordinary array
809 of arrays. The flag is set on each inner dimension, but not the
810 outermost dimension. */
812 unsigned int m_multi_dimensional
: 1;
814 /* * A discriminant telling us which field of the type_specific
815 union is being used for this type, if any. */
817 ENUM_BITFIELD(type_specific_kind
) type_specific_field
: 3;
819 /* * Number of fields described for this type. This field appears
820 at this location because it packs nicely here. */
822 unsigned int m_nfields
;
824 /* * Name of this type, or NULL if none.
826 This is used for printing only. For looking up a name, look for
827 a symbol in the VAR_DOMAIN. This is generally allocated in the
828 objfile's obstack. However coffread.c uses malloc. */
832 /* * Every type is now associated with a particular objfile, and the
833 type is allocated on the objfile_obstack for that objfile. One
834 problem however, is that there are times when gdb allocates new
835 types while it is not in the process of reading symbols from a
836 particular objfile. Fortunately, these happen when the type
837 being created is a derived type of an existing type, such as in
838 lookup_pointer_type(). So we can just allocate the new type
839 using the same objfile as the existing type, but to do this we
840 need a backpointer to the objfile from the existing type. Yes
841 this is somewhat ugly, but without major overhaul of the internal
842 type system, it can't be avoided for now. */
844 union type_owner m_owner
;
846 /* * For a pointer type, describes the type of object pointed to.
847 - For an array type, describes the type of the elements.
848 - For a function or method type, describes the type of the return value.
849 - For a range type, describes the type of the full range.
850 - For a complex type, describes the type of each coordinate.
851 - For a special record or union type encoding a dynamic-sized type
852 in GNAT, a memoized pointer to a corresponding static version of
854 - Unused otherwise. */
856 struct type
*m_target_type
;
858 /* * For structure and union types, a description of each field.
859 For set and pascal array types, there is one "field",
860 whose type is the domain type of the set or array.
861 For range types, there are two "fields",
862 the minimum and maximum values (both inclusive).
863 For enum types, each possible value is described by one "field".
864 For a function or method type, a "field" for each parameter.
865 For C++ classes, there is one field for each base class (if it is
866 a derived class) plus one field for each class data member. Member
867 functions are recorded elsewhere.
869 Using a pointer to a separate array of fields
870 allows all types to have the same size, which is useful
871 because we can allocate the space for a type before
872 we know what to put in it. */
876 struct field
*fields
;
878 /* * Union member used for range types. */
880 struct range_bounds
*bounds
;
882 /* If this is a scalar type, then this is its corresponding
884 struct type
*complex_type
;
888 /* * Slot to point to additional language-specific fields of this
891 union type_specific type_specific
;
893 /* * Contains all dynamic type properties. */
894 struct dynamic_prop_list
*dyn_prop_list
;
897 /* * Number of bits allocated for alignment. */
899 #define TYPE_ALIGN_BITS 8
901 /* * A ``struct type'' describes a particular instance of a type, with
902 some particular qualification. */
906 /* Get the type code of this type.
908 Note that the code can be TYPE_CODE_TYPEDEF, so if you want the real
909 type, you need to do `check_typedef (type)->code ()`. */
910 type_code
code () const
912 return this->main_type
->code
;
915 /* Set the type code of this type. */
916 void set_code (type_code code
)
918 this->main_type
->code
= code
;
921 /* Get the name of this type. */
922 const char *name () const
924 return this->main_type
->name
;
927 /* Set the name of this type. */
928 void set_name (const char *name
)
930 this->main_type
->name
= name
;
933 /* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
934 But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
935 so you only have to call check_typedef once. Since value::allocate
936 calls check_typedef, X->type ()->length () is safe. */
937 ULONGEST
length () const
939 return this->m_length
;
942 void set_length (ULONGEST length
)
944 this->m_length
= length
;
947 /* Get the number of fields of this type. */
948 unsigned int num_fields () const
950 return this->main_type
->m_nfields
;
953 /* Set the number of fields of this type. */
954 void set_num_fields (unsigned int num_fields
)
956 this->main_type
->m_nfields
= num_fields
;
959 /* Get the fields array of this type. */
960 struct field
*fields () const
962 return this->main_type
->flds_bnds
.fields
;
965 /* Get the field at index IDX. */
966 struct field
&field (int idx
) const
968 gdb_assert (idx
>= 0 && idx
< num_fields ());
969 return this->fields ()[idx
];
972 /* Set the fields array of this type. */
973 void set_fields (struct field
*fields
)
975 this->main_type
->flds_bnds
.fields
= fields
;
978 type
*index_type () const
980 return this->field (0).type ();
983 struct type
*target_type () const
985 return this->main_type
->m_target_type
;
988 void set_target_type (struct type
*target_type
)
990 this->main_type
->m_target_type
= target_type
;
993 void set_index_type (type
*index_type
)
995 this->field (0).set_type (index_type
);
998 /* Return the instance flags converted to the correct type. */
999 const type_instance_flags
instance_flags () const
1001 return (enum type_instance_flag_value
) this->m_instance_flags
;
1004 /* Set the instance flags. */
1005 void set_instance_flags (type_instance_flags flags
)
1007 this->m_instance_flags
= flags
;
1010 /* Get the bounds bounds of this type. The type must be a range type. */
1011 range_bounds
*bounds () const
1013 switch (this->code ())
1015 case TYPE_CODE_RANGE
:
1016 return this->main_type
->flds_bnds
.bounds
;
1018 case TYPE_CODE_ARRAY
:
1019 case TYPE_CODE_STRING
:
1020 return this->index_type ()->bounds ();
1023 gdb_assert_not_reached
1024 ("type::bounds called on type with invalid code");
1028 /* Set the bounds of this type. The type must be a range type. */
1029 void set_bounds (range_bounds
*bounds
)
1031 gdb_assert (this->code () == TYPE_CODE_RANGE
);
1033 this->main_type
->flds_bnds
.bounds
= bounds
;
1036 ULONGEST
bit_stride () const
1038 if (this->code () == TYPE_CODE_ARRAY
&& this->field (0).bitsize
!= 0)
1039 return this->field (0).bitsize
;
1040 return this->bounds ()->bit_stride ();
1043 /* Unsigned integer type. If this is not set for a TYPE_CODE_INT,
1044 the type is signed (unless TYPE_NOSIGN is set). */
1046 bool is_unsigned () const
1048 return this->main_type
->m_flag_unsigned
;
1051 void set_is_unsigned (bool is_unsigned
)
1053 this->main_type
->m_flag_unsigned
= is_unsigned
;
1056 /* No sign for this type. In C++, "char", "signed char", and
1057 "unsigned char" are distinct types; so we need an extra flag to
1058 indicate the absence of a sign! */
1060 bool has_no_signedness () const
1062 return this->main_type
->m_flag_nosign
;
1065 void set_has_no_signedness (bool has_no_signedness
)
1067 this->main_type
->m_flag_nosign
= has_no_signedness
;
1070 /* This appears in a type's flags word if it is a stub type (e.g.,
1071 if someone referenced a type that wasn't defined in a source file
1072 via (struct sir_not_appearing_in_this_film *)). */
1074 bool is_stub () const
1076 return this->main_type
->m_flag_stub
;
1079 void set_is_stub (bool is_stub
)
1081 this->main_type
->m_flag_stub
= is_stub
;
1084 /* The target type of this type is a stub type, and this type needs
1085 to be updated if it gets un-stubbed in check_typedef. Used for
1086 arrays and ranges, in which TYPE_LENGTH of the array/range gets set
1087 based on the TYPE_LENGTH of the target type. Also, set for
1088 TYPE_CODE_TYPEDEF. */
1090 bool target_is_stub () const
1092 return this->main_type
->m_flag_target_stub
;
1095 void set_target_is_stub (bool target_is_stub
)
1097 this->main_type
->m_flag_target_stub
= target_is_stub
;
1100 /* This is a function type which appears to have a prototype. We
1101 need this for function calls in order to tell us if it's necessary
1102 to coerce the args, or to just do the standard conversions. This
1103 is used with a short field. */
1105 bool is_prototyped () const
1107 return this->main_type
->m_flag_prototyped
;
1110 void set_is_prototyped (bool is_prototyped
)
1112 this->main_type
->m_flag_prototyped
= is_prototyped
;
1115 /* FIXME drow/2002-06-03: Only used for methods, but applies as well
1118 bool has_varargs () const
1120 return this->main_type
->m_flag_varargs
;
1123 void set_has_varargs (bool has_varargs
)
1125 this->main_type
->m_flag_varargs
= has_varargs
;
1128 /* Identify a vector type. Gcc is handling this by adding an extra
1129 attribute to the array type. We slurp that in as a new flag of a
1130 type. This is used only in dwarf2read.c. */
1132 bool is_vector () const
1134 return this->main_type
->m_flag_vector
;
1137 void set_is_vector (bool is_vector
)
1139 this->main_type
->m_flag_vector
= is_vector
;
1142 /* This debug target supports TYPE_STUB(t). In the unsupported case
1143 we have to rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE().
1144 TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only
1145 guessed the TYPE_STUB(t) value (see dwarfread.c). */
1147 bool stub_is_supported () const
1149 return this->main_type
->m_flag_stub_supported
;
1152 void set_stub_is_supported (bool stub_is_supported
)
1154 this->main_type
->m_flag_stub_supported
= stub_is_supported
;
1157 /* Used only for TYPE_CODE_FUNC where it specifies the real function
1158 address is returned by this function call. The target_type method
1159 determines the final returned function type to be presented to
1162 bool is_gnu_ifunc () const
1164 return this->main_type
->m_flag_gnu_ifunc
;
1167 void set_is_gnu_ifunc (bool is_gnu_ifunc
)
1169 this->main_type
->m_flag_gnu_ifunc
= is_gnu_ifunc
;
1172 /* The debugging formats (especially STABS) do not contain enough
1173 information to represent all Ada types---especially those whose
1174 size depends on dynamic quantities. Therefore, the GNAT Ada
1175 compiler includes extra information in the form of additional type
1176 definitions connected by naming conventions. This flag indicates
1177 that the type is an ordinary (unencoded) GDB type that has been
1178 created from the necessary run-time information, and does not need
1179 further interpretation. Optionally marks ordinary, fixed-size GDB
1182 bool is_fixed_instance () const
1184 return this->main_type
->m_flag_fixed_instance
;
1187 void set_is_fixed_instance (bool is_fixed_instance
)
1189 this->main_type
->m_flag_fixed_instance
= is_fixed_instance
;
1192 /* A compiler may supply dwarf instrumentation that indicates the desired
1193 endian interpretation of the variable differs from the native endian
1196 bool endianity_is_not_default () const
1198 return this->main_type
->m_flag_endianity_not_default
;
1201 void set_endianity_is_not_default (bool endianity_is_not_default
)
1203 this->main_type
->m_flag_endianity_not_default
= endianity_is_not_default
;
1207 /* True if this type was declared using the "class" keyword. This is
1208 only valid for C++ structure and enum types. If false, a structure
1209 was declared as a "struct"; if true it was declared "class". For
1210 enum types, this is true when "enum class" or "enum struct" was
1211 used to declare the type. */
1213 bool is_declared_class () const
1215 return this->main_type
->m_flag_declared_class
;
1218 void set_is_declared_class (bool is_declared_class
) const
1220 this->main_type
->m_flag_declared_class
= is_declared_class
;
1223 /* True if this type is a "flag" enum. A flag enum is one where all
1224 the values are pairwise disjoint when "and"ed together. This
1225 affects how enum values are printed. */
1227 bool is_flag_enum () const
1229 return this->main_type
->m_flag_flag_enum
;
1232 void set_is_flag_enum (bool is_flag_enum
)
1234 this->main_type
->m_flag_flag_enum
= is_flag_enum
;
1237 /* True if this array type is part of a multi-dimensional array. */
1239 bool is_multi_dimensional () const
1241 return this->main_type
->m_multi_dimensional
;
1244 void set_is_multi_dimensional (bool value
)
1246 this->main_type
->m_multi_dimensional
= value
;
1249 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return a reference
1250 to this type's fixed_point_info. */
1252 struct fixed_point_type_info
&fixed_point_info () const
1254 gdb_assert (this->code () == TYPE_CODE_FIXED_POINT
);
1255 gdb_assert (this->main_type
->type_specific
.fixed_point_info
!= nullptr);
1257 return *this->main_type
->type_specific
.fixed_point_info
;
1260 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, set this type's
1261 fixed_point_info to INFO. */
1263 void set_fixed_point_info (struct fixed_point_type_info
*info
) const
1265 gdb_assert (this->code () == TYPE_CODE_FIXED_POINT
);
1267 this->main_type
->type_specific
.fixed_point_info
= info
;
1270 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return its base type.
1272 In other words, this returns the type after having peeled all
1273 intermediate type layers (such as TYPE_CODE_RANGE, for instance).
1274 The TYPE_CODE of the type returned is guaranteed to be
1275 a TYPE_CODE_FIXED_POINT. */
1277 struct type
*fixed_point_type_base_type ();
1279 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return its scaling
1282 const gdb_mpq
&fixed_point_scaling_factor ();
1284 /* * Return the dynamic property of the requested KIND from this type's
1285 list of dynamic properties. */
1286 dynamic_prop
*dyn_prop (dynamic_prop_node_kind kind
) const;
1288 /* * Given a dynamic property PROP of a given KIND, add this dynamic
1289 property to this type.
1291 This function assumes that this type is objfile-owned. */
1292 void add_dyn_prop (dynamic_prop_node_kind kind
, dynamic_prop prop
);
1294 /* * Remove dynamic property of kind KIND from this type, if it exists. */
1295 void remove_dyn_prop (dynamic_prop_node_kind kind
);
1297 /* Return true if this type is owned by an objfile. Return false if it is
1298 owned by an architecture. */
1299 bool is_objfile_owned () const
1301 return this->main_type
->m_flag_objfile_owned
;
1304 /* Set the owner of the type to be OBJFILE. */
1305 void set_owner (objfile
*objfile
)
1307 gdb_assert (objfile
!= nullptr);
1309 this->main_type
->m_owner
.objfile
= objfile
;
1310 this->main_type
->m_flag_objfile_owned
= true;
1313 /* Set the owner of the type to be ARCH. */
1314 void set_owner (gdbarch
*arch
)
1316 gdb_assert (arch
!= nullptr);
1318 this->main_type
->m_owner
.gdbarch
= arch
;
1319 this->main_type
->m_flag_objfile_owned
= false;
1322 /* Return the objfile owner of this type.
1324 Return nullptr if this type is not objfile-owned. */
1325 struct objfile
*objfile_owner () const
1327 if (!this->is_objfile_owned ())
1330 return this->main_type
->m_owner
.objfile
;
1333 /* Return the gdbarch owner of this type.
1335 Return nullptr if this type is not gdbarch-owned. */
1336 gdbarch
*arch_owner () const
1338 if (this->is_objfile_owned ())
1341 return this->main_type
->m_owner
.gdbarch
;
1344 /* Return the type's architecture. For types owned by an
1345 architecture, that architecture is returned. For types owned by an
1346 objfile, that objfile's architecture is returned.
1348 The return value is always non-nullptr. */
1349 gdbarch
*arch () const;
1351 /* * Return true if this is an integer type whose logical (bit) size
1352 differs from its storage size; false otherwise. Always return
1353 false for non-integer (i.e., non-TYPE_SPECIFIC_INT) types. */
1354 bool bit_size_differs_p () const
1356 return (main_type
->type_specific_field
== TYPE_SPECIFIC_INT
1357 && main_type
->type_specific
.int_stuff
.bit_size
!= 8 * length ());
1360 /* * Return the logical (bit) size for this integer type. Only
1361 valid for integer (TYPE_SPECIFIC_INT) types. */
1362 unsigned short bit_size () const
1364 gdb_assert (main_type
->type_specific_field
== TYPE_SPECIFIC_INT
);
1365 return main_type
->type_specific
.int_stuff
.bit_size
;
1368 /* * Return the bit offset for this integer type. Only valid for
1369 integer (TYPE_SPECIFIC_INT) types. */
1370 unsigned short bit_offset () const
1372 gdb_assert (main_type
->type_specific_field
== TYPE_SPECIFIC_INT
);
1373 return main_type
->type_specific
.int_stuff
.bit_offset
;
1376 /* Return true if this is a pointer or reference type. */
1377 bool is_pointer_or_reference () const
1379 return this->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (this);
1382 /* * Type that is a pointer to this type.
1383 NULL if no such pointer-to type is known yet.
1384 The debugger may add the address of such a type
1385 if it has to construct one later. */
1387 struct type
*pointer_type
;
1389 /* * C++: also need a reference type. */
1391 struct type
*reference_type
;
1393 /* * A C++ rvalue reference type added in C++11. */
1395 struct type
*rvalue_reference_type
;
1397 /* * Variant chain. This points to a type that differs from this
1398 one only in qualifiers and length. Currently, the possible
1399 qualifiers are const, volatile, code-space, data-space, and
1400 address class. The length may differ only when one of the
1401 address class flags are set. The variants are linked in a
1402 circular ring and share MAIN_TYPE. */
1406 /* * The alignment for this type. Zero means that the alignment was
1407 not specified in the debug info. Note that this is stored in a
1408 funny way: as the log base 2 (plus 1) of the alignment; so a
1409 value of 1 means the alignment is 1, and a value of 9 means the
1410 alignment is 256. */
1412 unsigned align_log2
: TYPE_ALIGN_BITS
;
1414 /* * Flags specific to this instance of the type, indicating where
1417 For TYPE_CODE_TYPEDEF the flags of the typedef type should be
1418 binary or-ed with the target type, with a special case for
1419 address class and space class. For example if this typedef does
1420 not specify any new qualifiers, TYPE_INSTANCE_FLAGS is 0 and the
1421 instance flags are completely inherited from the target type. No
1422 qualifiers can be cleared by the typedef. See also
1424 unsigned m_instance_flags
: 9;
1426 /* * Length of storage for a value of this type. The value is the
1427 expression in host bytes of what sizeof(type) would return. This
1428 size includes padding. For example, an i386 extended-precision
1429 floating point value really only occupies ten bytes, but most
1430 ABI's declare its size to be 12 bytes, to preserve alignment.
1431 A `struct type' representing such a floating-point type would
1432 have a `length' value of 12, even though the last two bytes are
1435 Since this field is expressed in host bytes, its value is appropriate
1436 to pass to memcpy and such (it is assumed that GDB itself always runs
1437 on an 8-bits addressable architecture). However, when using it for
1438 target address arithmetic (e.g. adding it to a target address), the
1439 type_length_units function should be used in order to get the length
1440 expressed in target addressable memory units. */
1444 /* * Core type, shared by a group of qualified types. */
1446 struct main_type
*main_type
;
1452 /* * The overloaded name.
1453 This is generally allocated in the objfile's obstack.
1454 However stabsread.c sometimes uses malloc. */
1458 /* * The number of methods with this name. */
1462 /* * The list of methods. */
1464 struct fn_field
*fn_fields
;
1471 /* * If is_stub is clear, this is the mangled name which we can look
1472 up to find the address of the method (FIXME: it would be cleaner
1473 to have a pointer to the struct symbol here instead).
1475 If is_stub is set, this is the portion of the mangled name which
1476 specifies the arguments. For example, "ii", if there are two int
1477 arguments, or "" if there are no arguments. See gdb_mangle_name
1478 for the conversion from this format to the one used if is_stub is
1481 const char *physname
;
1483 /* * The function type for the method.
1485 (This comment used to say "The return value of the method", but
1486 that's wrong. The function type is expected here, i.e. something
1487 with TYPE_CODE_METHOD, and *not* the return-value type). */
1491 /* * For virtual functions. First baseclass that defines this
1492 virtual function. */
1494 struct type
*fcontext
;
1498 unsigned int is_const
:1;
1499 unsigned int is_volatile
:1;
1500 unsigned int is_private
:1;
1501 unsigned int is_protected
:1;
1502 unsigned int is_artificial
:1;
1504 /* * A stub method only has some fields valid (but they are enough
1505 to reconstruct the rest of the fields). */
1507 unsigned int is_stub
:1;
1509 /* * True if this function is a constructor, false otherwise. */
1511 unsigned int is_constructor
: 1;
1513 /* * True if this function is deleted, false otherwise. */
1515 unsigned int is_deleted
: 1;
1517 /* * DW_AT_defaulted attribute for this function. The value is one
1518 of the DW_DEFAULTED constants. */
1520 ENUM_BITFIELD (dwarf_defaulted_attribute
) defaulted
: 2;
1524 unsigned int dummy
:6;
1526 /* * Index into that baseclass's virtual function table, minus 2;
1527 else if static: VOFFSET_STATIC; else: 0. */
1529 unsigned int voffset
:16;
1531 #define VOFFSET_STATIC 1
1537 /* * Unqualified name to be prefixed by owning class qualified
1542 /* * Type this typedef named NAME represents. */
1546 /* * True if this field was declared protected, false otherwise. */
1547 unsigned int is_protected
: 1;
1549 /* * True if this field was declared private, false otherwise. */
1550 unsigned int is_private
: 1;
1553 /* * C++ language-specific information for TYPE_CODE_STRUCT and
1554 TYPE_CODE_UNION nodes. */
1556 struct cplus_struct_type
1558 /* * Number of base classes this type derives from. The
1559 baseclasses are stored in the first N_BASECLASSES fields
1560 (i.e. the `fields' field of the struct type). The only fields
1561 of struct field that are used are: type, name, loc.bitpos. */
1563 short n_baseclasses
;
1565 /* * Field number of the virtual function table pointer in VPTR_BASETYPE.
1566 All access to this field must be through TYPE_VPTR_FIELDNO as one
1567 thing it does is check whether the field has been initialized.
1568 Initially TYPE_RAW_CPLUS_SPECIFIC has the value of cplus_struct_default,
1569 which for portability reasons doesn't initialize this field.
1570 TYPE_VPTR_FIELDNO returns -1 for this case.
1572 If -1, we were unable to find the virtual function table pointer in
1573 initial symbol reading, and get_vptr_fieldno should be called to find
1574 it if possible. get_vptr_fieldno will update this field if possible.
1575 Otherwise the value is left at -1.
1577 Unused if this type does not have virtual functions. */
1581 /* * Number of methods with unique names. All overloaded methods
1582 with the same name count only once. */
1586 /* * Number of template arguments. */
1588 unsigned short n_template_arguments
;
1590 /* * One if this struct is a dynamic class, as defined by the
1591 Itanium C++ ABI: if it requires a virtual table pointer,
1592 because it or any of its base classes have one or more virtual
1593 member functions or virtual base classes. Minus one if not
1594 dynamic. Zero if not yet computed. */
1598 /* * The calling convention for this type, fetched from the
1599 DW_AT_calling_convention attribute. The value is one of the
1602 ENUM_BITFIELD (dwarf_calling_convention
) calling_convention
: 8;
1604 /* * The base class which defined the virtual function table pointer. */
1606 struct type
*vptr_basetype
;
1608 /* * For derived classes, the number of base classes is given by
1609 n_baseclasses and virtual_field_bits is a bit vector containing
1610 one bit per base class. If the base class is virtual, the
1611 corresponding bit will be set.
1616 class C : public B, public virtual A {};
1618 B is a baseclass of C; A is a virtual baseclass for C.
1619 This is a C++ 2.0 language feature. */
1621 B_TYPE
*virtual_field_bits
;
1623 /* * For classes with private fields, the number of fields is
1624 given by nfields and private_field_bits is a bit vector
1625 containing one bit per field.
1627 If the field is private, the corresponding bit will be set. */
1629 B_TYPE
*private_field_bits
;
1631 /* * For classes with protected fields, the number of fields is
1632 given by nfields and protected_field_bits is a bit vector
1633 containing one bit per field.
1635 If the field is private, the corresponding bit will be set. */
1637 B_TYPE
*protected_field_bits
;
1639 /* * For classes with fields to be ignored, either this is
1640 optimized out or this field has length 0. */
1642 B_TYPE
*ignore_field_bits
;
1644 /* * For classes, structures, and unions, a description of each
1645 field, which consists of an overloaded name, followed by the
1646 types of arguments that the method expects, and then the name
1647 after it has been renamed to make it distinct.
1649 fn_fieldlists points to an array of nfn_fields of these. */
1651 struct fn_fieldlist
*fn_fieldlists
;
1653 /* * typedefs defined inside this class. typedef_field points to
1654 an array of typedef_field_count elements. */
1656 struct decl_field
*typedef_field
;
1658 unsigned typedef_field_count
;
1660 /* * The nested types defined by this type. nested_types points to
1661 an array of nested_types_count elements. */
1663 struct decl_field
*nested_types
;
1665 unsigned nested_types_count
;
1667 /* * The template arguments. This is an array with
1668 N_TEMPLATE_ARGUMENTS elements. This is NULL for non-template
1671 struct symbol
**template_arguments
;
1674 /* * Struct used to store conversion rankings. */
1680 /* * When two conversions are of the same type and therefore have
1681 the same rank, subrank is used to differentiate the two.
1683 Eg: Two derived-class-pointer to base-class-pointer conversions
1684 would both have base pointer conversion rank, but the
1685 conversion with the shorter distance to the ancestor is
1686 preferable. 'subrank' would be used to reflect that. */
1691 /* * Used for ranking a function for overload resolution. */
1693 typedef std::vector
<rank
> badness_vector
;
1695 /* * GNAT Ada-specific information for various Ada types. */
1697 struct gnat_aux_type
1699 /* * Parallel type used to encode information about dynamic types
1700 used in Ada (such as variant records, variable-size array,
1702 struct type
* descriptive_type
;
1705 /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types. */
1709 /* * The calling convention for targets supporting multiple ABIs.
1710 Right now this is only fetched from the Dwarf-2
1711 DW_AT_calling_convention attribute. The value is one of the
1714 ENUM_BITFIELD (dwarf_calling_convention
) calling_convention
: 8;
1716 /* * Whether this function normally returns to its caller. It is
1717 set from the DW_AT_noreturn attribute if set on the
1718 DW_TAG_subprogram. */
1720 unsigned int is_noreturn
: 1;
1722 /* * Only those DW_TAG_call_site's in this function that have
1723 DW_AT_call_tail_call set are linked in this list. Function
1724 without its tail call list complete
1725 (DW_AT_call_all_tail_calls or its superset
1726 DW_AT_call_all_calls) has TAIL_CALL_LIST NULL, even if some
1727 DW_TAG_call_site's exist in such function. */
1729 struct call_site
*tail_call_list
;
1731 /* * For method types (TYPE_CODE_METHOD), the aggregate type that
1732 contains the method. */
1734 struct type
*self_type
;
1737 /* The type-specific info for TYPE_CODE_FIXED_POINT types. */
1739 struct fixed_point_type_info
1741 /* The fixed point type's scaling factor. */
1742 gdb_mpq scaling_factor
;
1745 /* * The default value of TYPE_CPLUS_SPECIFIC(T) points to this shared
1746 static structure. */
1748 extern const struct cplus_struct_type cplus_struct_default
;
1750 extern void allocate_cplus_struct_type (struct type
*);
1752 #define INIT_CPLUS_SPECIFIC(type) \
1753 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_CPLUS_STUFF, \
1754 TYPE_RAW_CPLUS_SPECIFIC (type) = (struct cplus_struct_type*) \
1755 &cplus_struct_default)
1757 #define ALLOCATE_CPLUS_STRUCT_TYPE(type) allocate_cplus_struct_type (type)
1759 #define HAVE_CPLUS_STRUCT(type) \
1760 (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_CPLUS_STUFF \
1761 && TYPE_RAW_CPLUS_SPECIFIC (type) != &cplus_struct_default)
1763 #define INIT_NONE_SPECIFIC(type) \
1764 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_NONE, \
1765 TYPE_MAIN_TYPE (type)->type_specific = {})
1767 extern const struct gnat_aux_type gnat_aux_default
;
1769 extern void allocate_gnat_aux_type (struct type
*);
1771 #define INIT_GNAT_SPECIFIC(type) \
1772 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_GNAT_STUFF, \
1773 TYPE_GNAT_SPECIFIC (type) = (struct gnat_aux_type *) &gnat_aux_default)
1774 #define ALLOCATE_GNAT_AUX_TYPE(type) allocate_gnat_aux_type (type)
1775 /* * A macro that returns non-zero if the type-specific data should be
1776 read as "gnat-stuff". */
1777 #define HAVE_GNAT_AUX_INFO(type) \
1778 (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF)
1780 /* * True if TYPE is known to be an Ada type of some kind. */
1781 #define ADA_TYPE_P(type) \
1782 (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF \
1783 || (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE \
1784 && (type)->is_fixed_instance ()))
1786 #define INIT_FUNC_SPECIFIC(type) \
1787 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC, \
1788 TYPE_MAIN_TYPE (type)->type_specific.func_stuff = (struct func_type *) \
1789 TYPE_ZALLOC (type, \
1790 sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
1792 /* "struct fixed_point_type_info" has a field that has a destructor.
1793 See allocate_fixed_point_type_info to understand how this is
1795 #define INIT_FIXED_POINT_SPECIFIC(type) \
1796 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \
1797 allocate_fixed_point_type_info (type))
1799 #define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
1800 #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
1801 #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
1802 #define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type
1803 #define TYPE_CHAIN(thistype) (thistype)->chain
1805 /* * Return the alignment of the type in target addressable memory
1806 units, or 0 if no alignment was specified. */
1807 #define TYPE_RAW_ALIGN(thistype) type_raw_align (thistype)
1809 /* * Return the alignment of the type in target addressable memory
1810 units, or 0 if no alignment was specified. */
1811 extern unsigned type_raw_align (struct type
*);
1813 /* * Return the alignment of the type in target addressable memory
1814 units. Return 0 if the alignment cannot be determined; but note
1815 that this makes an effort to compute the alignment even it it was
1816 not specified in the debug info. */
1817 extern unsigned type_align (struct type
*);
1819 /* * Set the alignment of the type. The alignment must be a power of
1820 2. Returns false if the given value does not fit in the available
1821 space in struct type. */
1822 extern bool set_type_align (struct type
*, ULONGEST
);
1824 /* Property accessors for the type data location. */
1825 #define TYPE_DATA_LOCATION(thistype) \
1826 ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION))
1827 #define TYPE_DATA_LOCATION_BATON(thistype) \
1828 TYPE_DATA_LOCATION (thistype)->data.baton
1829 #define TYPE_DATA_LOCATION_ADDR(thistype) \
1830 (TYPE_DATA_LOCATION (thistype)->const_val ())
1831 #define TYPE_DATA_LOCATION_KIND(thistype) \
1832 (TYPE_DATA_LOCATION (thistype)->kind ())
1833 #define TYPE_DYNAMIC_LENGTH(thistype) \
1834 ((thistype)->dyn_prop (DYN_PROP_BYTE_SIZE))
1836 /* Property accessors for the type allocated/associated. */
1837 #define TYPE_ALLOCATED_PROP(thistype) \
1838 ((thistype)->dyn_prop (DYN_PROP_ALLOCATED))
1839 #define TYPE_ASSOCIATED_PROP(thistype) \
1840 ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED))
1841 #define TYPE_RANK_PROP(thistype) \
1842 ((thistype)->dyn_prop (DYN_PROP_RANK))
1846 #define TYPE_SELF_TYPE(thistype) internal_type_self_type (thistype)
1847 /* Do not call this, use TYPE_SELF_TYPE. */
1848 extern struct type
*internal_type_self_type (struct type
*);
1849 extern void set_type_self_type (struct type
*, struct type
*);
1851 extern int internal_type_vptr_fieldno (struct type
*);
1852 extern void set_type_vptr_fieldno (struct type
*, int);
1853 extern struct type
*internal_type_vptr_basetype (struct type
*);
1854 extern void set_type_vptr_basetype (struct type
*, struct type
*);
1855 #define TYPE_VPTR_FIELDNO(thistype) internal_type_vptr_fieldno (thistype)
1856 #define TYPE_VPTR_BASETYPE(thistype) internal_type_vptr_basetype (thistype)
1858 #define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
1859 #define TYPE_SPECIFIC_FIELD(thistype) \
1860 TYPE_MAIN_TYPE(thistype)->type_specific_field
1861 /* We need this tap-dance with the TYPE_RAW_SPECIFIC because of the case
1862 where we're trying to print an Ada array using the C language.
1863 In that case, there is no "cplus_stuff", but the C language assumes
1864 that there is. What we do, in that case, is pretend that there is
1865 an implicit one which is the default cplus stuff. */
1866 #define TYPE_CPLUS_SPECIFIC(thistype) \
1867 (!HAVE_CPLUS_STRUCT(thistype) \
1868 ? (struct cplus_struct_type*)&cplus_struct_default \
1869 : TYPE_RAW_CPLUS_SPECIFIC(thistype))
1870 #define TYPE_RAW_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
1871 #define TYPE_CPLUS_CALLING_CONVENTION(thistype) \
1872 TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff->calling_convention
1873 #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
1874 #define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
1875 #define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
1876 #define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->calling_convention
1877 #define TYPE_NO_RETURN(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->is_noreturn
1878 #define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->tail_call_list
1879 #define TYPE_BASECLASS(thistype,index) ((thistype)->field (index).type ())
1880 #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
1881 #define TYPE_BASECLASS_NAME(thistype,index) (thistype->field (index).name ())
1882 #define TYPE_BASECLASS_BITPOS(thistype,index) (thistype->field (index).loc_bitpos ())
1883 #define BASETYPE_VIA_PUBLIC(thistype, index) \
1884 ((!TYPE_FIELD_PRIVATE(thistype, index)) && (!TYPE_FIELD_PROTECTED(thistype, index)))
1885 #define TYPE_CPLUS_DYNAMIC(thistype) TYPE_CPLUS_SPECIFIC (thistype)->is_dynamic
1887 #define BASETYPE_VIA_VIRTUAL(thistype, index) \
1888 (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
1889 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
1891 #define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
1892 #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
1894 #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL((thistype)->field (n))
1895 #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE((thistype)->field (n))
1896 #define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE((thistype)->field (n))!=0)
1898 #define TYPE_FIELD_PRIVATE_BITS(thistype) \
1899 TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
1900 #define TYPE_FIELD_PROTECTED_BITS(thistype) \
1901 TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits
1902 #define TYPE_FIELD_IGNORE_BITS(thistype) \
1903 TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits
1904 #define TYPE_FIELD_VIRTUAL_BITS(thistype) \
1905 TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits
1906 #define SET_TYPE_FIELD_PRIVATE(thistype, n) \
1907 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n))
1908 #define SET_TYPE_FIELD_PROTECTED(thistype, n) \
1909 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n))
1910 #define SET_TYPE_FIELD_IGNORE(thistype, n) \
1911 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n))
1912 #define SET_TYPE_FIELD_VIRTUAL(thistype, n) \
1913 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))
1914 #define TYPE_FIELD_PRIVATE(thistype, n) \
1915 (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits == NULL ? 0 \
1916 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n)))
1917 #define TYPE_FIELD_PROTECTED(thistype, n) \
1918 (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits == NULL ? 0 \
1919 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n)))
1920 #define TYPE_FIELD_IGNORE(thistype, n) \
1921 (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits == NULL ? 0 \
1922 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n)))
1923 #define TYPE_FIELD_VIRTUAL(thistype, n) \
1924 (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
1925 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n)))
1927 #define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists
1928 #define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n]
1929 #define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields
1930 #define TYPE_FN_FIELDLIST_NAME(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].name
1931 #define TYPE_FN_FIELDLIST_LENGTH(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].length
1933 #define TYPE_N_TEMPLATE_ARGUMENTS(thistype) \
1934 TYPE_CPLUS_SPECIFIC (thistype)->n_template_arguments
1935 #define TYPE_TEMPLATE_ARGUMENTS(thistype) \
1936 TYPE_CPLUS_SPECIFIC (thistype)->template_arguments
1937 #define TYPE_TEMPLATE_ARGUMENT(thistype, n) \
1938 TYPE_CPLUS_SPECIFIC (thistype)->template_arguments[n]
1940 #define TYPE_FN_FIELD(thisfn, n) (thisfn)[n]
1941 #define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname
1942 #define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type
1943 #define TYPE_FN_FIELD_ARGS(thisfn, n) (((thisfn)[n].type)->fields ())
1944 #define TYPE_FN_FIELD_CONST(thisfn, n) ((thisfn)[n].is_const)
1945 #define TYPE_FN_FIELD_VOLATILE(thisfn, n) ((thisfn)[n].is_volatile)
1946 #define TYPE_FN_FIELD_PRIVATE(thisfn, n) ((thisfn)[n].is_private)
1947 #define TYPE_FN_FIELD_PROTECTED(thisfn, n) ((thisfn)[n].is_protected)
1948 #define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n) ((thisfn)[n].is_artificial)
1949 #define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
1950 #define TYPE_FN_FIELD_CONSTRUCTOR(thisfn, n) ((thisfn)[n].is_constructor)
1951 #define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext)
1952 #define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
1953 #define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
1954 #define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
1955 #define TYPE_FN_FIELD_DEFAULTED(thisfn, n) ((thisfn)[n].defaulted)
1956 #define TYPE_FN_FIELD_DELETED(thisfn, n) ((thisfn)[n].is_deleted)
1958 /* Accessors for typedefs defined by a class. */
1959 #define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \
1960 TYPE_CPLUS_SPECIFIC (thistype)->typedef_field
1961 #define TYPE_TYPEDEF_FIELD(thistype, n) \
1962 TYPE_CPLUS_SPECIFIC (thistype)->typedef_field[n]
1963 #define TYPE_TYPEDEF_FIELD_NAME(thistype, n) \
1964 TYPE_TYPEDEF_FIELD (thistype, n).name
1965 #define TYPE_TYPEDEF_FIELD_TYPE(thistype, n) \
1966 TYPE_TYPEDEF_FIELD (thistype, n).type
1967 #define TYPE_TYPEDEF_FIELD_COUNT(thistype) \
1968 TYPE_CPLUS_SPECIFIC (thistype)->typedef_field_count
1969 #define TYPE_TYPEDEF_FIELD_PROTECTED(thistype, n) \
1970 TYPE_TYPEDEF_FIELD (thistype, n).is_protected
1971 #define TYPE_TYPEDEF_FIELD_PRIVATE(thistype, n) \
1972 TYPE_TYPEDEF_FIELD (thistype, n).is_private
1974 #define TYPE_NESTED_TYPES_ARRAY(thistype) \
1975 TYPE_CPLUS_SPECIFIC (thistype)->nested_types
1976 #define TYPE_NESTED_TYPES_FIELD(thistype, n) \
1977 TYPE_CPLUS_SPECIFIC (thistype)->nested_types[n]
1978 #define TYPE_NESTED_TYPES_FIELD_NAME(thistype, n) \
1979 TYPE_NESTED_TYPES_FIELD (thistype, n).name
1980 #define TYPE_NESTED_TYPES_FIELD_TYPE(thistype, n) \
1981 TYPE_NESTED_TYPES_FIELD (thistype, n).type
1982 #define TYPE_NESTED_TYPES_COUNT(thistype) \
1983 TYPE_CPLUS_SPECIFIC (thistype)->nested_types_count
1984 #define TYPE_NESTED_TYPES_FIELD_PROTECTED(thistype, n) \
1985 TYPE_NESTED_TYPES_FIELD (thistype, n).is_protected
1986 #define TYPE_NESTED_TYPES_FIELD_PRIVATE(thistype, n) \
1987 TYPE_NESTED_TYPES_FIELD (thistype, n).is_private
1989 #define TYPE_IS_OPAQUE(thistype) \
1990 ((((thistype)->code () == TYPE_CODE_STRUCT) \
1991 || ((thistype)->code () == TYPE_CODE_UNION)) \
1992 && ((thistype)->num_fields () == 0) \
1993 && (!HAVE_CPLUS_STRUCT (thistype) \
1994 || TYPE_NFN_FIELDS (thistype) == 0) \
1995 && ((thistype)->is_stub () || !(thistype)->stub_is_supported ()))
1997 /* * A helper macro that returns the name of a type or "unnamed type"
1998 if the type has no name. */
2000 #define TYPE_SAFE_NAME(type) \
2001 (type->name () != nullptr ? type->name () : _("<unnamed type>"))
2003 /* * A helper macro that returns the name of an error type. If the
2004 type has a name, it is used; otherwise, a default is used. */
2006 #define TYPE_ERROR_NAME(type) \
2007 (type->name () ? type->name () : _("<error type>"))
2009 /* Given TYPE, return its floatformat. */
2010 const struct floatformat
*floatformat_from_type (const struct type
*type
);
2014 /* Integral types. */
2016 /* Implicit size/sign (based on the architecture's ABI). */
2017 struct type
*builtin_void
= nullptr;
2018 struct type
*builtin_char
= nullptr;
2019 struct type
*builtin_short
= nullptr;
2020 struct type
*builtin_int
= nullptr;
2021 struct type
*builtin_long
= nullptr;
2022 struct type
*builtin_signed_char
= nullptr;
2023 struct type
*builtin_unsigned_char
= nullptr;
2024 struct type
*builtin_unsigned_short
= nullptr;
2025 struct type
*builtin_unsigned_int
= nullptr;
2026 struct type
*builtin_unsigned_long
= nullptr;
2027 struct type
*builtin_bfloat16
= nullptr;
2028 struct type
*builtin_half
= nullptr;
2029 struct type
*builtin_float
= nullptr;
2030 struct type
*builtin_double
= nullptr;
2031 struct type
*builtin_long_double
= nullptr;
2032 struct type
*builtin_complex
= nullptr;
2033 struct type
*builtin_double_complex
= nullptr;
2034 struct type
*builtin_string
= nullptr;
2035 struct type
*builtin_bool
= nullptr;
2036 struct type
*builtin_long_long
= nullptr;
2037 struct type
*builtin_unsigned_long_long
= nullptr;
2038 struct type
*builtin_decfloat
= nullptr;
2039 struct type
*builtin_decdouble
= nullptr;
2040 struct type
*builtin_declong
= nullptr;
2042 /* "True" character types.
2043 We use these for the '/c' print format, because c_char is just a
2044 one-byte integral type, which languages less laid back than C
2045 will print as ... well, a one-byte integral type. */
2046 struct type
*builtin_true_char
= nullptr;
2047 struct type
*builtin_true_unsigned_char
= nullptr;
2049 /* Explicit sizes - see C9X <intypes.h> for naming scheme. The "int0"
2050 is for when an architecture needs to describe a register that has
2052 struct type
*builtin_int0
= nullptr;
2053 struct type
*builtin_int8
= nullptr;
2054 struct type
*builtin_uint8
= nullptr;
2055 struct type
*builtin_int16
= nullptr;
2056 struct type
*builtin_uint16
= nullptr;
2057 struct type
*builtin_int24
= nullptr;
2058 struct type
*builtin_uint24
= nullptr;
2059 struct type
*builtin_int32
= nullptr;
2060 struct type
*builtin_uint32
= nullptr;
2061 struct type
*builtin_int64
= nullptr;
2062 struct type
*builtin_uint64
= nullptr;
2063 struct type
*builtin_int128
= nullptr;
2064 struct type
*builtin_uint128
= nullptr;
2066 /* Wide character types. */
2067 struct type
*builtin_char16
= nullptr;
2068 struct type
*builtin_char32
= nullptr;
2069 struct type
*builtin_wchar
= nullptr;
2071 /* Pointer types. */
2073 /* * `pointer to data' type. Some target platforms use an implicitly
2074 {sign,zero} -extended 32-bit ABI pointer on a 64-bit ISA. */
2075 struct type
*builtin_data_ptr
= nullptr;
2077 /* * `pointer to function (returning void)' type. Harvard
2078 architectures mean that ABI function and code pointers are not
2079 interconvertible. Similarly, since ANSI, C standards have
2080 explicitly said that pointers to functions and pointers to data
2081 are not interconvertible --- that is, you can't cast a function
2082 pointer to void * and back, and expect to get the same value.
2083 However, all function pointer types are interconvertible, so void
2084 (*) () can server as a generic function pointer. */
2086 struct type
*builtin_func_ptr
= nullptr;
2088 /* * `function returning pointer to function (returning void)' type.
2089 The final void return type is not significant for it. */
2091 struct type
*builtin_func_func
= nullptr;
2093 /* Special-purpose types. */
2095 /* * This type is used to represent a GDB internal function. */
2097 struct type
*internal_fn
= nullptr;
2099 /* * This type is used to represent an xmethod. */
2100 struct type
*xmethod
= nullptr;
2103 /* * Return the type table for the specified architecture. */
2105 extern const struct builtin_type
*builtin_type (struct gdbarch
*gdbarch
);
2107 /* * Per-objfile types used by symbol readers. */
2111 /* Basic types based on the objfile architecture. */
2112 struct type
*builtin_void
;
2113 struct type
*builtin_char
;
2114 struct type
*builtin_short
;
2115 struct type
*builtin_int
;
2116 struct type
*builtin_long
;
2117 struct type
*builtin_long_long
;
2118 struct type
*builtin_signed_char
;
2119 struct type
*builtin_unsigned_char
;
2120 struct type
*builtin_unsigned_short
;
2121 struct type
*builtin_unsigned_int
;
2122 struct type
*builtin_unsigned_long
;
2123 struct type
*builtin_unsigned_long_long
;
2124 struct type
*builtin_half
;
2125 struct type
*builtin_float
;
2126 struct type
*builtin_double
;
2127 struct type
*builtin_long_double
;
2129 /* * This type is used to represent symbol addresses. */
2130 struct type
*builtin_core_addr
;
2132 /* * This type represents a type that was unrecognized in symbol
2134 struct type
*builtin_error
;
2136 /* * Types used for symbols with no debug information. */
2137 struct type
*nodebug_text_symbol
;
2138 struct type
*nodebug_text_gnu_ifunc_symbol
;
2139 struct type
*nodebug_got_plt_symbol
;
2140 struct type
*nodebug_data_symbol
;
2141 struct type
*nodebug_unknown_symbol
;
2142 struct type
*nodebug_tls_symbol
;
2145 /* * Return the type table for the specified objfile. */
2147 extern const struct objfile_type
*objfile_type (struct objfile
*objfile
);
2149 /* Explicit floating-point formats. See "floatformat.h". */
2150 extern const struct floatformat
*floatformats_ieee_half
[BFD_ENDIAN_UNKNOWN
];
2151 extern const struct floatformat
*floatformats_ieee_single
[BFD_ENDIAN_UNKNOWN
];
2152 extern const struct floatformat
*floatformats_ieee_double
[BFD_ENDIAN_UNKNOWN
];
2153 extern const struct floatformat
*floatformats_ieee_quad
[BFD_ENDIAN_UNKNOWN
];
2154 extern const struct floatformat
*floatformats_ieee_double_littlebyte_bigword
[BFD_ENDIAN_UNKNOWN
];
2155 extern const struct floatformat
*floatformats_i387_ext
[BFD_ENDIAN_UNKNOWN
];
2156 extern const struct floatformat
*floatformats_m68881_ext
[BFD_ENDIAN_UNKNOWN
];
2157 extern const struct floatformat
*floatformats_arm_ext
[BFD_ENDIAN_UNKNOWN
];
2158 extern const struct floatformat
*floatformats_ia64_spill
[BFD_ENDIAN_UNKNOWN
];
2159 extern const struct floatformat
*floatformats_vax_f
[BFD_ENDIAN_UNKNOWN
];
2160 extern const struct floatformat
*floatformats_vax_d
[BFD_ENDIAN_UNKNOWN
];
2161 extern const struct floatformat
*floatformats_ibm_long_double
[BFD_ENDIAN_UNKNOWN
];
2162 extern const struct floatformat
*floatformats_bfloat16
[BFD_ENDIAN_UNKNOWN
];
2164 /* Allocate space for storing data associated with a particular
2165 type. We ensure that the space is allocated using the same
2166 mechanism that was used to allocate the space for the type
2167 structure itself. I.e. if the type is on an objfile's
2168 objfile_obstack, then the space for data associated with that type
2169 will also be allocated on the objfile_obstack. If the type is
2170 associated with a gdbarch, then the space for data associated with that
2171 type will also be allocated on the gdbarch_obstack.
2173 If a type is not associated with neither an objfile or a gdbarch then
2174 you should not use this macro to allocate space for data, instead you
2175 should call xmalloc directly, and ensure the memory is correctly freed
2176 when it is no longer needed. */
2178 #define TYPE_ALLOC(t,size) \
2179 (obstack_alloc (((t)->is_objfile_owned () \
2180 ? &((t)->objfile_owner ()->objfile_obstack) \
2181 : gdbarch_obstack ((t)->arch_owner ())), \
2185 /* See comment on TYPE_ALLOC. */
2187 #define TYPE_ZALLOC(t,size) (memset (TYPE_ALLOC (t, size), 0, size))
2189 /* * This returns the target type (or NULL) of TYPE, also skipping
2192 extern struct type
*get_target_type (struct type
*type
);
2194 /* Return the equivalent of TYPE_LENGTH, but in number of target
2195 addressable memory units of the associated gdbarch instead of bytes. */
2197 extern unsigned int type_length_units (struct type
*type
);
2199 /* An object of this type is passed when allocating certain types. It
2200 determines where the new type is allocated. Ultimately a type is
2201 either allocated on a on an objfile obstack or on a gdbarch
2202 obstack. However, it's also possible to request that a new type be
2203 allocated on the same obstack as some existing type, or that a
2204 "new" type instead overwrite a supplied type object. */
2206 class type_allocator
2210 /* Create new types on OBJFILE. */
2211 explicit type_allocator (objfile
*objfile
)
2212 : m_is_objfile (true)
2214 m_data
.objfile
= objfile
;
2217 /* Create new types on GDBARCH. */
2218 explicit type_allocator (gdbarch
*gdbarch
)
2220 m_data
.gdbarch
= gdbarch
;
2223 /* This determines whether a passed-in type should be rewritten in
2224 place, or whether it should simply determine where the new type
2226 enum type_allocator_kind
2228 /* Allocate on same obstack as existing type. */
2230 /* Smash the existing type. */
2234 /* Create new types either on the same obstack as TYPE; or if SMASH
2235 is passed, overwrite TYPE. */
2236 explicit type_allocator (struct type
*type
,
2237 type_allocator_kind kind
= SAME
)
2241 if (type
->is_objfile_owned ())
2243 m_data
.objfile
= type
->objfile_owner ();
2244 m_is_objfile
= true;
2247 m_data
.gdbarch
= type
->arch_owner ();
2256 /* Create new types on the same obstack as TYPE. */
2257 explicit type_allocator (const struct type
*type
)
2258 : m_is_objfile (type
->is_objfile_owned ())
2260 if (type
->is_objfile_owned ())
2261 m_data
.objfile
= type
->objfile_owner ();
2263 m_data
.gdbarch
= type
->arch_owner ();
2266 /* Create a new type on the desired obstack. Note that a "new" type
2267 is not created if type-smashing was selected at construction. */
2270 /* Create a new type on the desired obstack, and fill in its code,
2271 length, and name. If NAME is non-null, it is copied to the
2272 destination obstack first. Note that a "new" type is not created
2273 if type-smashing was selected at construction. */
2274 type
*new_type (enum type_code code
, int bit
, const char *name
);
2276 /* Return the architecture associated with this allocator. This
2277 comes from whatever object was supplied to the constructor. */
2282 /* Where the type should wind up. */
2285 struct objfile
*objfile
;
2286 struct gdbarch
*gdbarch
;
2290 /* True if this allocator uses the objfile field above. */
2291 bool m_is_objfile
= false;
2292 /* True if this allocator uses the type field above, indicating that
2293 the "allocation" should be done in-place. */
2294 bool m_smash
= false;
2297 /* Allocate a TYPE_CODE_INT type structure using ALLOC. BIT is the
2298 type size in bits. If UNSIGNED_P is non-zero, set the type's
2299 TYPE_UNSIGNED flag. NAME is the type name. */
2301 extern struct type
*init_integer_type (type_allocator
&alloc
, int bit
,
2302 int unsigned_p
, const char *name
);
2304 /* Allocate a TYPE_CODE_CHAR type structure using ALLOC. BIT is the
2305 type size in bits. If UNSIGNED_P is non-zero, set the type's
2306 TYPE_UNSIGNED flag. NAME is the type name. */
2308 extern struct type
*init_character_type (type_allocator
&alloc
, int bit
,
2309 int unsigned_p
, const char *name
);
2310 extern struct type
*init_boolean_type (struct objfile
*, int, int,
2312 extern struct type
*init_float_type (struct objfile
*, int, const char *,
2313 const struct floatformat
**,
2314 enum bfd_endian
= BFD_ENDIAN_UNKNOWN
);
2315 extern struct type
*init_decfloat_type (struct objfile
*, int, const char *);
2316 extern bool can_create_complex_type (struct type
*);
2317 extern struct type
*init_complex_type (const char *, struct type
*);
2318 extern struct type
*init_pointer_type (struct objfile
*, int, const char *,
2320 extern struct type
*init_fixed_point_type (struct objfile
*, int, int,
2323 /* Helper functions to construct architecture-owned types. */
2324 extern struct type
*arch_boolean_type (struct gdbarch
*, int, int,
2326 extern struct type
*arch_float_type (struct gdbarch
*, int, const char *,
2327 const struct floatformat
**);
2328 extern struct type
*arch_decfloat_type (struct gdbarch
*, int, const char *);
2329 extern struct type
*arch_pointer_type (struct gdbarch
*, int, const char *,
2332 /* Helper functions to construct a struct or record type. An
2333 initially empty type is created using arch_composite_type().
2334 Fields are then added using append_composite_type_field*(). A union
2335 type has its size set to the largest field. A struct type has each
2336 field packed against the previous. */
2338 extern struct type
*arch_composite_type (struct gdbarch
*gdbarch
,
2339 const char *name
, enum type_code code
);
2340 extern void append_composite_type_field (struct type
*t
, const char *name
,
2341 struct type
*field
);
2342 extern void append_composite_type_field_aligned (struct type
*t
,
2346 struct field
*append_composite_type_field_raw (struct type
*t
, const char *name
,
2347 struct type
*field
);
2349 /* Helper functions to construct a bit flags type. An initially empty
2350 type is created using arch_flag_type(). Flags are then added using
2351 append_flag_type_field() and append_flag_type_flag(). */
2352 extern struct type
*arch_flags_type (struct gdbarch
*gdbarch
,
2353 const char *name
, int bit
);
2354 extern void append_flags_type_field (struct type
*type
,
2355 int start_bitpos
, int nr_bits
,
2356 struct type
*field_type
, const char *name
);
2357 extern void append_flags_type_flag (struct type
*type
, int bitpos
,
2360 extern void make_vector_type (struct type
*array_type
);
2361 extern struct type
*init_vector_type (struct type
*elt_type
, int n
);
2363 extern struct type
*lookup_reference_type (struct type
*, enum type_code
);
2364 extern struct type
*lookup_lvalue_reference_type (struct type
*);
2365 extern struct type
*lookup_rvalue_reference_type (struct type
*);
2368 extern struct type
*make_reference_type (struct type
*, struct type
**,
2371 extern struct type
*make_cv_type (int, int, struct type
*, struct type
**);
2373 extern struct type
*make_restrict_type (struct type
*);
2375 extern struct type
*make_unqualified_type (struct type
*);
2377 extern struct type
*make_atomic_type (struct type
*);
2379 extern void replace_type (struct type
*, struct type
*);
2381 extern type_instance_flags address_space_name_to_type_instance_flags
2382 (struct gdbarch
*, const char *);
2384 extern const char *address_space_type_instance_flags_to_name
2385 (struct gdbarch
*, type_instance_flags
);
2387 extern struct type
*make_type_with_address_space
2388 (struct type
*type
, type_instance_flags space_identifier
);
2390 extern struct type
*lookup_memberptr_type (struct type
*, struct type
*);
2392 extern struct type
*lookup_methodptr_type (struct type
*);
2394 extern void smash_to_method_type (struct type
*type
, struct type
*self_type
,
2395 struct type
*to_type
, struct field
*args
,
2396 int nargs
, int varargs
);
2398 extern void smash_to_memberptr_type (struct type
*, struct type
*,
2401 extern void smash_to_methodptr_type (struct type
*, struct type
*);
2403 extern const char *type_name_or_error (struct type
*type
);
2407 /* The field of the element, or NULL if no element was found. */
2408 struct field
*field
;
2410 /* The bit offset of the element in the parent structure. */
2414 /* Given a type TYPE, lookup the field and offset of the component named
2417 TYPE can be either a struct or union, or a pointer or reference to
2418 a struct or union. If it is a pointer or reference, its target
2419 type is automatically used. Thus '.' and '->' are interchangable,
2420 as specified for the definitions of the expression element types
2421 STRUCTOP_STRUCT and STRUCTOP_PTR.
2423 If NOERR is nonzero, the returned structure will have field set to
2424 NULL if there is no component named NAME.
2426 If the component NAME is a field in an anonymous substructure of
2427 TYPE, the returned offset is a "global" offset relative to TYPE
2428 rather than an offset within the substructure. */
2430 extern struct_elt
lookup_struct_elt (struct type
*, const char *, int);
2432 /* Given a type TYPE, lookup the type of the component named NAME.
2434 TYPE can be either a struct or union, or a pointer or reference to
2435 a struct or union. If it is a pointer or reference, its target
2436 type is automatically used. Thus '.' and '->' are interchangable,
2437 as specified for the definitions of the expression element types
2438 STRUCTOP_STRUCT and STRUCTOP_PTR.
2440 If NOERR is nonzero, return NULL if there is no component named
2443 extern struct type
*lookup_struct_elt_type (struct type
*, const char *, int);
2445 extern struct type
*make_pointer_type (struct type
*, struct type
**);
2447 extern struct type
*lookup_pointer_type (struct type
*);
2449 extern struct type
*make_function_type (struct type
*, struct type
**);
2451 extern struct type
*lookup_function_type (struct type
*);
2453 extern struct type
*lookup_function_type_with_arguments (struct type
*,
2457 extern struct type
*create_static_range_type (struct type
*, struct type
*,
2461 extern struct type
*create_array_type_with_stride
2462 (struct type
*, struct type
*, struct type
*,
2463 struct dynamic_prop
*, unsigned int);
2465 extern struct type
*create_range_type (struct type
*, struct type
*,
2466 const struct dynamic_prop
*,
2467 const struct dynamic_prop
*,
2470 /* Like CREATE_RANGE_TYPE but also sets up a stride. When BYTE_STRIDE_P
2471 is true the value in STRIDE is a byte stride, otherwise STRIDE is a bit
2474 extern struct type
* create_range_type_with_stride
2475 (struct type
*result_type
, struct type
*index_type
,
2476 const struct dynamic_prop
*low_bound
,
2477 const struct dynamic_prop
*high_bound
, LONGEST bias
,
2478 const struct dynamic_prop
*stride
, bool byte_stride_p
);
2480 extern struct type
*create_array_type (struct type
*, struct type
*,
2483 extern struct type
*lookup_array_range_type (struct type
*, LONGEST
, LONGEST
);
2485 extern struct type
*create_string_type (struct type
*, struct type
*,
2487 extern struct type
*lookup_string_range_type (struct type
*, LONGEST
, LONGEST
);
2489 extern struct type
*create_set_type (struct type
*, struct type
*);
2491 extern struct type
*lookup_unsigned_typename (const struct language_defn
*,
2494 extern struct type
*lookup_signed_typename (const struct language_defn
*,
2497 extern ULONGEST
get_unsigned_type_max (struct type
*);
2499 extern void get_signed_type_minmax (struct type
*, LONGEST
*, LONGEST
*);
2501 extern CORE_ADDR
get_pointer_type_max (struct type
*);
2503 /* * Resolve all dynamic values of a type e.g. array bounds to static values.
2504 ADDR specifies the location of the variable the type is bound to.
2505 If TYPE has no dynamic properties return TYPE; otherwise a new type with
2506 static properties is returned.
2508 For an array type, if the element type is dynamic, then that will
2509 not be resolved. This is done because each individual element may
2510 have a different type when resolved (depending on the contents of
2511 memory). In this situation, 'is_dynamic_type' will still return
2512 true for the return value of this function. */
2513 extern struct type
*resolve_dynamic_type
2514 (struct type
*type
, gdb::array_view
<const gdb_byte
> valaddr
,
2517 /* * Predicate if the type has dynamic values, which are not resolved yet.
2518 See the caveat in 'resolve_dynamic_type' to understand a scenario
2519 where an apparently-resolved type may still be considered
2521 extern int is_dynamic_type (struct type
*type
);
2523 extern struct type
*check_typedef (struct type
*);
2525 extern void check_stub_method_group (struct type
*, int);
2527 extern char *gdb_mangle_name (struct type
*, int, int);
2529 extern struct type
*lookup_typename (const struct language_defn
*,
2530 const char *, const struct block
*, int);
2532 extern struct type
*lookup_template_type (const char *, struct type
*,
2533 const struct block
*);
2535 extern int get_vptr_fieldno (struct type
*, struct type
**);
2537 /* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type
2540 Return true if the two bounds are available, false otherwise. */
2542 extern bool get_discrete_bounds (struct type
*type
, LONGEST
*lowp
,
2545 /* If TYPE's low bound is a known constant, return it, else return nullopt. */
2547 extern gdb::optional
<LONGEST
> get_discrete_low_bound (struct type
*type
);
2549 /* If TYPE's high bound is a known constant, return it, else return nullopt. */
2551 extern gdb::optional
<LONGEST
> get_discrete_high_bound (struct type
*type
);
2553 /* Assuming TYPE is a simple, non-empty array type, compute its upper
2554 and lower bound. Save the low bound into LOW_BOUND if not NULL.
2555 Save the high bound into HIGH_BOUND if not NULL.
2557 Return true if the operation was successful. Return false otherwise,
2558 in which case the values of LOW_BOUND and HIGH_BOUNDS are unmodified. */
2560 extern bool get_array_bounds (struct type
*type
, LONGEST
*low_bound
,
2561 LONGEST
*high_bound
);
2563 extern gdb::optional
<LONGEST
> discrete_position (struct type
*type
,
2566 extern int class_types_same_p (const struct type
*, const struct type
*);
2568 extern int is_ancestor (struct type
*, struct type
*);
2570 extern int is_public_ancestor (struct type
*, struct type
*);
2572 extern int is_unique_ancestor (struct type
*, struct value
*);
2574 /* Overload resolution */
2576 /* * Badness if parameter list length doesn't match arg list length. */
2577 extern const struct rank LENGTH_MISMATCH_BADNESS
;
2579 /* * Dummy badness value for nonexistent parameter positions. */
2580 extern const struct rank TOO_FEW_PARAMS_BADNESS
;
2581 /* * Badness if no conversion among types. */
2582 extern const struct rank INCOMPATIBLE_TYPE_BADNESS
;
2584 /* * Badness of an exact match. */
2585 extern const struct rank EXACT_MATCH_BADNESS
;
2587 /* * Badness of integral promotion. */
2588 extern const struct rank INTEGER_PROMOTION_BADNESS
;
2589 /* * Badness of floating promotion. */
2590 extern const struct rank FLOAT_PROMOTION_BADNESS
;
2591 /* * Badness of converting a derived class pointer
2592 to a base class pointer. */
2593 extern const struct rank BASE_PTR_CONVERSION_BADNESS
;
2594 /* * Badness of integral conversion. */
2595 extern const struct rank INTEGER_CONVERSION_BADNESS
;
2596 /* * Badness of floating conversion. */
2597 extern const struct rank FLOAT_CONVERSION_BADNESS
;
2598 /* * Badness of integer<->floating conversions. */
2599 extern const struct rank INT_FLOAT_CONVERSION_BADNESS
;
2600 /* * Badness of conversion of pointer to void pointer. */
2601 extern const struct rank VOID_PTR_CONVERSION_BADNESS
;
2602 /* * Badness of conversion to boolean. */
2603 extern const struct rank BOOL_CONVERSION_BADNESS
;
2604 /* * Badness of converting derived to base class. */
2605 extern const struct rank BASE_CONVERSION_BADNESS
;
2606 /* * Badness of converting from non-reference to reference. Subrank
2607 is the type of reference conversion being done. */
2608 extern const struct rank REFERENCE_CONVERSION_BADNESS
;
2609 extern const struct rank REFERENCE_SEE_THROUGH_BADNESS
;
2610 /* * Conversion to rvalue reference. */
2611 #define REFERENCE_CONVERSION_RVALUE 1
2612 /* * Conversion to const lvalue reference. */
2613 #define REFERENCE_CONVERSION_CONST_LVALUE 2
2615 /* * Badness of converting integer 0 to NULL pointer. */
2616 extern const struct rank NULL_POINTER_CONVERSION
;
2617 /* * Badness of cv-conversion. Subrank is a flag describing the conversions
2619 extern const struct rank CV_CONVERSION_BADNESS
;
2620 #define CV_CONVERSION_CONST 1
2621 #define CV_CONVERSION_VOLATILE 2
2623 /* Non-standard conversions allowed by the debugger */
2625 /* * Converting a pointer to an int is usually OK. */
2626 extern const struct rank NS_POINTER_CONVERSION_BADNESS
;
2628 /* * Badness of converting a (non-zero) integer constant
2630 extern const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS
;
2632 extern struct rank
sum_ranks (struct rank a
, struct rank b
);
2633 extern int compare_ranks (struct rank a
, struct rank b
);
2635 extern int compare_badness (const badness_vector
&,
2636 const badness_vector
&);
2638 extern badness_vector
rank_function (gdb::array_view
<type
*> parms
,
2639 gdb::array_view
<value
*> args
);
2641 extern struct rank
rank_one_type (struct type
*, struct type
*,
2644 extern void recursive_dump_type (struct type
*, int);
2646 extern int field_is_static (struct field
*);
2650 extern void print_scalar_formatted (const gdb_byte
*, struct type
*,
2651 const struct value_print_options
*,
2652 int, struct ui_file
*);
2654 extern int can_dereference (struct type
*);
2656 extern int is_integral_type (struct type
*);
2658 extern int is_floating_type (struct type
*);
2660 extern int is_scalar_type (struct type
*type
);
2662 extern int is_scalar_type_recursive (struct type
*);
2664 extern int class_or_union_p (const struct type
*);
2666 extern void maintenance_print_type (const char *, int);
2668 extern htab_up
create_copied_types_hash ();
2670 extern struct type
*copy_type_recursive (struct type
*type
,
2671 htab_t copied_types
);
2673 extern struct type
*copy_type (const struct type
*type
);
2675 extern bool types_equal (struct type
*, struct type
*);
2677 extern bool types_deeply_equal (struct type
*, struct type
*);
2679 extern int type_not_allocated (const struct type
*type
);
2681 extern int type_not_associated (const struct type
*type
);
2683 /* Return True if TYPE is a TYPE_CODE_FIXED_POINT or if TYPE is
2684 a range type whose base type is a TYPE_CODE_FIXED_POINT. */
2685 extern bool is_fixed_point_type (struct type
*type
);
2687 /* Allocate a fixed-point type info for TYPE. This should only be
2688 called by INIT_FIXED_POINT_SPECIFIC. */
2689 extern void allocate_fixed_point_type_info (struct type
*type
);
2691 /* * When the type includes explicit byte ordering, return that.
2692 Otherwise, the byte ordering from gdbarch_byte_order for
2693 the type's arch is returned. */
2695 extern enum bfd_endian
type_byte_order (const struct type
*type
);
2697 /* A flag to enable printing of debugging information of C++
2700 extern unsigned int overload_debug
;
2702 /* Return whether the function type represented by TYPE is marked as unsafe
2703 to call by the debugger.
2705 This usually indicates that the function does not follow the target's
2706 standard calling convention. */
2708 extern bool is_nocall_function (const struct type
*type
);
2710 #endif /* GDBTYPES_H */