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