GDB (API)
Loading...
Searching...
No Matches
gdbtypes.h
Go to the documentation of this file.
1
2/* Internal type definitions for GDB.
3
4 Copyright (C) 1992-2023 Free Software Foundation, Inc.
5
6 Contributed by Cygnus Support, using pieces from other GDB modules.
7
8 This file is part of GDB.
9
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.
14
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.
19
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/>. */
22
23#if !defined (GDBTYPES_H)
24#define GDBTYPES_H 1
25
26/* * \page gdbtypes GDB Types
27
28 GDB represents all the different kinds of types in programming
29 languages using a common representation defined in gdbtypes.h.
30
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
36 convention).
37
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.
41
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.
45 */
46
47#include "hashtab.h"
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"
56#include "dwarf2.h"
57#include "gdbsupport/gdb_obstack.h"
58#include "gmp-utils.h"
59
60/* Forward declarations for prototypes. */
61struct field;
62struct block;
64struct language_defn;
68
69/* Some macros for char-based bitfields. */
70
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))
77
78/* * Different kinds of data types are distinguished by the `code'
79 field. */
80
82 {
85#define OP(X) X,
86#include "type-codes.def"
87#undef OP
88
89 };
90
91/* * Some bits for the type's instance_flags word. See the macros
92 below for documentation on each bit. */
93
106
108
109/* * Not textual. By default, GDB treats all single byte integers as
110 characters (or elements of strings) unless this flag is set. */
111
112#define TYPE_NOTTEXT(t) (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_NOTTEXT)
113
114/* * Constant type. If this is set, the corresponding type has a
115 const modifier. */
116
117#define TYPE_CONST(t) ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CONST) != 0)
118
119/* * Volatile type. If this is set, the corresponding type has a
120 volatile modifier. */
121
122#define TYPE_VOLATILE(t) \
123 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_VOLATILE) != 0)
124
125/* * Restrict type. If this is set, the corresponding type has a
126 restrict modifier. */
127
128#define TYPE_RESTRICT(t) \
129 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_RESTRICT) != 0)
130
131/* * Atomic type. If this is set, the corresponding type has an
132 _Atomic modifier. */
133
134#define TYPE_ATOMIC(t) \
135 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_ATOMIC) != 0)
136
137/* * True if this type represents either an lvalue or lvalue reference type. */
138
139#define TYPE_IS_REFERENCE(t) \
140 ((t)->code () == TYPE_CODE_REF || (t)->code () == TYPE_CODE_RVALUE_REF)
141
142/* * True if this type is allocatable. */
143#define TYPE_IS_ALLOCATABLE(t) \
144 ((t)->dyn_prop (DYN_PROP_ALLOCATED) != NULL)
145
146/* * True if this type has variant parts. */
147#define TYPE_HAS_VARIANT_PARTS(t) \
148 ((t)->dyn_prop (DYN_PROP_VARIANT_PARTS) != nullptr)
149
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)
153
154/* * Instruction-space delimited type. This is for Harvard architectures
155 which have separate instruction and data address spaces (and perhaps
156 others).
157
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.
161
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.
165
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.
169
170 If neither flag is set, the default space for functions / methods
171 is instruction space, and for data objects is data memory. */
172
173#define TYPE_CODE_SPACE(t) \
174 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CODE_SPACE) != 0)
175
176#define TYPE_DATA_SPACE(t) \
177 ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_DATA_SPACE) != 0)
178
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
184 classes. */
185
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)
194
195/* * Information about a single discriminant. */
196
198{
199 /* * The range of values for the variant. This is an inclusive
200 range. */
202
203 /* * Return true if VALUE is contained in this range. IS_UNSIGNED
204 is true if this should be an unsigned comparison; false for
205 signed. */
206 bool contains (ULONGEST value, bool is_unsigned) const
207 {
208 if (is_unsigned)
209 return value >= low && value <= high;
211 return valuel >= (LONGEST) low && valuel <= (LONGEST) high;
212 }
213};
214
215struct variant_part;
216
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. */
222
223struct variant : allocate_on_obstack
224{
225 /* * The discriminant ranges for this variant. */
226 gdb::array_view<discriminant_range> discriminants;
227
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. */
234
235 /* * Variant parts controlled by this variant. */
236 gdb::array_view<variant_part> parts;
237
238 /* * Return true if this is the default variant. The default
239 variant can be recognized because it has no associated
240 discriminants. */
241 bool is_default () const
242 {
243 return discriminants.empty ();
244 }
245
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;
249};
250
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. */
254
255struct variant_part : allocate_on_obstack
256{
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. */
262
263 /* * True if this discriminant is unsigned; false if signed. This
264 comes from the type of the discriminant. */
266
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;
270};
271
272
274{
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. */
283};
284
286{
287 /* Storage for constant property. */
288
290
291 /* Storage for dynamic property. */
292
294
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. */
301
302 const gdb::array_view<variant_part> *variant_parts;
303
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. */
307
309
310 /* Name of a variable to look up; the variable holds the value of
311 this property. */
312
313 const char *variable_name;
314};
315
316/* * Used to store a dynamic property. */
317
319{
321 {
322 return m_kind;
323 }
324
326 {
328 }
329
331 {
333
334 return m_data.const_val;
335 }
336
342
343 /* Return true if this property has a constant value, false
344 otherwise. */
345 bool is_constant () const
346 { return m_kind == PROP_CONST; }
347
349 {
351 || m_kind == PROP_LOCLIST
353
354 return m_data.baton;
355 }
356
362
368
374
375 const gdb::array_view<variant_part> *variant_parts () const
376 {
378
379 return m_data.variant_parts;
380 }
381
382 void set_variant_parts (gdb::array_view<variant_part> *variant_parts)
383 {
386 }
387
388 struct type *original_type () const
389 {
391
392 return m_data.original_type;
393 }
394
400
401 /* Return the name of the variable that holds this property's value.
402 Only valid for PROP_VARIABLE_NAME. */
403 const char *variable_name () const
404 {
406 return m_data.variable_name;
407 }
408
409 /* Set the name of the variable that holds this property's value,
410 and set this property to be of kind PROP_VARIABLE_NAME. */
411 void set_variable_name (const char *name)
412 {
414 m_data.variable_name = name;
415 }
416
417 /* Determine which field of the union dynamic_prop.data is used. */
419
420 /* Storage for dynamic or static value. */
422};
423
424/* Compare two dynamic_prop objects for equality. dynamic_prop
425 instances are equal iff they have the same type and storage. */
426extern bool operator== (const dynamic_prop &l, const dynamic_prop &r);
427
428/* Compare two dynamic_prop objects for inequality. */
429static inline bool operator!= (const dynamic_prop &l, const dynamic_prop &r)
430{
431 return !(l == r);
432}
433
434/* * Define a type's dynamic property node kind. */
436{
437 /* A property providing a type's data location.
438 Evaluating this field yields to the location of an object's data. */
440
441 /* A property representing DW_AT_allocated. The presence of this attribute
442 indicates that the object of the type can be allocated/deallocated. */
444
445 /* A property representing DW_AT_associated. The presence of this attribute
446 indicated that the object of the type can be associated. */
448
449 /* A property providing an array's byte stride. */
451
452 /* A property holding variant parts. */
454
455 /* A property representing DW_AT_rank. The presence of this attribute
456 indicates that the object is of assumed rank array type. */
458
459 /* A property holding the size of the type. */
461};
462
463/* * List for dynamic type attributes. */
465{
466 /* The kind of dynamic prop in this node. */
468
469 /* The dynamic property itself. */
471
472 /* A pointer to the next dynamic property. */
474};
475
476/* * Determine which field of the union main_type.fields[x].loc is
477 used. */
478
487
488/* * A discriminant to determine which field in the
489 main_type.type_specific union is being used, if any.
490
491 For types such as TYPE_CODE_FLT, the use of this
492 discriminant is really redundant, as we know from the type code
493 which field is going to be used. As such, it would be possible to
494 reduce the size of this enum in order to save a bit or two for
495 other fields of struct main_type. But, since we still have extra
496 room , and for the sake of clarity and consistency, we treat all fields
497 of the union the same way. */
498
511
513{
516};
517
519{
520 /* * Position of this field, counting in bits from start of
521 containing structure. For big-endian targets, it is the bit
522 offset to the MSB. For little-endian targets, it is the bit
523 offset to the LSB. */
524
526
527 /* * Enum value. */
529
530 /* * For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then
531 physaddr is the location (in the target) of the static
532 field. Otherwise, physname is the mangled label of the
533 static field. */
534
536 const char *physname;
537
538 /* * The field location can be computed by evaluating the
539 following DWARF block. Its DATA is allocated on
540 objfile_obstack - no CU load is needed to access it. */
541
543};
544
545struct field
546{
547 struct type *type () const
548 {
549 return this->m_type;
550 }
551
552 void set_type (struct type *type)
553 {
554 this->m_type = type;
555 }
556
557 const char *name () const
558 {
559 return m_name;
560 }
561
562 void set_name (const char *name)
563 {
564 m_name = name;
565 }
566
567 bool is_artificial () const
568 {
569 return m_artificial;
570 }
571
576
577 unsigned int bitsize () const
578 {
579 return m_bitsize;
580 }
581
582 void set_bitsize (unsigned int bitsize)
583 {
585 }
586
587 bool is_packed () const
588 {
589 return m_bitsize != 0;
590 }
591
592 /* Return true if this field is static; false if not. */
593 bool is_static () const
594 {
595 /* "static" fields are the fields whose location is not relative
596 to the address of the enclosing struct. It would be nice to
597 have a dedicated flag that would be set for static fields when
598 the type is being created. But in practice, checking the field
599 loc_kind should give us an accurate answer. */
602 }
603
604 /* Location getters / setters. */
605
607 {
608 return m_loc_kind;
609 }
610
612 {
614 return m_loc.bitpos;
615 }
616
618 {
620 m_loc.bitpos = bitpos;
621 }
622
624 {
626 return m_loc.enumval;
627 }
628
630 {
632 m_loc.enumval = enumval;
633 }
634
640
642 {
644 m_loc.physaddr = physaddr;
645 }
646
647 const char *loc_physname () const
648 {
650 return m_loc.physname;
651 }
652
653 void set_loc_physname (const char *physname)
654 {
656 m_loc.physname = physname;
657 }
658
664
666 {
668 m_loc.dwarf_block = dwarf_block;
669 }
670
672
673 /* * For a function or member type, this is 1 if the argument is
674 marked artificial. Artificial arguments should not be shown
675 to the user. For TYPE_CODE_RANGE it is set if the specific
676 bound is not defined. */
677
678 unsigned int m_artificial : 1;
679
680 /* * Discriminant for union field_location. */
681
683
684 /* * Size of this field, in bits, or zero if not packed.
685 If non-zero in an array type, indicates the element size in
686 bits (used only in Ada at the moment).
687 For an unpacked field, the field's type's length
688 says how many bytes the field occupies. */
689
690 unsigned int m_bitsize : 28;
691
692 /* * In a struct or union type, type of this field.
693 - In a function or member type, type of this argument.
694 - In an array type, the domain-type of the array. */
695
696 struct type *m_type;
697
698 /* * Name of field, value or argument.
699 NULL for range bounds, array domains, and member function
700 arguments. */
701
702 const char *m_name;
703};
704
706{
708 {
709 if (this->flag_is_byte_stride)
710 return this->stride.const_val () * 8;
711 else
712 return this->stride.const_val ();
713 }
714
715 /* * Low bound of range. */
716
718
719 /* * High bound of range. */
720
722
723 /* The stride value for this range. This can be stored in bits or bytes
724 based on the value of BYTE_STRIDE_P. It is optional to have a stride
725 value, if this range has no stride value defined then this will be set
726 to the constant zero. */
727
729
730 /* * The bias. Sometimes a range value is biased before storage.
731 The bias is added to the stored bits to form the true value. */
732
734
735 /* True if HIGH range bound contains the number of elements in the
736 subrange. This affects how the final high bound is computed. */
737
739
740 /* True if LOW or/and HIGH are resolved into a static bound from
741 a dynamic one. */
742
743 unsigned int flag_bound_evaluated : 1;
744
745 /* If this is true this STRIDE is in bytes, otherwise STRIDE is in bits. */
746
747 unsigned int flag_is_byte_stride : 1;
748};
749
750/* Compare two range_bounds objects for equality. Simply does
751 memberwise comparison. */
752extern bool operator== (const range_bounds &l, const range_bounds &r);
753
754/* Compare two range_bounds objects for inequality. */
755static inline bool operator!= (const range_bounds &l, const range_bounds &r)
756{
757 return !(l == r);
758}
759
761{
762 /* * CPLUS_STUFF is for TYPE_CODE_STRUCT. It is initialized to
763 point to cplus_struct_default, a default static instance of a
764 struct cplus_struct_type. */
765
767
768 /* * GNAT_STUFF is for types for which the GNAT Ada compiler
769 provides additional information. */
770
772
773 /* * FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to a
774 floatformat object that describes the floating-point value
775 that resides within the type. */
776
778
779 /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types. */
780
782
783 /* * For types that are pointer to member types (TYPE_CODE_METHODPTR,
784 TYPE_CODE_MEMBERPTR), SELF_TYPE is the type that this pointer
785 is a member of. */
786
788
789 /* * For TYPE_CODE_FIXED_POINT types, the info necessary to decode
790 values of that type. */
792
793 /* * An integer-like scalar type may be stored in just part of its
794 enclosing storage bytes. This structure describes this
795 situation. */
796 struct
797 {
798 /* * The bit size of the integer. This can be 0. For integers
799 that fill their storage (the ordinary case), this field holds
800 the byte size times 8. */
801 unsigned short bit_size;
802 /* * The bit offset of the integer. This is ordinarily 0, and can
803 only be non-zero if the bit size is less than the storage
804 size. */
805 unsigned short bit_offset;
807};
808
809/* * Main structure representing a type in GDB.
810
811 This structure is space-critical. Its layout has been tweaked to
812 reduce the space used. */
813
815{
816 /* * Code for kind of type. */
817
819
820 /* * Flags about this type. These fields appear at this location
821 because they packs nicely here. See the TYPE_* macros for
822 documentation about these fields. */
823
824 unsigned int m_flag_unsigned : 1;
825 unsigned int m_flag_nosign : 1;
826 unsigned int m_flag_stub : 1;
827 unsigned int m_flag_target_stub : 1;
828 unsigned int m_flag_prototyped : 1;
829 unsigned int m_flag_varargs : 1;
830 unsigned int m_flag_vector : 1;
831 unsigned int m_flag_stub_supported : 1;
832 unsigned int m_flag_gnu_ifunc : 1;
833 unsigned int m_flag_fixed_instance : 1;
834 unsigned int m_flag_objfile_owned : 1;
836
837 /* * True if this type was declared with "class" rather than
838 "struct". */
839
840 unsigned int m_flag_declared_class : 1;
841
842 /* * True if this is an enum type with disjoint values. This
843 affects how the enum is printed. */
844
845 unsigned int m_flag_flag_enum : 1;
846
847 /* * For TYPE_CODE_ARRAY, this is true if this type is part of a
848 multi-dimensional array. Multi-dimensional arrays are
849 represented internally as arrays of arrays, and this flag lets
850 gdb distinguish between multiple dimensions and an ordinary array
851 of arrays. The flag is set on each inner dimension, but not the
852 outermost dimension. */
853
854 unsigned int m_multi_dimensional : 1;
855
856 /* * A discriminant telling us which field of the type_specific
857 union is being used for this type, if any. */
858
860
861 /* The language for this type. */
862
864
865 /* * Number of fields described for this type. This field appears
866 at this location because it packs nicely here. */
867
868 unsigned int m_nfields;
869
870 /* * Name of this type, or NULL if none.
871
872 This is used for printing only. For looking up a name, look for
873 a symbol in the VAR_DOMAIN. This is generally allocated in the
874 objfile's obstack. However coffread.c uses malloc. */
875
876 const char *name;
877
878 /* * Every type is now associated with a particular objfile, and the
879 type is allocated on the objfile_obstack for that objfile. One
880 problem however, is that there are times when gdb allocates new
881 types while it is not in the process of reading symbols from a
882 particular objfile. Fortunately, these happen when the type
883 being created is a derived type of an existing type, such as in
884 lookup_pointer_type(). So we can just allocate the new type
885 using the same objfile as the existing type, but to do this we
886 need a backpointer to the objfile from the existing type. Yes
887 this is somewhat ugly, but without major overhaul of the internal
888 type system, it can't be avoided for now. */
889
891
892 /* * For a pointer type, describes the type of object pointed to.
893 - For an array type, describes the type of the elements.
894 - For a function or method type, describes the type of the return value.
895 - For a range type, describes the type of the full range.
896 - For a complex type, describes the type of each coordinate.
897 - For a special record or union type encoding a dynamic-sized type
898 in GNAT, a memoized pointer to a corresponding static version of
899 the type.
900 - Unused otherwise. */
901
903
904 /* * For structure and union types, a description of each field.
905 For set and pascal array types, there is one "field",
906 whose type is the domain type of the set or array.
907 For range types, there are two "fields",
908 the minimum and maximum values (both inclusive).
909 For enum types, each possible value is described by one "field".
910 For a function or method type, a "field" for each parameter.
911 For C++ classes, there is one field for each base class (if it is
912 a derived class) plus one field for each class data member. Member
913 functions are recorded elsewhere.
914
915 Using a pointer to a separate array of fields
916 allows all types to have the same size, which is useful
917 because we can allocate the space for a type before
918 we know what to put in it. */
919
920 union
921 {
922 struct field *fields;
923
924 /* * Union member used for range types. */
925
927
928 /* If this is a scalar type, then this is its corresponding
929 complex type. */
931
933
934 /* * Slot to point to additional language-specific fields of this
935 type. */
936
938
939 /* * Contains all dynamic type properties. */
941};
942
943/* * Number of bits allocated for alignment. */
944
945#define TYPE_ALIGN_BITS 8
946
947/* * A ``struct type'' describes a particular instance of a type, with
948 some particular qualification. */
949
950struct type
951{
952 /* Get the type code of this type.
953
954 Note that the code can be TYPE_CODE_TYPEDEF, so if you want the real
955 type, you need to do `check_typedef (type)->code ()`. */
957 {
958 return this->main_type->code;
959 }
960
961 /* Set the type code of this type. */
963 {
964 this->main_type->code = code;
965 }
966
967 /* Get the name of this type. */
968 const char *name () const
969 {
970 return this->main_type->name;
971 }
972
973 /* Set the name of this type. */
974 void set_name (const char *name)
975 {
976 this->main_type->name = name;
977 }
978
979 /* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
980 But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
981 so you only have to call check_typedef once. Since value::allocate
982 calls check_typedef, X->type ()->length () is safe. */
984 {
985 return this->m_length;
986 }
987
989 {
990 this->m_length = length;
991 }
992
993 /* Get the number of fields of this type. */
994 unsigned int num_fields () const
995 {
996 return this->main_type->m_nfields;
997 }
998
999 /* Set the number of fields of this type. */
1000 void set_num_fields (unsigned int num_fields)
1001 {
1003 }
1004
1005 /* Get the fields array of this type. */
1006 struct field *fields () const
1007 {
1008 return this->main_type->flds_bnds.fields;
1009 }
1010
1011 /* Get the field at index IDX. */
1012 struct field &field (int idx) const
1013 {
1014 gdb_assert (idx >= 0 && idx < num_fields ());
1015 return this->fields ()[idx];
1016 }
1017
1018 /* Set the fields array of this type. */
1019 void set_fields (struct field *fields)
1020 {
1022 }
1023
1024 /* Allocate the fields array of this type, with NFIELDS elements. If INIT,
1025 zero-initialize the allocated memory. */
1026 void alloc_fields (unsigned int nfields, bool init = true);
1027
1028 /* Allocate the fields array of this type, and copy the fields from SRC. */
1029 void copy_fields (struct type *src);
1030 void copy_fields (std::vector<struct field> &src);
1031
1033 {
1034 return this->field (0).type ();
1035 }
1036
1037 struct type *target_type () const
1038 {
1039 return this->main_type->m_target_type;
1040 }
1041
1043 {
1045 }
1046
1048 {
1049 this->field (0).set_type (index_type);
1050 }
1051
1052 /* Return the instance flags converted to the correct type. */
1054 {
1055 return (enum type_instance_flag_value) this->m_instance_flags;
1056 }
1057
1058 /* Set the instance flags. */
1063
1064 /* Get the bounds bounds of this type. The type must be a range type. */
1066 {
1067 switch (this->code ())
1068 {
1069 case TYPE_CODE_RANGE:
1070 return this->main_type->flds_bnds.bounds;
1071
1072 case TYPE_CODE_ARRAY:
1073 case TYPE_CODE_STRING:
1074 return this->index_type ()->bounds ();
1075
1076 default:
1078 ("type::bounds called on type with invalid code");
1079 }
1080 }
1081
1082 /* Set the bounds of this type. The type must be a range type. */
1084 {
1085 gdb_assert (this->code () == TYPE_CODE_RANGE);
1086
1088 }
1089
1091 {
1092 if (this->code () == TYPE_CODE_ARRAY && this->field (0).bitsize () != 0)
1093 return this->field (0).bitsize ();
1094 return this->bounds ()->bit_stride ();
1095 }
1096
1097 /* Unsigned integer type. If this is not set for a TYPE_CODE_INT,
1098 the type is signed (unless TYPE_NOSIGN is set). */
1099
1100 bool is_unsigned () const
1101 {
1102 return this->main_type->m_flag_unsigned;
1103 }
1104
1106 {
1108 }
1109
1110 /* No sign for this type. In C++, "char", "signed char", and
1111 "unsigned char" are distinct types; so we need an extra flag to
1112 indicate the absence of a sign! */
1113
1114 bool has_no_signedness () const
1115 {
1116 return this->main_type->m_flag_nosign;
1117 }
1118
1123
1124 /* This appears in a type's flags word if it is a stub type (e.g.,
1125 if someone referenced a type that wasn't defined in a source file
1126 via (struct sir_not_appearing_in_this_film *)). */
1127
1128 bool is_stub () const
1129 {
1130 return this->main_type->m_flag_stub;
1131 }
1132
1134 {
1135 this->main_type->m_flag_stub = is_stub;
1136 }
1137
1138 /* The target type of this type is a stub type, and this type needs
1139 to be updated if it gets un-stubbed in check_typedef. Used for
1140 arrays and ranges, in which TYPE_LENGTH of the array/range gets set
1141 based on the TYPE_LENGTH of the target type. Also, set for
1142 TYPE_CODE_TYPEDEF. */
1143
1144 bool target_is_stub () const
1145 {
1146 return this->main_type->m_flag_target_stub;
1147 }
1148
1153
1154 /* This is a function type which appears to have a prototype. We
1155 need this for function calls in order to tell us if it's necessary
1156 to coerce the args, or to just do the standard conversions. This
1157 is used with a short field. */
1158
1159 bool is_prototyped () const
1160 {
1161 return this->main_type->m_flag_prototyped;
1162 }
1163
1168
1169 /* FIXME drow/2002-06-03: Only used for methods, but applies as well
1170 to functions. */
1171
1172 bool has_varargs () const
1173 {
1174 return this->main_type->m_flag_varargs;
1175 }
1176
1178 {
1180 }
1181
1182 /* Identify a vector type. Gcc is handling this by adding an extra
1183 attribute to the array type. We slurp that in as a new flag of a
1184 type. This is used only in dwarf2read.c. */
1185
1186 bool is_vector () const
1187 {
1188 return this->main_type->m_flag_vector;
1189 }
1190
1192 {
1194 }
1195
1196 /* This debug target supports TYPE_STUB(t). In the unsupported case
1197 we have to rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE().
1198 TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only
1199 guessed the TYPE_STUB(t) value (see dwarfread.c). */
1200
1201 bool stub_is_supported () const
1202 {
1203 return this->main_type->m_flag_stub_supported;
1204 }
1205
1210
1211 /* Used only for TYPE_CODE_FUNC where it specifies the real function
1212 address is returned by this function call. The target_type method
1213 determines the final returned function type to be presented to
1214 user. */
1215
1216 bool is_gnu_ifunc () const
1217 {
1218 return this->main_type->m_flag_gnu_ifunc;
1219 }
1220
1222 {
1224 }
1225
1226 /* The debugging formats (especially STABS) do not contain enough
1227 information to represent all Ada types---especially those whose
1228 size depends on dynamic quantities. Therefore, the GNAT Ada
1229 compiler includes extra information in the form of additional type
1230 definitions connected by naming conventions. This flag indicates
1231 that the type is an ordinary (unencoded) GDB type that has been
1232 created from the necessary run-time information, and does not need
1233 further interpretation. Optionally marks ordinary, fixed-size GDB
1234 type. */
1235
1236 bool is_fixed_instance () const
1237 {
1238 return this->main_type->m_flag_fixed_instance;
1239 }
1240
1245
1246 /* A compiler may supply dwarf instrumentation that indicates the desired
1247 endian interpretation of the variable differs from the native endian
1248 representation. */
1249
1251 {
1253 }
1254
1259
1260
1261 /* True if this type was declared using the "class" keyword. This is
1262 only valid for C++ structure and enum types. If false, a structure
1263 was declared as a "struct"; if true it was declared "class". For
1264 enum types, this is true when "enum class" or "enum struct" was
1265 used to declare the type. */
1266
1267 bool is_declared_class () const
1268 {
1269 return this->main_type->m_flag_declared_class;
1270 }
1271
1276
1277 /* True if this type is a "flag" enum. A flag enum is one where all
1278 the values are pairwise disjoint when "and"ed together. This
1279 affects how enum values are printed. */
1280
1281 bool is_flag_enum () const
1282 {
1283 return this->main_type->m_flag_flag_enum;
1284 }
1285
1287 {
1289 }
1290
1291 /* True if this array type is part of a multi-dimensional array. */
1292
1294 {
1295 return this->main_type->m_multi_dimensional;
1296 }
1297
1299 {
1301 }
1302
1303 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return a reference
1304 to this type's fixed_point_info. */
1305
1307 {
1310
1312 }
1313
1314 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, set this type's
1315 fixed_point_info to INFO. */
1316
1318 {
1320
1322 }
1323
1324 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return its base type.
1325
1326 In other words, this returns the type after having peeled all
1327 intermediate type layers (such as TYPE_CODE_RANGE, for instance).
1328 The TYPE_CODE of the type returned is guaranteed to be
1329 a TYPE_CODE_FIXED_POINT. */
1330
1332
1333 /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return its scaling
1334 factor. */
1335
1337
1338 /* * Return the dynamic property of the requested KIND from this type's
1339 list of dynamic properties. */
1341
1342 /* * Given a dynamic property PROP of a given KIND, add this dynamic
1343 property to this type.
1344
1345 This function assumes that this type is objfile-owned. */
1347
1348 /* * Remove dynamic property of kind KIND from this type, if it exists. */
1350
1351 /* Return true if this type is owned by an objfile. Return false if it is
1352 owned by an architecture. */
1353 bool is_objfile_owned () const
1354 {
1355 return this->main_type->m_flag_objfile_owned;
1356 }
1357
1358 /* Set the owner of the type to be OBJFILE. */
1359 void set_owner (objfile *objfile)
1360 {
1361 gdb_assert (objfile != nullptr);
1362
1363 this->main_type->m_owner.objfile = objfile;
1364 this->main_type->m_flag_objfile_owned = true;
1365 }
1366
1367 /* Set the owner of the type to be ARCH. */
1368 void set_owner (gdbarch *arch)
1369 {
1370 gdb_assert (arch != nullptr);
1371
1372 this->main_type->m_owner.gdbarch = arch;
1373 this->main_type->m_flag_objfile_owned = false;
1374 }
1375
1376 /* Return the objfile owner of this type.
1377
1378 Return nullptr if this type is not objfile-owned. */
1379 struct objfile *objfile_owner () const
1380 {
1381 if (!this->is_objfile_owned ())
1382 return nullptr;
1383
1384 return this->main_type->m_owner.objfile;
1385 }
1386
1387 /* Return the gdbarch owner of this type.
1388
1389 Return nullptr if this type is not gdbarch-owned. */
1390 gdbarch *arch_owner () const
1391 {
1392 if (this->is_objfile_owned ())
1393 return nullptr;
1394
1395 return this->main_type->m_owner.gdbarch;
1396 }
1397
1398 /* Return the type's architecture. For types owned by an
1399 architecture, that architecture is returned. For types owned by an
1400 objfile, that objfile's architecture is returned.
1401
1402 The return value is always non-nullptr. */
1403 gdbarch *arch () const;
1404
1405 /* * Return true if this is an integer type whose logical (bit) size
1406 differs from its storage size; false otherwise. Always return
1407 false for non-integer (i.e., non-TYPE_SPECIFIC_INT) types. */
1409 {
1412 }
1413
1414 /* * Return the logical (bit) size for this integer type. Only
1415 valid for integer (TYPE_SPECIFIC_INT) types. */
1416 unsigned short bit_size () const
1417 {
1420 }
1421
1422 /* * Return the bit offset for this integer type. Only valid for
1423 integer (TYPE_SPECIFIC_INT) types. */
1424 unsigned short bit_offset () const
1425 {
1428 }
1429
1430 /* Return true if this is a pointer or reference type. */
1432 {
1433 return this->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (this);
1434 }
1435
1436 /* Return true if this type is "string-like", according to its
1437 defining language. */
1439
1440 /* Return true if this type is "array-like". This includes arrays,
1441 but also some forms of structure type that are recognized as
1442 representations of arrays by the type's language. */
1444
1445 /* Return the language that this type came from. */
1446 enum language language () const
1447 { return main_type->m_lang; }
1448
1449 /* * Type that is a pointer to this type.
1450 NULL if no such pointer-to type is known yet.
1451 The debugger may add the address of such a type
1452 if it has to construct one later. */
1453
1455
1456 /* * C++: also need a reference type. */
1457
1459
1460 /* * A C++ rvalue reference type added in C++11. */
1461
1463
1464 /* * Variant chain. This points to a type that differs from this
1465 one only in qualifiers and length. Currently, the possible
1466 qualifiers are const, volatile, code-space, data-space, and
1467 address class. The length may differ only when one of the
1468 address class flags are set. The variants are linked in a
1469 circular ring and share MAIN_TYPE. */
1470
1471 struct type *chain;
1472
1473 /* * The alignment for this type. Zero means that the alignment was
1474 not specified in the debug info. Note that this is stored in a
1475 funny way: as the log base 2 (plus 1) of the alignment; so a
1476 value of 1 means the alignment is 1, and a value of 9 means the
1477 alignment is 256. */
1478
1480
1481 /* * Flags specific to this instance of the type, indicating where
1482 on the ring we are.
1483
1484 For TYPE_CODE_TYPEDEF the flags of the typedef type should be
1485 binary or-ed with the target type, with a special case for
1486 address class and space class. For example if this typedef does
1487 not specify any new qualifiers, TYPE_INSTANCE_FLAGS is 0 and the
1488 instance flags are completely inherited from the target type. No
1489 qualifiers can be cleared by the typedef. See also
1490 check_typedef. */
1491 unsigned m_instance_flags : 9;
1492
1493 /* * Length of storage for a value of this type. The value is the
1494 expression in host bytes of what sizeof(type) would return. This
1495 size includes padding. For example, an i386 extended-precision
1496 floating point value really only occupies ten bytes, but most
1497 ABI's declare its size to be 12 bytes, to preserve alignment.
1498 A `struct type' representing such a floating-point type would
1499 have a `length' value of 12, even though the last two bytes are
1500 unused.
1501
1502 Since this field is expressed in host bytes, its value is appropriate
1503 to pass to memcpy and such (it is assumed that GDB itself always runs
1504 on an 8-bits addressable architecture). However, when using it for
1505 target address arithmetic (e.g. adding it to a target address), the
1506 type_length_units function should be used in order to get the length
1507 expressed in target addressable memory units. */
1508
1510
1511 /* * Core type, shared by a group of qualified types. */
1512
1514};
1515
1517{
1518
1519 /* * The overloaded name.
1520 This is generally allocated in the objfile's obstack.
1521 However stabsread.c sometimes uses malloc. */
1522
1523 const char *name;
1524
1525 /* * The number of methods with this name. */
1526
1528
1529 /* * The list of methods. */
1530
1532};
1533
1534
1535
1537{
1538 /* * If is_stub is clear, this is the mangled name which we can look
1539 up to find the address of the method (FIXME: it would be cleaner
1540 to have a pointer to the struct symbol here instead).
1541
1542 If is_stub is set, this is the portion of the mangled name which
1543 specifies the arguments. For example, "ii", if there are two int
1544 arguments, or "" if there are no arguments. See gdb_mangle_name
1545 for the conversion from this format to the one used if is_stub is
1546 clear. */
1547
1548 const char *physname;
1549
1550 /* * The function type for the method.
1551
1552 (This comment used to say "The return value of the method", but
1553 that's wrong. The function type is expected here, i.e. something
1554 with TYPE_CODE_METHOD, and *not* the return-value type). */
1555
1556 struct type *type;
1557
1558 /* * For virtual functions. First baseclass that defines this
1559 virtual function. */
1560
1562
1563 /* Attributes. */
1564
1565 unsigned int is_const:1;
1566 unsigned int is_volatile:1;
1567 unsigned int is_private:1;
1568 unsigned int is_protected:1;
1569 unsigned int is_artificial:1;
1570
1571 /* * A stub method only has some fields valid (but they are enough
1572 to reconstruct the rest of the fields). */
1573
1574 unsigned int is_stub:1;
1575
1576 /* * True if this function is a constructor, false otherwise. */
1577
1578 unsigned int is_constructor : 1;
1579
1580 /* * True if this function is deleted, false otherwise. */
1581
1582 unsigned int is_deleted : 1;
1583
1584 /* * DW_AT_defaulted attribute for this function. The value is one
1585 of the DW_DEFAULTED constants. */
1586
1588
1589 /* * Unused. */
1590
1591 unsigned int dummy:6;
1592
1593 /* * Index into that baseclass's virtual function table, minus 2;
1594 else if static: VOFFSET_STATIC; else: 0. */
1595
1596 unsigned int voffset:16;
1597
1598#define VOFFSET_STATIC 1
1599
1600};
1601
1603{
1604 /* * Unqualified name to be prefixed by owning class qualified
1605 name. */
1606
1607 const char *name;
1608
1609 /* * Type this typedef named NAME represents. */
1610
1611 struct type *type;
1612
1613 /* * True if this field was declared protected, false otherwise. */
1614 unsigned int is_protected : 1;
1615
1616 /* * True if this field was declared private, false otherwise. */
1617 unsigned int is_private : 1;
1618};
1619
1620/* * C++ language-specific information for TYPE_CODE_STRUCT and
1621 TYPE_CODE_UNION nodes. */
1622
1624 {
1625 /* * Number of base classes this type derives from. The
1626 baseclasses are stored in the first N_BASECLASSES fields
1627 (i.e. the `fields' field of the struct type). The only fields
1628 of struct field that are used are: type, name, loc.bitpos. */
1629
1631
1632 /* * Field number of the virtual function table pointer in VPTR_BASETYPE.
1633 All access to this field must be through TYPE_VPTR_FIELDNO as one
1634 thing it does is check whether the field has been initialized.
1635 Initially TYPE_RAW_CPLUS_SPECIFIC has the value of cplus_struct_default,
1636 which for portability reasons doesn't initialize this field.
1637 TYPE_VPTR_FIELDNO returns -1 for this case.
1638
1639 If -1, we were unable to find the virtual function table pointer in
1640 initial symbol reading, and get_vptr_fieldno should be called to find
1641 it if possible. get_vptr_fieldno will update this field if possible.
1642 Otherwise the value is left at -1.
1643
1644 Unused if this type does not have virtual functions. */
1645
1647
1648 /* * Number of methods with unique names. All overloaded methods
1649 with the same name count only once. */
1650
1652
1653 /* * Number of template arguments. */
1654
1655 unsigned short n_template_arguments;
1656
1657 /* * One if this struct is a dynamic class, as defined by the
1658 Itanium C++ ABI: if it requires a virtual table pointer,
1659 because it or any of its base classes have one or more virtual
1660 member functions or virtual base classes. Minus one if not
1661 dynamic. Zero if not yet computed. */
1662
1663 int is_dynamic : 2;
1664
1665 /* * The calling convention for this type, fetched from the
1666 DW_AT_calling_convention attribute. The value is one of the
1667 DW_CC constants. */
1668
1670
1671 /* * The base class which defined the virtual function table pointer. */
1672
1674
1675 /* * For derived classes, the number of base classes is given by
1676 n_baseclasses and virtual_field_bits is a bit vector containing
1677 one bit per base class. If the base class is virtual, the
1678 corresponding bit will be set.
1679 I.E, given:
1680
1681 class A{};
1682 class B{};
1683 class C : public B, public virtual A {};
1684
1685 B is a baseclass of C; A is a virtual baseclass for C.
1686 This is a C++ 2.0 language feature. */
1687
1689
1690 /* * For classes with private fields, the number of fields is
1691 given by nfields and private_field_bits is a bit vector
1692 containing one bit per field.
1693
1694 If the field is private, the corresponding bit will be set. */
1695
1697
1698 /* * For classes with protected fields, the number of fields is
1699 given by nfields and protected_field_bits is a bit vector
1700 containing one bit per field.
1701
1702 If the field is private, the corresponding bit will be set. */
1703
1705
1706 /* * For classes with fields to be ignored, either this is
1707 optimized out or this field has length 0. */
1708
1710
1711 /* * For classes, structures, and unions, a description of each
1712 field, which consists of an overloaded name, followed by the
1713 types of arguments that the method expects, and then the name
1714 after it has been renamed to make it distinct.
1715
1716 fn_fieldlists points to an array of nfn_fields of these. */
1717
1719
1720 /* * typedefs defined inside this class. typedef_field points to
1721 an array of typedef_field_count elements. */
1722
1724
1726
1727 /* * The nested types defined by this type. nested_types points to
1728 an array of nested_types_count elements. */
1729
1731
1733
1734 /* * The template arguments. This is an array with
1735 N_TEMPLATE_ARGUMENTS elements. This is NULL for non-template
1736 classes. */
1737
1739 };
1740
1741/* * Struct used to store conversion rankings. */
1742
1743struct rank
1744 {
1745 short rank;
1746
1747 /* * When two conversions are of the same type and therefore have
1748 the same rank, subrank is used to differentiate the two.
1749
1750 Eg: Two derived-class-pointer to base-class-pointer conversions
1751 would both have base pointer conversion rank, but the
1752 conversion with the shorter distance to the ancestor is
1753 preferable. 'subrank' would be used to reflect that. */
1754
1755 short subrank;
1756 };
1757
1758/* * Used for ranking a function for overload resolution. */
1759
1760typedef std::vector<rank> badness_vector;
1761
1762/* * GNAT Ada-specific information for various Ada types. */
1763
1765 {
1766 /* * Parallel type used to encode information about dynamic types
1767 used in Ada (such as variant records, variable-size array,
1768 etc). */
1770 };
1771
1772/* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types. */
1773
1775 {
1776 /* * The calling convention for targets supporting multiple ABIs.
1777 Right now this is only fetched from the Dwarf-2
1778 DW_AT_calling_convention attribute. The value is one of the
1779 DW_CC constants. */
1780
1782
1783 /* * Whether this function normally returns to its caller. It is
1784 set from the DW_AT_noreturn attribute if set on the
1785 DW_TAG_subprogram. */
1786
1787 unsigned int is_noreturn : 1;
1788
1789 /* * Only those DW_TAG_call_site's in this function that have
1790 DW_AT_call_tail_call set are linked in this list. Function
1791 without its tail call list complete
1792 (DW_AT_call_all_tail_calls or its superset
1793 DW_AT_call_all_calls) has TAIL_CALL_LIST NULL, even if some
1794 DW_TAG_call_site's exist in such function. */
1795
1797
1798 /* * For method types (TYPE_CODE_METHOD), the aggregate type that
1799 contains the method. */
1800
1802 };
1803
1804/* The type-specific info for TYPE_CODE_FIXED_POINT types. */
1805
1807{
1808 /* The fixed point type's scaling factor. */
1810};
1811
1812/* * The default value of TYPE_CPLUS_SPECIFIC(T) points to this shared
1813 static structure. */
1814
1815extern const struct cplus_struct_type cplus_struct_default;
1816
1817extern void allocate_cplus_struct_type (struct type *);
1818
1819#define INIT_CPLUS_SPECIFIC(type) \
1820 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_CPLUS_STUFF, \
1821 TYPE_RAW_CPLUS_SPECIFIC (type) = (struct cplus_struct_type*) \
1822 &cplus_struct_default)
1823
1824#define ALLOCATE_CPLUS_STRUCT_TYPE(type) allocate_cplus_struct_type (type)
1825
1826#define HAVE_CPLUS_STRUCT(type) \
1827 (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_CPLUS_STUFF \
1828 && TYPE_RAW_CPLUS_SPECIFIC (type) != &cplus_struct_default)
1829
1830#define INIT_NONE_SPECIFIC(type) \
1831 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_NONE, \
1832 TYPE_MAIN_TYPE (type)->type_specific = {})
1833
1834extern const struct gnat_aux_type gnat_aux_default;
1835
1836extern void allocate_gnat_aux_type (struct type *);
1837
1838#define INIT_GNAT_SPECIFIC(type) \
1839 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_GNAT_STUFF, \
1840 TYPE_GNAT_SPECIFIC (type) = (struct gnat_aux_type *) &gnat_aux_default)
1841#define ALLOCATE_GNAT_AUX_TYPE(type) allocate_gnat_aux_type (type)
1842/* * A macro that returns non-zero if the type-specific data should be
1843 read as "gnat-stuff". */
1844#define HAVE_GNAT_AUX_INFO(type) \
1845 (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF)
1846
1847/* * True if TYPE is known to be an Ada type of some kind. */
1848#define ADA_TYPE_P(type) \
1849 (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF \
1850 || (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE \
1851 && (type)->is_fixed_instance ()))
1852
1853#define INIT_FUNC_SPECIFIC(type) \
1854 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC, \
1855 TYPE_MAIN_TYPE (type)->type_specific.func_stuff = (struct func_type *) \
1856 TYPE_ZALLOC (type, \
1857 sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
1858
1859/* "struct fixed_point_type_info" has a field that has a destructor.
1860 See allocate_fixed_point_type_info to understand how this is
1861 handled. */
1862#define INIT_FIXED_POINT_SPECIFIC(type) \
1863 (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \
1864 allocate_fixed_point_type_info (type))
1865
1866#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
1867#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
1868#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
1869#define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type
1870#define TYPE_CHAIN(thistype) (thistype)->chain
1871
1872/* * Return the alignment of the type in target addressable memory
1873 units, or 0 if no alignment was specified. */
1874#define TYPE_RAW_ALIGN(thistype) type_raw_align (thistype)
1875
1876/* * Return the alignment of the type in target addressable memory
1877 units, or 0 if no alignment was specified. */
1878extern unsigned type_raw_align (struct type *);
1879
1880/* * Return the alignment of the type in target addressable memory
1881 units. Return 0 if the alignment cannot be determined; but note
1882 that this makes an effort to compute the alignment even it it was
1883 not specified in the debug info. */
1884extern unsigned type_align (struct type *);
1885
1886/* * Set the alignment of the type. The alignment must be a power of
1887 2. Returns false if the given value does not fit in the available
1888 space in struct type. */
1889extern bool set_type_align (struct type *, ULONGEST);
1890
1891/* Property accessors for the type data location. */
1892#define TYPE_DATA_LOCATION(thistype) \
1893 ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION))
1894#define TYPE_DATA_LOCATION_BATON(thistype) \
1895 TYPE_DATA_LOCATION (thistype)->data.baton
1896#define TYPE_DATA_LOCATION_ADDR(thistype) \
1897 (TYPE_DATA_LOCATION (thistype)->const_val ())
1898#define TYPE_DATA_LOCATION_KIND(thistype) \
1899 (TYPE_DATA_LOCATION (thistype)->kind ())
1900#define TYPE_DYNAMIC_LENGTH(thistype) \
1901 ((thistype)->dyn_prop (DYN_PROP_BYTE_SIZE))
1902
1903/* Property accessors for the type allocated/associated. */
1904#define TYPE_ALLOCATED_PROP(thistype) \
1905 ((thistype)->dyn_prop (DYN_PROP_ALLOCATED))
1906#define TYPE_ASSOCIATED_PROP(thistype) \
1907 ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED))
1908#define TYPE_RANK_PROP(thistype) \
1909 ((thistype)->dyn_prop (DYN_PROP_RANK))
1910
1911/* C++ */
1912
1913#define TYPE_SELF_TYPE(thistype) internal_type_self_type (thistype)
1914/* Do not call this, use TYPE_SELF_TYPE. */
1915extern struct type *internal_type_self_type (struct type *);
1916extern void set_type_self_type (struct type *, struct type *);
1917
1918extern int internal_type_vptr_fieldno (struct type *);
1919extern void set_type_vptr_fieldno (struct type *, int);
1920extern struct type *internal_type_vptr_basetype (struct type *);
1921extern void set_type_vptr_basetype (struct type *, struct type *);
1922#define TYPE_VPTR_FIELDNO(thistype) internal_type_vptr_fieldno (thistype)
1923#define TYPE_VPTR_BASETYPE(thistype) internal_type_vptr_basetype (thistype)
1924
1925#define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
1926#define TYPE_SPECIFIC_FIELD(thistype) \
1927 TYPE_MAIN_TYPE(thistype)->type_specific_field
1928/* We need this tap-dance with the TYPE_RAW_SPECIFIC because of the case
1929 where we're trying to print an Ada array using the C language.
1930 In that case, there is no "cplus_stuff", but the C language assumes
1931 that there is. What we do, in that case, is pretend that there is
1932 an implicit one which is the default cplus stuff. */
1933#define TYPE_CPLUS_SPECIFIC(thistype) \
1934 (!HAVE_CPLUS_STRUCT(thistype) \
1935 ? (struct cplus_struct_type*)&cplus_struct_default \
1936 : TYPE_RAW_CPLUS_SPECIFIC(thistype))
1937#define TYPE_RAW_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
1938#define TYPE_CPLUS_CALLING_CONVENTION(thistype) \
1939 TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff->calling_convention
1940#define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
1941#define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
1942#define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
1943#define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->calling_convention
1944#define TYPE_NO_RETURN(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->is_noreturn
1945#define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->tail_call_list
1946#define TYPE_BASECLASS(thistype,index) ((thistype)->field (index).type ())
1947#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
1948#define TYPE_BASECLASS_NAME(thistype,index) (thistype->field (index).name ())
1949#define TYPE_BASECLASS_BITPOS(thistype,index) (thistype->field (index).loc_bitpos ())
1950#define BASETYPE_VIA_PUBLIC(thistype, index) \
1951 ((!TYPE_FIELD_PRIVATE(thistype, index)) && (!TYPE_FIELD_PROTECTED(thistype, index)))
1952#define TYPE_CPLUS_DYNAMIC(thistype) TYPE_CPLUS_SPECIFIC (thistype)->is_dynamic
1953
1954#define BASETYPE_VIA_VIRTUAL(thistype, index) \
1955 (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
1956 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
1957
1958#define TYPE_FIELD_PRIVATE_BITS(thistype) \
1959 TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
1960#define TYPE_FIELD_PROTECTED_BITS(thistype) \
1961 TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits
1962#define TYPE_FIELD_IGNORE_BITS(thistype) \
1963 TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits
1964#define TYPE_FIELD_VIRTUAL_BITS(thistype) \
1965 TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits
1966#define SET_TYPE_FIELD_PRIVATE(thistype, n) \
1967 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n))
1968#define SET_TYPE_FIELD_PROTECTED(thistype, n) \
1969 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n))
1970#define SET_TYPE_FIELD_IGNORE(thistype, n) \
1971 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n))
1972#define SET_TYPE_FIELD_VIRTUAL(thistype, n) \
1973 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))
1974#define TYPE_FIELD_PRIVATE(thistype, n) \
1975 (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits == NULL ? 0 \
1976 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n)))
1977#define TYPE_FIELD_PROTECTED(thistype, n) \
1978 (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits == NULL ? 0 \
1979 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n)))
1980#define TYPE_FIELD_IGNORE(thistype, n) \
1981 (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits == NULL ? 0 \
1982 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n)))
1983#define TYPE_FIELD_VIRTUAL(thistype, n) \
1984 (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
1985 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n)))
1986
1987#define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists
1988#define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n]
1989#define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields
1990#define TYPE_FN_FIELDLIST_NAME(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].name
1991#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].length
1992
1993#define TYPE_N_TEMPLATE_ARGUMENTS(thistype) \
1994 TYPE_CPLUS_SPECIFIC (thistype)->n_template_arguments
1995#define TYPE_TEMPLATE_ARGUMENTS(thistype) \
1996 TYPE_CPLUS_SPECIFIC (thistype)->template_arguments
1997#define TYPE_TEMPLATE_ARGUMENT(thistype, n) \
1998 TYPE_CPLUS_SPECIFIC (thistype)->template_arguments[n]
1999
2000#define TYPE_FN_FIELD(thisfn, n) (thisfn)[n]
2001#define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname
2002#define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type
2003#define TYPE_FN_FIELD_ARGS(thisfn, n) (((thisfn)[n].type)->fields ())
2004#define TYPE_FN_FIELD_CONST(thisfn, n) ((thisfn)[n].is_const)
2005#define TYPE_FN_FIELD_VOLATILE(thisfn, n) ((thisfn)[n].is_volatile)
2006#define TYPE_FN_FIELD_PRIVATE(thisfn, n) ((thisfn)[n].is_private)
2007#define TYPE_FN_FIELD_PROTECTED(thisfn, n) ((thisfn)[n].is_protected)
2008#define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n) ((thisfn)[n].is_artificial)
2009#define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
2010#define TYPE_FN_FIELD_CONSTRUCTOR(thisfn, n) ((thisfn)[n].is_constructor)
2011#define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext)
2012#define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
2013#define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
2014#define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
2015#define TYPE_FN_FIELD_DEFAULTED(thisfn, n) ((thisfn)[n].defaulted)
2016#define TYPE_FN_FIELD_DELETED(thisfn, n) ((thisfn)[n].is_deleted)
2017
2018/* Accessors for typedefs defined by a class. */
2019#define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \
2020 TYPE_CPLUS_SPECIFIC (thistype)->typedef_field
2021#define TYPE_TYPEDEF_FIELD(thistype, n) \
2022 TYPE_CPLUS_SPECIFIC (thistype)->typedef_field[n]
2023#define TYPE_TYPEDEF_FIELD_NAME(thistype, n) \
2024 TYPE_TYPEDEF_FIELD (thistype, n).name
2025#define TYPE_TYPEDEF_FIELD_TYPE(thistype, n) \
2026 TYPE_TYPEDEF_FIELD (thistype, n).type
2027#define TYPE_TYPEDEF_FIELD_COUNT(thistype) \
2028 TYPE_CPLUS_SPECIFIC (thistype)->typedef_field_count
2029#define TYPE_TYPEDEF_FIELD_PROTECTED(thistype, n) \
2030 TYPE_TYPEDEF_FIELD (thistype, n).is_protected
2031#define TYPE_TYPEDEF_FIELD_PRIVATE(thistype, n) \
2032 TYPE_TYPEDEF_FIELD (thistype, n).is_private
2033
2034#define TYPE_NESTED_TYPES_ARRAY(thistype) \
2035 TYPE_CPLUS_SPECIFIC (thistype)->nested_types
2036#define TYPE_NESTED_TYPES_FIELD(thistype, n) \
2037 TYPE_CPLUS_SPECIFIC (thistype)->nested_types[n]
2038#define TYPE_NESTED_TYPES_FIELD_NAME(thistype, n) \
2039 TYPE_NESTED_TYPES_FIELD (thistype, n).name
2040#define TYPE_NESTED_TYPES_FIELD_TYPE(thistype, n) \
2041 TYPE_NESTED_TYPES_FIELD (thistype, n).type
2042#define TYPE_NESTED_TYPES_COUNT(thistype) \
2043 TYPE_CPLUS_SPECIFIC (thistype)->nested_types_count
2044#define TYPE_NESTED_TYPES_FIELD_PROTECTED(thistype, n) \
2045 TYPE_NESTED_TYPES_FIELD (thistype, n).is_protected
2046#define TYPE_NESTED_TYPES_FIELD_PRIVATE(thistype, n) \
2047 TYPE_NESTED_TYPES_FIELD (thistype, n).is_private
2048
2049#define TYPE_IS_OPAQUE(thistype) \
2050 ((((thistype)->code () == TYPE_CODE_STRUCT) \
2051 || ((thistype)->code () == TYPE_CODE_UNION)) \
2052 && ((thistype)->num_fields () == 0) \
2053 && (!HAVE_CPLUS_STRUCT (thistype) \
2054 || TYPE_NFN_FIELDS (thistype) == 0) \
2055 && ((thistype)->is_stub () || !(thistype)->stub_is_supported ()))
2056
2057/* * A helper macro that returns the name of a type or "unnamed type"
2058 if the type has no name. */
2059
2060#define TYPE_SAFE_NAME(type) \
2061 (type->name () != nullptr ? type->name () : _("<unnamed type>"))
2062
2063/* * A helper macro that returns the name of an error type. If the
2064 type has a name, it is used; otherwise, a default is used. */
2065
2066#define TYPE_ERROR_NAME(type) \
2067 (type->name () ? type->name () : _("<error type>"))
2068
2069/* Given TYPE, return its floatformat. */
2070const struct floatformat *floatformat_from_type (const struct type *type);
2071
2073{
2074 /* Integral types. */
2075
2076 /* Implicit size/sign (based on the architecture's ABI). */
2077 struct type *builtin_void = nullptr;
2078 struct type *builtin_char = nullptr;
2079 struct type *builtin_short = nullptr;
2080 struct type *builtin_int = nullptr;
2081 struct type *builtin_long = nullptr;
2082 struct type *builtin_signed_char = nullptr;
2083 struct type *builtin_unsigned_char = nullptr;
2084 struct type *builtin_unsigned_short = nullptr;
2085 struct type *builtin_unsigned_int = nullptr;
2086 struct type *builtin_unsigned_long = nullptr;
2087 struct type *builtin_bfloat16 = nullptr;
2088 struct type *builtin_half = nullptr;
2089 struct type *builtin_float = nullptr;
2090 struct type *builtin_double = nullptr;
2091 struct type *builtin_long_double = nullptr;
2092 struct type *builtin_complex = nullptr;
2093 struct type *builtin_double_complex = nullptr;
2094 struct type *builtin_string = nullptr;
2095 struct type *builtin_bool = nullptr;
2096 struct type *builtin_long_long = nullptr;
2098 struct type *builtin_decfloat = nullptr;
2099 struct type *builtin_decdouble = nullptr;
2100 struct type *builtin_declong = nullptr;
2101
2102 /* "True" character types.
2103 We use these for the '/c' print format, because c_char is just a
2104 one-byte integral type, which languages less laid back than C
2105 will print as ... well, a one-byte integral type. */
2106 struct type *builtin_true_char = nullptr;
2108
2109 /* Explicit sizes - see C9X <intypes.h> for naming scheme. The "int0"
2110 is for when an architecture needs to describe a register that has
2111 no size. */
2112 struct type *builtin_int0 = nullptr;
2113 struct type *builtin_int8 = nullptr;
2114 struct type *builtin_uint8 = nullptr;
2115 struct type *builtin_int16 = nullptr;
2116 struct type *builtin_uint16 = nullptr;
2117 struct type *builtin_int24 = nullptr;
2118 struct type *builtin_uint24 = nullptr;
2119 struct type *builtin_int32 = nullptr;
2120 struct type *builtin_uint32 = nullptr;
2121 struct type *builtin_int64 = nullptr;
2122 struct type *builtin_uint64 = nullptr;
2123 struct type *builtin_int128 = nullptr;
2124 struct type *builtin_uint128 = nullptr;
2125
2126 /* Wide character types. */
2127 struct type *builtin_char16 = nullptr;
2128 struct type *builtin_char32 = nullptr;
2129 struct type *builtin_wchar = nullptr;
2130
2131 /* Pointer types. */
2132
2133 /* * `pointer to data' type. Some target platforms use an implicitly
2134 {sign,zero} -extended 32-bit ABI pointer on a 64-bit ISA. */
2135 struct type *builtin_data_ptr = nullptr;
2136
2137 /* * `pointer to function (returning void)' type. Harvard
2138 architectures mean that ABI function and code pointers are not
2139 interconvertible. Similarly, since ANSI, C standards have
2140 explicitly said that pointers to functions and pointers to data
2141 are not interconvertible --- that is, you can't cast a function
2142 pointer to void * and back, and expect to get the same value.
2143 However, all function pointer types are interconvertible, so void
2144 (*) () can server as a generic function pointer. */
2145
2146 struct type *builtin_func_ptr = nullptr;
2147
2148 /* * `function returning pointer to function (returning void)' type.
2149 The final void return type is not significant for it. */
2150
2151 struct type *builtin_func_func = nullptr;
2152
2153 /* Special-purpose types. */
2154
2155 /* * This type is used to represent a GDB internal function. */
2156
2157 struct type *internal_fn = nullptr;
2158
2159 /* * This type is used to represent an xmethod. */
2160 struct type *xmethod = nullptr;
2161
2162 /* * This type is used to represent symbol addresses. */
2163 struct type *builtin_core_addr = nullptr;
2164
2165 /* * This type represents a type that was unrecognized in symbol
2166 read-in. */
2167 struct type *builtin_error = nullptr;
2168
2169 /* * Types used for symbols with no debug information. */
2170 struct type *nodebug_text_symbol = nullptr;
2172 struct type *nodebug_got_plt_symbol = nullptr;
2173 struct type *nodebug_data_symbol = nullptr;
2174 struct type *nodebug_unknown_symbol = nullptr;
2175 struct type *nodebug_tls_symbol = nullptr;
2176};
2177
2178/* * Return the type table for the specified architecture. */
2179
2180extern const struct builtin_type *builtin_type (struct gdbarch *gdbarch);
2181
2182/* * Return the type table for the specified objfile. */
2183
2184extern const struct builtin_type *builtin_type (struct objfile *objfile);
2185
2186/* Explicit floating-point formats. See "floatformat.h". */
2187extern const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN];
2188extern const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN];
2189extern const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN];
2190extern const struct floatformat *floatformats_ieee_quad[BFD_ENDIAN_UNKNOWN];
2191extern const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN];
2192extern const struct floatformat *floatformats_i387_ext[BFD_ENDIAN_UNKNOWN];
2193extern const struct floatformat *floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN];
2194extern const struct floatformat *floatformats_arm_ext[BFD_ENDIAN_UNKNOWN];
2195extern const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN];
2196extern const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN];
2197extern const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN];
2198extern const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN];
2199extern const struct floatformat *floatformats_bfloat16[BFD_ENDIAN_UNKNOWN];
2200
2201/* Allocate space for storing data associated with a particular
2202 type. We ensure that the space is allocated using the same
2203 mechanism that was used to allocate the space for the type
2204 structure itself. I.e. if the type is on an objfile's
2205 objfile_obstack, then the space for data associated with that type
2206 will also be allocated on the objfile_obstack. If the type is
2207 associated with a gdbarch, then the space for data associated with that
2208 type will also be allocated on the gdbarch_obstack.
2209
2210 If a type is not associated with neither an objfile or a gdbarch then
2211 you should not use this macro to allocate space for data, instead you
2212 should call xmalloc directly, and ensure the memory is correctly freed
2213 when it is no longer needed. */
2214
2215#define TYPE_ALLOC(t,size) \
2216 (obstack_alloc (((t)->is_objfile_owned () \
2217 ? &((t)->objfile_owner ()->objfile_obstack) \
2218 : gdbarch_obstack ((t)->arch_owner ())), \
2219 size))
2220
2221
2222/* See comment on TYPE_ALLOC. */
2223
2224#define TYPE_ZALLOC(t,size) (memset (TYPE_ALLOC (t, size), 0, size))
2225
2226/* * This returns the target type (or NULL) of TYPE, also skipping
2227 past typedefs. */
2228
2229extern struct type *get_target_type (struct type *type);
2230
2231/* Return the equivalent of TYPE_LENGTH, but in number of target
2232 addressable memory units of the associated gdbarch instead of bytes. */
2233
2234extern unsigned int type_length_units (struct type *type);
2235
2236/* An object of this type is passed when allocating certain types. It
2237 determines where the new type is allocated. Ultimately a type is
2238 either allocated on a on an objfile obstack or on a gdbarch
2239 obstack. However, it's also possible to request that a new type be
2240 allocated on the same obstack as some existing type, or that a
2241 "new" type instead overwrite a supplied type object. */
2242
2244{
2245public:
2246
2247 /* Create new types on OBJFILE. */
2249 : m_is_objfile (true),
2250 m_lang (lang)
2251 {
2252 m_data.objfile = objfile;
2253 }
2254
2255 /* Create new types on GDBARCH. */
2257 : m_lang (language_minimal)
2258 {
2259 m_data.gdbarch = gdbarch;
2260 }
2261
2262 /* This determines whether a passed-in type should be rewritten in
2263 place, or whether it should simply determine where the new type
2264 is created. */
2266 {
2267 /* Allocate on same obstack as existing type. */
2268 SAME = 0,
2269 /* Smash the existing type. */
2271 };
2272
2273 /* Create new types either on the same obstack as TYPE; or if SMASH
2274 is passed, overwrite TYPE. */
2275 explicit type_allocator (struct type *type,
2277 : m_lang (type->language ())
2278 {
2279 if (kind == SAME)
2280 {
2281 if (type->is_objfile_owned ())
2282 {
2283 m_data.objfile = type->objfile_owner ();
2284 m_is_objfile = true;
2285 }
2286 else
2287 m_data.gdbarch = type->arch_owner ();
2288 }
2289 else
2290 {
2291 m_smash = true;
2292 m_data.type = type;
2293 }
2294 }
2295
2296 /* Create new types on the same obstack as TYPE. */
2297 explicit type_allocator (const struct type *type)
2298 : m_is_objfile (type->is_objfile_owned ()),
2299 m_lang (type->language ())
2300 {
2301 if (type->is_objfile_owned ())
2302 m_data.objfile = type->objfile_owner ();
2303 else
2304 m_data.gdbarch = type->arch_owner ();
2305 }
2306
2307 /* Create a new type on the desired obstack. Note that a "new" type
2308 is not created if type-smashing was selected at construction. */
2310
2311 /* Create a new type on the desired obstack, and fill in its code,
2312 length, and name. If NAME is non-null, it is copied to the
2313 destination obstack first. Note that a "new" type is not created
2314 if type-smashing was selected at construction. */
2315 type *new_type (enum type_code code, int bit, const char *name);
2316
2317 /* Return the architecture associated with this allocator. This
2318 comes from whatever object was supplied to the constructor. */
2320
2321private:
2322
2323 /* Where the type should wind up. */
2324 union
2325 {
2328 struct type *type;
2329 } m_data {};
2330
2331 /* True if this allocator uses the objfile field above. */
2332 bool m_is_objfile = false;
2333 /* True if this allocator uses the type field above, indicating that
2334 the "allocation" should be done in-place. */
2335 bool m_smash = false;
2336 /* The language for types created by this allocator. */
2337 enum language m_lang;
2338};
2339
2340/* Allocate a TYPE_CODE_INT type structure using ALLOC. BIT is the
2341 type size in bits. If UNSIGNED_P is non-zero, set the type's
2342 TYPE_UNSIGNED flag. NAME is the type name. */
2343
2345 int unsigned_p, const char *name);
2346
2347/* Allocate a TYPE_CODE_CHAR type structure using ALLOC. BIT is the
2348 type size in bits. If UNSIGNED_P is non-zero, set the type's
2349 TYPE_UNSIGNED flag. NAME is the type name. */
2350
2352 int unsigned_p, const char *name);
2353
2354/* Allocate a TYPE_CODE_BOOL type structure using ALLOC. BIT is the
2355 type size in bits. If UNSIGNED_P is non-zero, set the type's
2356 TYPE_UNSIGNED flag. NAME is the type name. */
2357
2359 int unsigned_p, const char *name);
2360
2361/* Allocate a TYPE_CODE_FLT type structure using ALLOC.
2362 BIT is the type size in bits; if BIT equals -1, the size is
2363 determined by the floatformat. NAME is the type name. Set the
2364 TYPE_FLOATFORMAT from FLOATFORMATS. BYTE_ORDER is the byte order
2365 to use. If it is BFD_ENDIAN_UNKNOWN (the default), then the byte
2366 order of the objfile's architecture is used. */
2367
2368extern struct type *init_float_type
2369 (type_allocator &alloc, int bit, const char *name,
2370 const struct floatformat **floatformats,
2372
2373/* Allocate a TYPE_CODE_DECFLOAT type structure using ALLOC.
2374 BIT is the type size in bits. NAME is the type name. */
2375
2377 const char *name);
2378
2379extern bool can_create_complex_type (struct type *);
2380extern struct type *init_complex_type (const char *, struct type *);
2381
2382/* Allocate a TYPE_CODE_PTR type structure using ALLOC.
2383 BIT is the pointer type size in bits. NAME is the type name.
2384 TARGET_TYPE is the pointer target type. Always sets the pointer type's
2385 TYPE_UNSIGNED flag. */
2386
2388 const char *name,
2389 struct type *target_type);
2390
2391extern struct type *init_fixed_point_type (type_allocator &, int, int,
2392 const char *);
2393
2394/* Helper functions to construct a struct or record type. An
2395 initially empty type is created using arch_composite_type().
2396 Fields are then added using append_composite_type_field*(). A union
2397 type has its size set to the largest field. A struct type has each
2398 field packed against the previous. */
2399
2400extern struct type *arch_composite_type (struct gdbarch *gdbarch,
2401 const char *name, enum type_code code);
2402extern void append_composite_type_field (struct type *t, const char *name,
2403 struct type *field);
2405 const char *name,
2406 struct type *field,
2407 int alignment);
2408struct field *append_composite_type_field_raw (struct type *t, const char *name,
2409 struct type *field);
2410
2411/* Helper functions to construct a bit flags type. An initially empty
2412 type is created using arch_flag_type(). Flags are then added using
2413 append_flag_type_field() and append_flag_type_flag(). */
2414extern struct type *arch_flags_type (struct gdbarch *gdbarch,
2415 const char *name, int bit);
2416extern void append_flags_type_field (struct type *type,
2417 int start_bitpos, int nr_bits,
2418 struct type *field_type, const char *name);
2419extern void append_flags_type_flag (struct type *type, int bitpos,
2420 const char *name);
2421
2422extern void make_vector_type (struct type *array_type);
2423extern struct type *init_vector_type (struct type *elt_type, int n);
2424
2425extern struct type *lookup_reference_type (struct type *, enum type_code);
2426extern struct type *lookup_lvalue_reference_type (struct type *);
2427extern struct type *lookup_rvalue_reference_type (struct type *);
2428
2429
2430extern struct type *make_reference_type (struct type *, struct type **,
2431 enum type_code);
2432
2433extern struct type *make_cv_type (int, int, struct type *, struct type **);
2434
2435extern struct type *make_restrict_type (struct type *);
2436
2437extern struct type *make_unqualified_type (struct type *);
2438
2439extern struct type *make_atomic_type (struct type *);
2440
2441extern void replace_type (struct type *, struct type *);
2442
2444 (struct gdbarch *, const char *);
2445
2447 (struct gdbarch *, type_instance_flags);
2448
2451
2452extern struct type *lookup_memberptr_type (struct type *, struct type *);
2453
2454extern struct type *lookup_methodptr_type (struct type *);
2455
2456extern void smash_to_method_type (struct type *type, struct type *self_type,
2457 struct type *to_type, struct field *args,
2458 int nargs, int varargs);
2459
2460extern void smash_to_memberptr_type (struct type *, struct type *,
2461 struct type *);
2462
2463extern void smash_to_methodptr_type (struct type *, struct type *);
2464
2465extern const char *type_name_or_error (struct type *type);
2466
2468{
2469 /* The field of the element, or NULL if no element was found. */
2470 struct field *field;
2471
2472 /* The bit offset of the element in the parent structure. */
2474};
2475
2476/* Given a type TYPE, lookup the field and offset of the component named
2477 NAME.
2478
2479 TYPE can be either a struct or union, or a pointer or reference to
2480 a struct or union. If it is a pointer or reference, its target
2481 type is automatically used. Thus '.' and '->' are interchangeable,
2482 as specified for the definitions of the expression element types
2483 STRUCTOP_STRUCT and STRUCTOP_PTR.
2484
2485 If NOERR is nonzero, the returned structure will have field set to
2486 NULL if there is no component named NAME.
2487
2488 If the component NAME is a field in an anonymous substructure of
2489 TYPE, the returned offset is a "global" offset relative to TYPE
2490 rather than an offset within the substructure. */
2491
2492extern struct_elt lookup_struct_elt (struct type *, const char *, int);
2493
2494/* Given a type TYPE, lookup the type of the component named NAME.
2495
2496 TYPE can be either a struct or union, or a pointer or reference to
2497 a struct or union. If it is a pointer or reference, its target
2498 type is automatically used. Thus '.' and '->' are interchangeable,
2499 as specified for the definitions of the expression element types
2500 STRUCTOP_STRUCT and STRUCTOP_PTR.
2501
2502 If NOERR is nonzero, return NULL if there is no component named
2503 NAME. */
2504
2505extern struct type *lookup_struct_elt_type (struct type *, const char *, int);
2506
2507extern struct type *make_pointer_type (struct type *, struct type **);
2508
2509extern struct type *lookup_pointer_type (struct type *);
2510
2511extern struct type *make_function_type (struct type *, struct type **);
2512
2513extern struct type *lookup_function_type (struct type *);
2514
2516 int,
2517 struct type **);
2518
2519/* Create a range type using ALLOC.
2520
2521 Indices will be of type INDEX_TYPE, and will range from LOW_BOUND
2522 to HIGH_BOUND, inclusive. */
2523
2525 struct type *index_type,
2528
2529/* Create an array type using ALLOC.
2530
2531 Elements will be of type ELEMENT_TYPE, the indices will be of type
2532 RANGE_TYPE.
2533
2534 BYTE_STRIDE_PROP, when not NULL, provides the array's byte stride.
2535 This byte stride property is added to the resulting array type
2536 as a DYN_PROP_BYTE_STRIDE. As a consequence, the BYTE_STRIDE_PROP
2537 argument can only be used to create types that are objfile-owned
2538 (see add_dyn_prop), meaning that either this function must be called
2539 with an objfile-owned RESULT_TYPE, or an objfile-owned RANGE_TYPE.
2540
2541 BIT_STRIDE is taken into account only when BYTE_STRIDE_PROP is NULL.
2542 If BIT_STRIDE is not zero, build a packed array type whose element
2543 size is BIT_STRIDE. Otherwise, ignore this parameter. */
2544
2548 unsigned int bit_stride);
2549
2550/* Create a range type using ALLOC with a dynamic range from LOW_BOUND
2551 to HIGH_BOUND, inclusive. INDEX_TYPE is the underlying type. BIAS
2552 is the bias to be applied when storing or retrieving values of this
2553 type. */
2554
2556 struct type *index_type,
2557 const struct dynamic_prop *low_bound,
2558 const struct dynamic_prop *high_bound,
2559 LONGEST bias);
2560
2561/* Like CREATE_RANGE_TYPE but also sets up a stride. When BYTE_STRIDE_P
2562 is true the value in STRIDE is a byte stride, otherwise STRIDE is a bit
2563 stride. */
2564
2567 const struct dynamic_prop *low_bound,
2568 const struct dynamic_prop *high_bound, LONGEST bias,
2569 const struct dynamic_prop *stride, bool byte_stride_p);
2570
2571/* Same as create_array_type_with_stride but with no bit_stride
2572 (BIT_STRIDE = 0), thus building an unpacked array. */
2573
2575 struct type *element_type,
2576 struct type *range_type);
2577
2579
2580/* Create a string type using ALLOC. String types are similar enough
2581 to array of char types that we can use create_array_type to build
2582 the basic type and then bash it into a string type.
2583
2584 For fixed length strings, the range type contains 0 as the lower
2585 bound and the length of the string minus one as the upper bound. */
2586
2588 struct type *string_char_type,
2589 struct type *range_type);
2590
2592
2594 struct type *domain_type);
2595
2596extern struct type *lookup_unsigned_typename (const struct language_defn *,
2597 const char *);
2598
2599extern struct type *lookup_signed_typename (const struct language_defn *,
2600 const char *);
2601
2603
2604extern void get_signed_type_minmax (struct type *, LONGEST *, LONGEST *);
2605
2607
2608/* * Resolve all dynamic values of a type e.g. array bounds to static values.
2609 ADDR specifies the location of the variable the type is bound to.
2610 If TYPE has no dynamic properties return TYPE; otherwise a new type with
2611 static properties is returned.
2612
2613 If FRAME is given, it is used when evaluating dynamic properties.
2614 This can be important when a static link is seen. If not given,
2615 the selected frame is used.
2616
2617 For an array type, if the element type is dynamic, then that will
2618 not be resolved. This is done because each individual element may
2619 have a different type when resolved (depending on the contents of
2620 memory). In this situation, 'is_dynamic_type' will still return
2621 true for the return value of this function. */
2623 (struct type *type, gdb::array_view<const gdb_byte> valaddr,
2624 CORE_ADDR addr, const frame_info_ptr *frame = nullptr);
2625
2626/* * Predicate if the type has dynamic values, which are not resolved yet.
2627 See the caveat in 'resolve_dynamic_type' to understand a scenario
2628 where an apparently-resolved type may still be considered
2629 "dynamic". */
2630extern int is_dynamic_type (struct type *type);
2631
2632extern struct type *check_typedef (struct type *);
2633
2634extern void check_stub_method_group (struct type *, int);
2635
2636extern char *gdb_mangle_name (struct type *, int, int);
2637
2638/* Lookup a typedef or primitive type named NAME, visible in lexical block
2639 BLOCK. If NOERR is nonzero, return zero if NAME is not suitably
2640 defined.
2641
2642 If this function finds a suitable type then check_typedef is called on
2643 the type, this ensures that if the type being returned is a typedef
2644 then the length of the type will be correct. The original typedef will
2645 still be returned, not the result of calling check_typedef. */
2646
2647extern struct type *lookup_typename (const struct language_defn *language,
2648 const char *name,
2649 const struct block *block, int noerr);
2650
2651extern struct type *lookup_template_type (const char *, struct type *,
2652 const struct block *);
2653
2654extern int get_vptr_fieldno (struct type *, struct type **);
2655
2656/* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type
2657 TYPE.
2658
2659 Return true if the two bounds are available, false otherwise. */
2660
2662 LONGEST *highp);
2663
2664/* If TYPE's low bound is a known constant, return it, else return nullopt. */
2665
2666extern gdb::optional<LONGEST> get_discrete_low_bound (struct type *type);
2667
2668/* If TYPE's high bound is a known constant, return it, else return nullopt. */
2669
2670extern gdb::optional<LONGEST> get_discrete_high_bound (struct type *type);
2671
2672/* Assuming TYPE is a simple, non-empty array type, compute its upper
2673 and lower bound. Save the low bound into LOW_BOUND if not NULL.
2674 Save the high bound into HIGH_BOUND if not NULL.
2675
2676 Return true if the operation was successful. Return false otherwise,
2677 in which case the values of LOW_BOUND and HIGH_BOUNDS are unmodified. */
2678
2681
2682extern gdb::optional<LONGEST> discrete_position (struct type *type,
2683 LONGEST val);
2684
2685extern int class_types_same_p (const struct type *, const struct type *);
2686
2687extern int is_ancestor (struct type *, struct type *);
2688
2689extern int is_public_ancestor (struct type *, struct type *);
2690
2691extern int is_unique_ancestor (struct type *, struct value *);
2692
2693/* Overload resolution */
2694
2695/* * Badness if parameter list length doesn't match arg list length. */
2696extern const struct rank LENGTH_MISMATCH_BADNESS;
2697
2698/* * Dummy badness value for nonexistent parameter positions. */
2699extern const struct rank TOO_FEW_PARAMS_BADNESS;
2700/* * Badness if no conversion among types. */
2701extern const struct rank INCOMPATIBLE_TYPE_BADNESS;
2702
2703/* * Badness of an exact match. */
2704extern const struct rank EXACT_MATCH_BADNESS;
2705
2706/* * Badness of integral promotion. */
2707extern const struct rank INTEGER_PROMOTION_BADNESS;
2708/* * Badness of floating promotion. */
2709extern const struct rank FLOAT_PROMOTION_BADNESS;
2710/* * Badness of converting a derived class pointer
2711 to a base class pointer. */
2712extern const struct rank BASE_PTR_CONVERSION_BADNESS;
2713/* * Badness of integral conversion. */
2714extern const struct rank INTEGER_CONVERSION_BADNESS;
2715/* * Badness of floating conversion. */
2716extern const struct rank FLOAT_CONVERSION_BADNESS;
2717/* * Badness of integer<->floating conversions. */
2718extern const struct rank INT_FLOAT_CONVERSION_BADNESS;
2719/* * Badness of conversion of pointer to void pointer. */
2720extern const struct rank VOID_PTR_CONVERSION_BADNESS;
2721/* * Badness of conversion to boolean. */
2722extern const struct rank BOOL_CONVERSION_BADNESS;
2723/* * Badness of converting derived to base class. */
2724extern const struct rank BASE_CONVERSION_BADNESS;
2725/* * Badness of converting from non-reference to reference. Subrank
2726 is the type of reference conversion being done. */
2727extern const struct rank REFERENCE_CONVERSION_BADNESS;
2728extern const struct rank REFERENCE_SEE_THROUGH_BADNESS;
2729/* * Conversion to rvalue reference. */
2730#define REFERENCE_CONVERSION_RVALUE 1
2731/* * Conversion to const lvalue reference. */
2732#define REFERENCE_CONVERSION_CONST_LVALUE 2
2733
2734/* * Badness of converting integer 0 to NULL pointer. */
2735extern const struct rank NULL_POINTER_CONVERSION;
2736/* * Badness of cv-conversion. Subrank is a flag describing the conversions
2737 being done. */
2738extern const struct rank CV_CONVERSION_BADNESS;
2739#define CV_CONVERSION_CONST 1
2740#define CV_CONVERSION_VOLATILE 2
2741
2742/* Non-standard conversions allowed by the debugger */
2743
2744/* * Converting a pointer to an int is usually OK. */
2745extern const struct rank NS_POINTER_CONVERSION_BADNESS;
2746
2747/* * Badness of converting a (non-zero) integer constant
2748 to a pointer. */
2750
2752extern int compare_ranks (struct rank a, struct rank b);
2753
2755 const badness_vector &);
2756
2757extern badness_vector rank_function (gdb::array_view<type *> parms,
2758 gdb::array_view<value *> args);
2759
2760extern struct rank rank_one_type (struct type *, struct type *,
2761 struct value *);
2762
2763extern void recursive_dump_type (struct type *, int);
2764
2765/* printcmd.c */
2766
2767extern void print_scalar_formatted (const gdb_byte *, struct type *,
2768 const struct value_print_options *,
2769 int, struct ui_file *);
2770
2771extern int can_dereference (struct type *);
2772
2773extern int is_integral_type (struct type *);
2774
2775extern int is_floating_type (struct type *);
2776
2777extern int is_scalar_type (struct type *type);
2778
2779extern int is_scalar_type_recursive (struct type *);
2780
2781extern int class_or_union_p (const struct type *);
2782
2783extern void maintenance_print_type (const char *, int);
2784
2786
2787extern struct type *copy_type_recursive (struct type *type,
2789
2790extern struct type *copy_type (const struct type *type);
2791
2792extern bool types_equal (struct type *, struct type *);
2793
2794extern bool types_deeply_equal (struct type *, struct type *);
2795
2796extern int type_not_allocated (const struct type *type);
2797
2798extern int type_not_associated (const struct type *type);
2799
2800/* Return True if TYPE is a TYPE_CODE_FIXED_POINT or if TYPE is
2801 a range type whose base type is a TYPE_CODE_FIXED_POINT. */
2802extern bool is_fixed_point_type (struct type *type);
2803
2804/* Allocate a fixed-point type info for TYPE. This should only be
2805 called by INIT_FIXED_POINT_SPECIFIC. */
2807
2808/* * When the type includes explicit byte ordering, return that.
2809 Otherwise, the byte ordering from gdbarch_byte_order for
2810 the type's arch is returned. */
2811
2812extern enum bfd_endian type_byte_order (const struct type *type);
2813
2814/* A flag to enable printing of debugging information of C++
2815 overloading. */
2816
2817extern unsigned int overload_debug;
2818
2819/* Return whether the function type represented by TYPE is marked as unsafe
2820 to call by the debugger.
2821
2822 This usually indicates that the function does not follow the target's
2823 standard calling convention. */
2824
2825extern bool is_nocall_function (const struct type *type);
2826
2827#endif /* GDBTYPES_H */
gdbarch * arch()
type * new_type(enum type_code code, int bit, const char *name)
type_allocator(struct type *type, type_allocator_kind kind=SAME)
Definition gdbtypes.h:2275
type_allocator(const struct type *type)
Definition gdbtypes.h:2297
struct type * type
Definition gdbtypes.h:2328
struct gdbarch * gdbarch
Definition gdbtypes.h:2327
struct objfile * objfile
Definition gdbtypes.h:2326
type_allocator(objfile *objfile, enum language lang)
Definition gdbtypes.h:2248
type * new_type()
type_allocator(gdbarch *gdbarch)
Definition gdbtypes.h:2256
T extract_integer(gdb::array_view< const gdb_byte >, enum bfd_endian byte_order)
language
Definition defs.h:211
@ language_minimal
Definition defs.h:224
#define LANGUAGE_BITS
Definition defs.h:231
type_specific_kind
Definition gdbtypes.h:500
@ TYPE_SPECIFIC_FLOATFORMAT
Definition gdbtypes.h:504
@ TYPE_SPECIFIC_FIXED_POINT
Definition gdbtypes.h:509
@ TYPE_SPECIFIC_GNAT_STUFF
Definition gdbtypes.h:503
@ TYPE_SPECIFIC_SELF_TYPE
Definition gdbtypes.h:507
@ TYPE_SPECIFIC_INT
Definition gdbtypes.h:508
@ TYPE_SPECIFIC_NONE
Definition gdbtypes.h:501
@ TYPE_SPECIFIC_FUNC
Definition gdbtypes.h:506
@ TYPE_SPECIFIC_CPLUS_STUFF
Definition gdbtypes.h:502
void recursive_dump_type(struct type *, int)
struct type * copy_type_recursive(struct type *type, htab_t copied_types)
struct type * check_typedef(struct type *)
const struct rank INTEGER_PROMOTION_BADNESS
int can_dereference(struct type *)
struct type * create_set_type(type_allocator &alloc, struct type *domain_type)
struct type * get_target_type(struct type *type)
struct type * make_function_type(struct type *, struct type **)
void smash_to_memberptr_type(struct type *, struct type *, struct type *)
enum bfd_endian type_byte_order(const struct type *type)
void allocate_gnat_aux_type(struct type *)
dynamic_prop_kind
Definition gdbtypes.h:274
@ PROP_ADDR_OFFSET
Definition gdbtypes.h:277
@ PROP_VARIABLE_NAME
Definition gdbtypes.h:282
@ PROP_CONST
Definition gdbtypes.h:276
@ PROP_UNDEFINED
Definition gdbtypes.h:275
@ PROP_VARIANT_PARTS
Definition gdbtypes.h:280
@ PROP_TYPE
Definition gdbtypes.h:281
@ PROP_LOCEXPR
Definition gdbtypes.h:278
@ PROP_LOCLIST
Definition gdbtypes.h:279
struct type * make_cv_type(int, int, struct type *, struct type **)
const struct floatformat * floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN]
struct type * init_character_type(type_allocator &alloc, int bit, int unsigned_p, const char *name)
struct type * init_integer_type(type_allocator &alloc, int bit, int unsigned_p, const char *name)
const struct rank BASE_PTR_CONVERSION_BADNESS
bool set_type_align(struct type *, ULONGEST)
void append_flags_type_flag(struct type *type, int bitpos, const char *name)
struct type * create_static_range_type(type_allocator &alloc, struct type *index_type, LONGEST low_bound, LONGEST high_bound)
const struct rank LENGTH_MISMATCH_BADNESS
bool operator==(const dynamic_prop &l, const dynamic_prop &r)
bool types_equal(struct type *, struct type *)
struct type * lookup_typename(const struct language_defn *language, const char *name, const struct block *block, int noerr)
htab_up create_copied_types_hash()
const struct rank BOOL_CONVERSION_BADNESS
struct type * create_range_type(type_allocator &alloc, struct type *index_type, const struct dynamic_prop *low_bound, const struct dynamic_prop *high_bound, LONGEST bias)
void maintenance_print_type(const char *, int)
const struct rank NS_POINTER_CONVERSION_BADNESS
const struct rank FLOAT_PROMOTION_BADNESS
struct type * init_float_type(type_allocator &alloc, int bit, const char *name, const struct floatformat **floatformats, enum bfd_endian byte_order=BFD_ENDIAN_UNKNOWN)
const struct floatformat * floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN]
struct type * make_reference_type(struct type *, struct type **, enum type_code)
#define TYPE_IS_REFERENCE(t)
Definition gdbtypes.h:139
const struct rank TOO_FEW_PARAMS_BADNESS
struct type * make_type_with_address_space(struct type *type, type_instance_flags space_identifier)
struct type * arch_composite_type(struct gdbarch *gdbarch, const char *name, enum type_code code)
int is_scalar_type(struct type *type)
struct type * lookup_reference_type(struct type *, enum type_code)
const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS
field_loc_kind
Definition gdbtypes.h:480
@ FIELD_LOC_KIND_BITPOS
Definition gdbtypes.h:481
@ FIELD_LOC_KIND_PHYSNAME
Definition gdbtypes.h:484
@ FIELD_LOC_KIND_ENUMVAL
Definition gdbtypes.h:482
@ FIELD_LOC_KIND_PHYSADDR
Definition gdbtypes.h:483
@ FIELD_LOC_KIND_DWARF_BLOCK
Definition gdbtypes.h:485
CORE_ADDR get_pointer_type_max(struct type *)
struct type * lookup_unsigned_typename(const struct language_defn *, const char *)
struct type * internal_type_self_type(struct type *)
int is_dynamic_type(struct type *type)
#define B_TYPE
Definition gdbtypes.h:74
struct type * make_restrict_type(struct type *)
struct type * lookup_signed_typename(const struct language_defn *, const char *)
const struct rank INCOMPATIBLE_TYPE_BADNESS
void allocate_fixed_point_type_info(struct type *type)
struct type * init_decfloat_type(type_allocator &alloc, int bit, const char *name)
const struct floatformat * floatformat_from_type(const struct type *type)
const struct floatformat * floatformats_ieee_quad[BFD_ENDIAN_UNKNOWN]
const struct rank REFERENCE_SEE_THROUGH_BADNESS
type_instance_flag_value
Definition gdbtypes.h:95
@ TYPE_INSTANCE_FLAG_CODE_SPACE
Definition gdbtypes.h:98
@ TYPE_INSTANCE_FLAG_CONST
Definition gdbtypes.h:96
@ TYPE_INSTANCE_FLAG_VOLATILE
Definition gdbtypes.h:97
@ TYPE_INSTANCE_FLAG_ATOMIC
Definition gdbtypes.h:104
@ TYPE_INSTANCE_FLAG_DATA_SPACE
Definition gdbtypes.h:99
@ TYPE_INSTANCE_FLAG_RESTRICT
Definition gdbtypes.h:103
@ TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2
Definition gdbtypes.h:101
@ TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
Definition gdbtypes.h:100
@ TYPE_INSTANCE_FLAG_NOTTEXT
Definition gdbtypes.h:102
bool get_discrete_bounds(struct type *type, LONGEST *lowp, LONGEST *highp)
void replace_type(struct type *, struct type *)
DEF_ENUM_FLAGS_TYPE(enum type_instance_flag_value, type_instance_flags)
const struct floatformat * floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN]
const struct rank INT_FLOAT_CONVERSION_BADNESS
int is_public_ancestor(struct type *, struct type *)
gdb::optional< LONGEST > get_discrete_high_bound(struct type *type)
struct type * lookup_array_range_type(struct type *, LONGEST, LONGEST)
struct type * lookup_struct_elt_type(struct type *, const char *, int)
struct type * create_string_type(type_allocator &alloc, struct type *string_char_type, struct type *range_type)
struct type * lookup_string_range_type(struct type *, LONGEST, LONGEST)
void get_signed_type_minmax(struct type *, LONGEST *, LONGEST *)
void allocate_cplus_struct_type(struct type *)
struct type * resolve_dynamic_type(struct type *type, gdb::array_view< const gdb_byte > valaddr, CORE_ADDR addr, const frame_info_ptr *frame=nullptr)
struct type * lookup_rvalue_reference_type(struct type *)
#define TYPE_ALIGN_BITS
Definition gdbtypes.h:945
const struct rank BASE_CONVERSION_BADNESS
void set_type_vptr_basetype(struct type *, struct type *)
struct type * arch_flags_type(struct gdbarch *gdbarch, const char *name, int bit)
struct type * create_range_type_with_stride(type_allocator &alloc, struct type *index_type, const struct dynamic_prop *low_bound, const struct dynamic_prop *high_bound, LONGEST bias, const struct dynamic_prop *stride, bool byte_stride_p)
badness_vector rank_function(gdb::array_view< type * > parms, gdb::array_view< value * > args)
struct type * lookup_function_type_with_arguments(struct type *, int, struct type **)
void print_scalar_formatted(const gdb_byte *, struct type *, const struct value_print_options *, int, struct ui_file *)
struct type * init_vector_type(struct type *elt_type, int n)
int is_floating_type(struct type *)
struct type * make_pointer_type(struct type *, struct type **)
gdb::optional< LONGEST > get_discrete_low_bound(struct type *type)
struct type * lookup_memberptr_type(struct type *, struct type *)
void append_flags_type_field(struct type *type, int start_bitpos, int nr_bits, struct type *field_type, const char *name)
struct type * init_complex_type(const char *, struct type *)
struct type * init_pointer_type(type_allocator &alloc, int bit, const char *name, struct type *target_type)
bool is_nocall_function(const struct type *type)
struct rank rank_one_type(struct type *, struct type *, struct value *)
int class_types_same_p(const struct type *, const struct type *)
struct type * internal_type_vptr_basetype(struct type *)
const struct floatformat * floatformats_bfloat16[BFD_ENDIAN_UNKNOWN]
const struct rank CV_CONVERSION_BADNESS
char * gdb_mangle_name(struct type *, int, int)
int compare_ranks(struct rank a, struct rank b)
int is_scalar_type_recursive(struct type *)
int internal_type_vptr_fieldno(struct type *)
struct type * lookup_template_type(const char *, struct type *, const struct block *)
void smash_to_method_type(struct type *type, struct type *self_type, struct type *to_type, struct field *args, int nargs, int varargs)
unsigned type_raw_align(struct type *)
const struct floatformat * floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
const struct rank REFERENCE_CONVERSION_BADNESS
int class_or_union_p(const struct type *)
type_code
Definition gdbtypes.h:82
@ TYPE_CODE_UNDEF
Definition gdbtypes.h:83
struct type * init_fixed_point_type(type_allocator &, int, int, const char *)
void append_composite_type_field_aligned(struct type *t, const char *name, struct type *field, int alignment)
void set_type_vptr_fieldno(struct type *, int)
struct type * make_unqualified_type(struct type *)
struct type * lookup_function_type(struct type *)
struct type * lookup_methodptr_type(struct type *)
int is_integral_type(struct type *)
gdb::optional< LONGEST > discrete_position(struct type *type, LONGEST val)
int compare_badness(const badness_vector &, const badness_vector &)
struct type * make_atomic_type(struct type *)
struct type * lookup_lvalue_reference_type(struct type *)
bool get_array_bounds(struct type *type, LONGEST *low_bound, LONGEST *high_bound)
unsigned int overload_debug
const struct floatformat * floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN]
struct type * lookup_pointer_type(struct type *)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
const struct floatformat * floatformats_arm_ext[BFD_ENDIAN_UNKNOWN]
struct type * create_array_type(type_allocator &alloc, struct type *element_type, struct type *range_type)
void check_stub_method_group(struct type *, int)
struct_elt lookup_struct_elt(struct type *, const char *, int)
int type_not_associated(const struct type *type)
unsigned type_align(struct type *)
unsigned int type_length_units(struct type *type)
void set_type_self_type(struct type *, struct type *)
struct type * create_array_type_with_stride(type_allocator &alloc, struct type *element_type, struct type *range_type, struct dynamic_prop *byte_stride_prop, unsigned int bit_stride)
bool can_create_complex_type(struct type *)
void smash_to_methodptr_type(struct type *, struct type *)
const struct rank INTEGER_CONVERSION_BADNESS
const char * address_space_type_instance_flags_to_name(struct gdbarch *, type_instance_flags)
struct field * append_composite_type_field_raw(struct type *t, const char *name, struct type *field)
const struct cplus_struct_type cplus_struct_default
const struct floatformat * floatformats_ieee_half[BFD_ENDIAN_UNKNOWN]
ULONGEST get_unsigned_type_max(struct type *)
const struct floatformat * floatformats_ieee_double[BFD_ENDIAN_UNKNOWN]
const struct gnat_aux_type gnat_aux_default
int is_ancestor(struct type *, struct type *)
const struct rank NULL_POINTER_CONVERSION
void append_composite_type_field(struct type *t, const char *name, struct type *field)
int is_unique_ancestor(struct type *, struct value *)
const struct rank EXACT_MATCH_BADNESS
struct type * init_boolean_type(type_allocator &alloc, int bit, int unsigned_p, const char *name)
bool is_fixed_point_type(struct type *type)
dynamic_prop_node_kind
Definition gdbtypes.h:436
@ DYN_PROP_VARIANT_PARTS
Definition gdbtypes.h:453
@ DYN_PROP_ASSOCIATED
Definition gdbtypes.h:447
@ DYN_PROP_RANK
Definition gdbtypes.h:457
@ DYN_PROP_BYTE_SIZE
Definition gdbtypes.h:460
@ DYN_PROP_DATA_LOCATION
Definition gdbtypes.h:439
@ DYN_PROP_ALLOCATED
Definition gdbtypes.h:443
@ DYN_PROP_BYTE_STRIDE
Definition gdbtypes.h:450
std::vector< rank > badness_vector
Definition gdbtypes.h:1760
int get_vptr_fieldno(struct type *, struct type **)
const struct rank FLOAT_CONVERSION_BADNESS
const struct floatformat * floatformats_vax_d[BFD_ENDIAN_UNKNOWN]
int type_not_allocated(const struct type *type)
const struct rank VOID_PTR_CONVERSION_BADNESS
const struct floatformat * floatformats_i387_ext[BFD_ENDIAN_UNKNOWN]
type_instance_flags address_space_name_to_type_instance_flags(struct gdbarch *, const char *)
struct type * copy_type(const struct type *type)
const char * type_name_or_error(struct type *type)
void make_vector_type(struct type *array_type)
struct rank sum_ranks(struct rank a, struct rank b)
const struct floatformat * floatformats_vax_f[BFD_ENDIAN_UNKNOWN]
bool types_deeply_equal(struct type *, struct type *)
struct type * builtin_signed_char
Definition gdbtypes.h:2082
struct type * builtin_declong
Definition gdbtypes.h:2100
struct type * builtin_long_long
Definition gdbtypes.h:2096
struct type * builtin_int0
Definition gdbtypes.h:2112
struct type * nodebug_text_gnu_ifunc_symbol
Definition gdbtypes.h:2171
struct type * internal_fn
Definition gdbtypes.h:2157
struct type * builtin_uint16
Definition gdbtypes.h:2116
struct type * builtin_error
Definition gdbtypes.h:2167
struct type * builtin_int24
Definition gdbtypes.h:2117
struct type * builtin_double
Definition gdbtypes.h:2090
struct type * builtin_string
Definition gdbtypes.h:2094
struct type * builtin_int8
Definition gdbtypes.h:2113
struct type * builtin_func_ptr
Definition gdbtypes.h:2146
struct type * builtin_core_addr
Definition gdbtypes.h:2163
struct type * builtin_uint128
Definition gdbtypes.h:2124
struct type * builtin_long
Definition gdbtypes.h:2081
struct type * builtin_data_ptr
Definition gdbtypes.h:2135
struct type * builtin_bool
Definition gdbtypes.h:2095
struct type * builtin_true_unsigned_char
Definition gdbtypes.h:2107
struct type * builtin_unsigned_char
Definition gdbtypes.h:2083
struct type * nodebug_tls_symbol
Definition gdbtypes.h:2175
struct type * builtin_complex
Definition gdbtypes.h:2092
struct type * builtin_long_double
Definition gdbtypes.h:2091
struct type * builtin_unsigned_long_long
Definition gdbtypes.h:2097
struct type * builtin_uint32
Definition gdbtypes.h:2120
struct type * builtin_uint64
Definition gdbtypes.h:2122
struct type * builtin_char16
Definition gdbtypes.h:2127
struct type * xmethod
Definition gdbtypes.h:2160
struct type * builtin_short
Definition gdbtypes.h:2079
struct type * builtin_double_complex
Definition gdbtypes.h:2093
struct type * builtin_int64
Definition gdbtypes.h:2121
struct type * builtin_uint24
Definition gdbtypes.h:2118
struct type * builtin_char
Definition gdbtypes.h:2078
struct type * builtin_int
Definition gdbtypes.h:2080
struct type * builtin_decfloat
Definition gdbtypes.h:2098
struct type * builtin_int32
Definition gdbtypes.h:2119
struct type * builtin_unsigned_short
Definition gdbtypes.h:2084
struct type * builtin_wchar
Definition gdbtypes.h:2129
struct type * builtin_unsigned_int
Definition gdbtypes.h:2085
struct type * builtin_decdouble
Definition gdbtypes.h:2099
struct type * builtin_char32
Definition gdbtypes.h:2128
struct type * builtin_uint8
Definition gdbtypes.h:2114
struct type * nodebug_got_plt_symbol
Definition gdbtypes.h:2172
struct type * builtin_half
Definition gdbtypes.h:2088
struct type * builtin_bfloat16
Definition gdbtypes.h:2087
struct type * builtin_int128
Definition gdbtypes.h:2123
struct type * builtin_unsigned_long
Definition gdbtypes.h:2086
struct type * builtin_int16
Definition gdbtypes.h:2115
struct type * builtin_void
Definition gdbtypes.h:2077
struct type * builtin_float
Definition gdbtypes.h:2089
struct type * nodebug_data_symbol
Definition gdbtypes.h:2173
struct type * builtin_func_func
Definition gdbtypes.h:2151
struct type * nodebug_unknown_symbol
Definition gdbtypes.h:2174
struct type * builtin_true_char
Definition gdbtypes.h:2106
struct type * nodebug_text_symbol
Definition gdbtypes.h:2170
struct fn_fieldlist * fn_fieldlists
Definition gdbtypes.h:1718
struct type * vptr_basetype
Definition gdbtypes.h:1673
unsigned typedef_field_count
Definition gdbtypes.h:1725
struct decl_field * nested_types
Definition gdbtypes.h:1730
B_TYPE * virtual_field_bits
Definition gdbtypes.h:1688
unsigned nested_types_count
Definition gdbtypes.h:1732
__extension__ enum dwarf_calling_convention calling_convention
Definition gdbtypes.h:1669
B_TYPE * private_field_bits
Definition gdbtypes.h:1696
unsigned short n_template_arguments
Definition gdbtypes.h:1655
struct symbol ** template_arguments
Definition gdbtypes.h:1738
B_TYPE * protected_field_bits
Definition gdbtypes.h:1704
struct decl_field * typedef_field
Definition gdbtypes.h:1723
B_TYPE * ignore_field_bits
Definition gdbtypes.h:1709
const char * name
Definition gdbtypes.h:1607
unsigned int is_private
Definition gdbtypes.h:1617
struct type * type
Definition gdbtypes.h:1611
unsigned int is_protected
Definition gdbtypes.h:1614
bool contains(ULONGEST value, bool is_unsigned) const
Definition gdbtypes.h:206
struct dynamic_prop_list * next
Definition gdbtypes.h:473
enum dynamic_prop_node_kind prop_kind
Definition gdbtypes.h:467
struct dynamic_prop prop
Definition gdbtypes.h:470
const dwarf2_property_baton * baton() const
Definition gdbtypes.h:348
void set_loclist(const dwarf2_property_baton *baton)
Definition gdbtypes.h:363
const char * variable_name() const
Definition gdbtypes.h:403
LONGEST const_val() const
Definition gdbtypes.h:330
dynamic_prop_kind kind() const
Definition gdbtypes.h:320
union dynamic_prop_data m_data
Definition gdbtypes.h:421
void set_original_type(struct type *original_type)
Definition gdbtypes.h:395
struct type * original_type() const
Definition gdbtypes.h:388
enum dynamic_prop_kind m_kind
Definition gdbtypes.h:418
const gdb::array_view< variant_part > * variant_parts() const
Definition gdbtypes.h:375
bool is_constant() const
Definition gdbtypes.h:345
void set_variable_name(const char *name)
Definition gdbtypes.h:411
void set_undefined()
Definition gdbtypes.h:325
void set_locexpr(const dwarf2_property_baton *baton)
Definition gdbtypes.h:357
void set_addr_offset(const dwarf2_property_baton *baton)
Definition gdbtypes.h:369
void set_variant_parts(gdb::array_view< variant_part > *variant_parts)
Definition gdbtypes.h:382
void set_const_val(LONGEST const_val)
Definition gdbtypes.h:337
void set_type(struct type *type)
Definition gdbtypes.h:552
void set_loc_bitpos(LONGEST bitpos)
Definition gdbtypes.h:617
CORE_ADDR loc_physaddr() const
Definition gdbtypes.h:635
LONGEST loc_bitpos() const
Definition gdbtypes.h:611
void set_loc_physaddr(CORE_ADDR physaddr)
Definition gdbtypes.h:641
void set_is_artificial(bool is_artificial)
Definition gdbtypes.h:572
const char * loc_physname() const
Definition gdbtypes.h:647
unsigned int m_artificial
Definition gdbtypes.h:678
union field_location m_loc
Definition gdbtypes.h:671
void set_loc_dwarf_block(dwarf2_locexpr_baton *dwarf_block)
Definition gdbtypes.h:665
void set_loc_physname(const char *physname)
Definition gdbtypes.h:653
__extension__ enum field_loc_kind m_loc_kind
Definition gdbtypes.h:682
bool is_artificial() const
Definition gdbtypes.h:567
void set_bitsize(unsigned int bitsize)
Definition gdbtypes.h:582
field_loc_kind loc_kind() const
Definition gdbtypes.h:606
LONGEST loc_enumval() const
Definition gdbtypes.h:623
dwarf2_locexpr_baton * loc_dwarf_block() const
Definition gdbtypes.h:659
void set_loc_enumval(LONGEST enumval)
Definition gdbtypes.h:629
struct type * m_type
Definition gdbtypes.h:696
void set_name(const char *name)
Definition gdbtypes.h:562
const char * name() const
Definition gdbtypes.h:557
unsigned int bitsize() const
Definition gdbtypes.h:577
bool is_packed() const
Definition gdbtypes.h:587
struct type * type() const
Definition gdbtypes.h:547
const char * m_name
Definition gdbtypes.h:702
bool is_static() const
Definition gdbtypes.h:593
unsigned int m_bitsize
Definition gdbtypes.h:690
unsigned int is_private
Definition gdbtypes.h:1567
unsigned int is_artificial
Definition gdbtypes.h:1569
__extension__ enum dwarf_defaulted_attribute defaulted
Definition gdbtypes.h:1587
struct type * type
Definition gdbtypes.h:1556
const char * physname
Definition gdbtypes.h:1548
unsigned int voffset
Definition gdbtypes.h:1596
struct type * fcontext
Definition gdbtypes.h:1561
unsigned int is_volatile
Definition gdbtypes.h:1566
unsigned int is_stub
Definition gdbtypes.h:1574
unsigned int is_constructor
Definition gdbtypes.h:1578
unsigned int dummy
Definition gdbtypes.h:1591
unsigned int is_const
Definition gdbtypes.h:1565
unsigned int is_protected
Definition gdbtypes.h:1568
unsigned int is_deleted
Definition gdbtypes.h:1582
struct fn_field * fn_fields
Definition gdbtypes.h:1531
const char * name
Definition gdbtypes.h:1523
struct type * self_type
Definition gdbtypes.h:1801
__extension__ enum dwarf_calling_convention calling_convention
Definition gdbtypes.h:1781
struct call_site * tail_call_list
Definition gdbtypes.h:1796
unsigned int is_noreturn
Definition gdbtypes.h:1787
struct type * descriptive_type
Definition gdbtypes.h:1769
unsigned int m_flag_prototyped
Definition gdbtypes.h:828
unsigned int m_flag_flag_enum
Definition gdbtypes.h:845
__extension__ enum language m_lang
Definition gdbtypes.h:863
unsigned int m_flag_fixed_instance
Definition gdbtypes.h:833
unsigned int m_multi_dimensional
Definition gdbtypes.h:854
unsigned int m_flag_vector
Definition gdbtypes.h:830
struct range_bounds * bounds
Definition gdbtypes.h:926
unsigned int m_flag_stub_supported
Definition gdbtypes.h:831
unsigned int m_flag_endianity_not_default
Definition gdbtypes.h:835
struct field * fields
Definition gdbtypes.h:922
unsigned int m_flag_stub
Definition gdbtypes.h:826
struct type * complex_type
Definition gdbtypes.h:930
unsigned int m_flag_target_stub
Definition gdbtypes.h:827
unsigned int m_flag_varargs
Definition gdbtypes.h:829
unsigned int m_nfields
Definition gdbtypes.h:868
__extension__ enum type_specific_kind type_specific_field
Definition gdbtypes.h:859
struct type * m_target_type
Definition gdbtypes.h:902
const char * name
Definition gdbtypes.h:876
unsigned int m_flag_unsigned
Definition gdbtypes.h:824
__extension__ enum type_code code
Definition gdbtypes.h:818
unsigned int m_flag_nosign
Definition gdbtypes.h:825
union type_specific type_specific
Definition gdbtypes.h:937
union type_owner m_owner
Definition gdbtypes.h:890
unsigned int m_flag_declared_class
Definition gdbtypes.h:840
union main_type::@1 flds_bnds
unsigned int m_flag_objfile_owned
Definition gdbtypes.h:834
unsigned int m_flag_gnu_ifunc
Definition gdbtypes.h:832
struct dynamic_prop_list * dyn_prop_list
Definition gdbtypes.h:940
struct dynamic_prop high
Definition gdbtypes.h:721
struct dynamic_prop stride
Definition gdbtypes.h:728
unsigned int flag_upper_bound_is_count
Definition gdbtypes.h:738
ULONGEST bit_stride() const
Definition gdbtypes.h:707
unsigned int flag_is_byte_stride
Definition gdbtypes.h:747
struct dynamic_prop low
Definition gdbtypes.h:717
LONGEST bias
Definition gdbtypes.h:733
unsigned int flag_bound_evaluated
Definition gdbtypes.h:743
short subrank
Definition gdbtypes.h:1755
short rank
Definition gdbtypes.h:1745
LONGEST offset
Definition gdbtypes.h:2473
struct field * field
Definition gdbtypes.h:2470
struct type * target_type() const
Definition gdbtypes.h:1037
dynamic_prop * dyn_prop(dynamic_prop_node_kind kind) const
type_code code() const
Definition gdbtypes.h:956
void set_is_prototyped(bool is_prototyped)
Definition gdbtypes.h:1164
void copy_fields(struct type *src)
void set_code(type_code code)
Definition gdbtypes.h:962
void remove_dyn_prop(dynamic_prop_node_kind kind)
ULONGEST length() const
Definition gdbtypes.h:983
void set_is_multi_dimensional(bool value)
Definition gdbtypes.h:1298
bool is_fixed_instance() const
Definition gdbtypes.h:1236
bool has_varargs() const
Definition gdbtypes.h:1172
void set_endianity_is_not_default(bool endianity_is_not_default)
Definition gdbtypes.h:1255
struct field & field(int idx) const
Definition gdbtypes.h:1012
void set_has_no_signedness(bool has_no_signedness)
Definition gdbtypes.h:1119
void set_instance_flags(type_instance_flags flags)
Definition gdbtypes.h:1059
void set_index_type(type *index_type)
Definition gdbtypes.h:1047
void set_target_type(struct type *target_type)
Definition gdbtypes.h:1042
bool is_unsigned() const
Definition gdbtypes.h:1100
struct main_type * main_type
Definition gdbtypes.h:1513
void set_is_unsigned(bool is_unsigned)
Definition gdbtypes.h:1105
void set_is_stub(bool is_stub)
Definition gdbtypes.h:1133
void set_is_declared_class(bool is_declared_class) const
Definition gdbtypes.h:1272
struct type * rvalue_reference_type
Definition gdbtypes.h:1462
gdbarch * arch_owner() const
Definition gdbtypes.h:1390
void set_has_varargs(bool has_varargs)
Definition gdbtypes.h:1177
void set_owner(objfile *objfile)
Definition gdbtypes.h:1359
bool target_is_stub() const
Definition gdbtypes.h:1144
bool endianity_is_not_default() const
Definition gdbtypes.h:1250
bool is_gnu_ifunc() const
Definition gdbtypes.h:1216
bool is_vector() const
Definition gdbtypes.h:1186
void copy_fields(std::vector< struct field > &src)
void set_fixed_point_info(struct fixed_point_type_info *info) const
Definition gdbtypes.h:1317
unsigned align_log2
Definition gdbtypes.h:1479
void set_is_flag_enum(bool is_flag_enum)
Definition gdbtypes.h:1286
struct type * pointer_type
Definition gdbtypes.h:1454
void set_bounds(range_bounds *bounds)
Definition gdbtypes.h:1083
enum language language() const
Definition gdbtypes.h:1446
bool is_declared_class() const
Definition gdbtypes.h:1267
struct type * chain
Definition gdbtypes.h:1471
bool is_stub() const
Definition gdbtypes.h:1128
bool has_no_signedness() const
Definition gdbtypes.h:1114
struct objfile * objfile_owner() const
Definition gdbtypes.h:1379
void add_dyn_prop(dynamic_prop_node_kind kind, dynamic_prop prop)
void set_num_fields(unsigned int num_fields)
Definition gdbtypes.h:1000
unsigned int num_fields() const
Definition gdbtypes.h:994
void set_name(const char *name)
Definition gdbtypes.h:974
gdbarch * arch() const
void set_is_vector(bool is_vector)
Definition gdbtypes.h:1191
bool stub_is_supported() const
Definition gdbtypes.h:1201
struct fixed_point_type_info & fixed_point_info() const
Definition gdbtypes.h:1306
void set_is_gnu_ifunc(bool is_gnu_ifunc)
Definition gdbtypes.h:1221
void alloc_fields(unsigned int nfields, bool init=true)
bool bit_size_differs_p() const
Definition gdbtypes.h:1408
void set_owner(gdbarch *arch)
Definition gdbtypes.h:1368
ULONGEST bit_stride() const
Definition gdbtypes.h:1090
void set_length(ULONGEST length)
Definition gdbtypes.h:988
bool is_multi_dimensional() const
Definition gdbtypes.h:1293
const gdb_mpq & fixed_point_scaling_factor()
struct field * fields() const
Definition gdbtypes.h:1006
struct type * reference_type
Definition gdbtypes.h:1458
bool is_string_like()
bool is_pointer_or_reference() const
Definition gdbtypes.h:1431
range_bounds * bounds() const
Definition gdbtypes.h:1065
ULONGEST m_length
Definition gdbtypes.h:1509
void set_is_fixed_instance(bool is_fixed_instance)
Definition gdbtypes.h:1241
const char * name() const
Definition gdbtypes.h:968
type * index_type() const
Definition gdbtypes.h:1032
struct type * fixed_point_type_base_type()
bool is_flag_enum() const
Definition gdbtypes.h:1281
bool is_prototyped() const
Definition gdbtypes.h:1159
void set_stub_is_supported(bool stub_is_supported)
Definition gdbtypes.h:1206
const type_instance_flags instance_flags() const
Definition gdbtypes.h:1053
unsigned m_instance_flags
Definition gdbtypes.h:1491
bool is_array_like()
unsigned short bit_offset() const
Definition gdbtypes.h:1424
void set_fields(struct field *fields)
Definition gdbtypes.h:1019
void set_target_is_stub(bool target_is_stub)
Definition gdbtypes.h:1149
bool is_objfile_owned() const
Definition gdbtypes.h:1353
unsigned short bit_size() const
Definition gdbtypes.h:1416
int discriminant_index
Definition gdbtypes.h:261
gdb::array_view< variant > variants
Definition gdbtypes.h:269
bool is_unsigned
Definition gdbtypes.h:265
int last_field
Definition gdbtypes.h:233
bool matches(ULONGEST value, bool is_unsigned) const
gdb::array_view< variant_part > parts
Definition gdbtypes.h:236
int first_field
Definition gdbtypes.h:232
bool is_default() const
Definition gdbtypes.h:241
gdb::array_view< discriminant_range > discriminants
Definition gdbtypes.h:226
LONGEST const_val
Definition gdbtypes.h:289
const dwarf2_property_baton * baton
Definition gdbtypes.h:293
struct type * original_type
Definition gdbtypes.h:308
const char * variable_name
Definition gdbtypes.h:313
const gdb::array_view< variant_part > * variant_parts
Definition gdbtypes.h:302
struct dwarf2_locexpr_baton * dwarf_block
Definition gdbtypes.h:542
LONGEST bitpos
Definition gdbtypes.h:525
CORE_ADDR physaddr
Definition gdbtypes.h:535
const char * physname
Definition gdbtypes.h:536
LONGEST enumval
Definition gdbtypes.h:528
struct objfile * objfile
Definition gdbtypes.h:514
struct gdbarch * gdbarch
Definition gdbtypes.h:515
struct gnat_aux_type * gnat_stuff
Definition gdbtypes.h:771
struct fixed_point_type_info * fixed_point_info
Definition gdbtypes.h:791
const struct floatformat * floatformat
Definition gdbtypes.h:777
unsigned short bit_offset
Definition gdbtypes.h:805
struct type * self_type
Definition gdbtypes.h:787
struct cplus_struct_type * cplus_stuff
Definition gdbtypes.h:766
struct func_type * func_stuff
Definition gdbtypes.h:781
struct type_specific::@0 int_stuff
unsigned short bit_size
Definition gdbtypes.h:801