1 /* Support for printing C and C++ types for GDB, the GNU debugger.
2 Copyright (C) 1986-2023 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "gdbsupport/gdb_obstack.h"
24 #include "expression.h"
31 #include "cli/cli-style.h"
32 #include "typeprint.h"
34 #include "cp-support.h"
36 /* A list of access specifiers used for printing. */
46 static void c_type_print_varspec_suffix (struct type
*, struct ui_file
*, int,
49 const struct type_print_options
*);
51 static void c_type_print_varspec_prefix (struct type
*,
55 const struct type_print_options
*,
56 struct print_offset_data
*);
58 /* Print "const", "volatile", or address space modifiers. */
59 static void c_type_print_modifier (struct type
*,
61 int, int, enum language
);
63 static void c_type_print_base_1 (struct type
*type
, struct ui_file
*stream
,
64 int show
, int level
, enum language language
,
65 const struct type_print_options
*flags
,
66 struct print_offset_data
*podata
);
69 /* A callback function for cp_canonicalize_string_full that uses
70 typedef_hash_table::find_typedef. */
73 find_typedef_for_canonicalize (struct type
*t
, void *data
)
75 return typedef_hash_table::find_typedef
76 ((const struct type_print_options
*) data
, t
);
79 /* Print NAME on STREAM. If the 'raw' field of FLAGS is not set,
80 canonicalize NAME using the local typedefs first. */
83 print_name_maybe_canonical (const char *name
,
84 const struct type_print_options
*flags
,
85 struct ui_file
*stream
)
87 gdb::unique_xmalloc_ptr
<char> s
;
90 s
= cp_canonicalize_string_full (name
,
91 find_typedef_for_canonicalize
,
94 gdb_puts (s
!= nullptr ? s
.get () : name
, stream
);
99 /* Helper function for c_print_type. */
102 c_print_type_1 (struct type
*type
,
103 const char *varstring
,
104 struct ui_file
*stream
,
106 enum language language
,
107 const struct type_print_options
*flags
,
108 struct print_offset_data
*podata
)
113 const char *local_name
;
116 type
= check_typedef (type
);
118 local_name
= typedef_hash_table::find_typedef (flags
, type
);
119 code
= type
->code ();
120 if (local_name
!= NULL
)
122 c_type_print_modifier (type
, stream
, 0, 1, language
);
123 gdb_puts (local_name
, stream
);
124 if (varstring
!= NULL
&& *varstring
!= '\0')
125 gdb_puts (" ", stream
);
129 c_type_print_base_1 (type
, stream
, show
, level
, language
, flags
, podata
);
130 if ((varstring
!= NULL
&& *varstring
!= '\0')
131 /* Need a space if going to print stars or brackets;
132 but not if we will print just a type name. */
133 || ((show
> 0 || type
->name () == 0)
134 && (code
== TYPE_CODE_PTR
|| code
== TYPE_CODE_FUNC
135 || code
== TYPE_CODE_METHOD
136 || (code
== TYPE_CODE_ARRAY
137 && !type
->is_vector ())
138 || code
== TYPE_CODE_MEMBERPTR
139 || code
== TYPE_CODE_METHODPTR
140 || TYPE_IS_REFERENCE (type
))))
141 gdb_puts (" ", stream
);
142 need_post_space
= (varstring
!= NULL
&& strcmp (varstring
, "") != 0);
143 c_type_print_varspec_prefix (type
, stream
, show
, 0, need_post_space
,
144 language
, flags
, podata
);
147 if (varstring
!= NULL
)
149 if (code
== TYPE_CODE_FUNC
|| code
== TYPE_CODE_METHOD
)
150 fputs_styled (varstring
, function_name_style
.style (), stream
);
152 fputs_styled (varstring
, variable_name_style
.style (), stream
);
154 /* For demangled function names, we have the arglist as part of
155 the name, so don't print an additional pair of ()'s. */
156 if (local_name
== NULL
)
158 demangled_args
= strchr (varstring
, '(') != NULL
;
159 c_type_print_varspec_suffix (type
, stream
, show
,
169 c_print_type (struct type
*type
,
170 const char *varstring
,
171 struct ui_file
*stream
,
173 enum language language
,
174 const struct type_print_options
*flags
)
176 struct print_offset_data
podata (flags
);
178 c_print_type_1 (type
, varstring
, stream
, show
, level
, language
, flags
,
182 /* Print a typedef using C syntax. TYPE is the underlying type.
183 NEW_SYMBOL is the symbol naming the type. STREAM is the stream on
187 c_print_typedef (struct type
*type
,
188 struct symbol
*new_symbol
,
189 struct ui_file
*stream
)
191 type
= check_typedef (type
);
192 gdb_printf (stream
, "typedef ");
193 type_print (type
, "", stream
, -1);
194 if ((new_symbol
->type ())->name () == 0
195 || strcmp ((new_symbol
->type ())->name (),
196 new_symbol
->linkage_name ()) != 0
197 || new_symbol
->type ()->code () == TYPE_CODE_TYPEDEF
)
198 gdb_printf (stream
, " %s", new_symbol
->print_name ());
199 gdb_printf (stream
, ";");
202 /* If TYPE is a derived type, then print out derivation information.
203 Print only the actual base classes of this type, not the base
204 classes of the base classes. I.e. for the derivation hierarchy:
207 class B : public A {int b; };
208 class C : public B {int c; };
210 Print the type of class C as:
216 Not as the following (like gdb used to), which is not legal C++
217 syntax for derived types and may be confused with the multiple
220 class C : public B : public A {
224 In general, gdb should try to print the types as closely as
225 possible to the form that they appear in the source code. */
228 cp_type_print_derivation_info (struct ui_file
*stream
,
230 const struct type_print_options
*flags
)
235 for (i
= 0; i
< TYPE_N_BASECLASSES (type
); i
++)
237 stream
->wrap_here (8);
238 gdb_puts (i
== 0 ? ": " : ", ", stream
);
239 gdb_printf (stream
, "%s%s ",
240 BASETYPE_VIA_PUBLIC (type
, i
)
241 ? "public" : (TYPE_FIELD_PROTECTED (type
, i
)
242 ? "protected" : "private"),
243 BASETYPE_VIA_VIRTUAL (type
, i
) ? " virtual" : "");
244 name
= TYPE_BASECLASS (type
, i
)->name ();
246 print_name_maybe_canonical (name
, flags
, stream
);
248 gdb_printf (stream
, "(null)");
252 gdb_puts (" ", stream
);
256 /* Print the C++ method arguments ARGS to the file STREAM. */
259 cp_type_print_method_args (struct type
*mtype
, const char *prefix
,
260 const char *varstring
, int staticp
,
261 struct ui_file
*stream
,
262 enum language language
,
263 const struct type_print_options
*flags
)
265 struct field
*args
= mtype
->fields ();
266 int nargs
= mtype
->num_fields ();
267 int varargs
= mtype
->has_varargs ();
270 fprintf_symbol (stream
, prefix
,
271 language_cplus
, DMGL_ANSI
);
272 fprintf_symbol (stream
, varstring
,
273 language_cplus
, DMGL_ANSI
);
274 gdb_puts ("(", stream
);
276 int printed_args
= 0;
277 for (i
= 0; i
< nargs
; ++i
)
279 if (i
== 0 && !staticp
)
281 /* Skip the class variable. We keep this here to accommodate older
282 compilers and debug formats which may not support artificial
287 struct field arg
= args
[i
];
288 /* Skip any artificial arguments. */
289 if (arg
.is_artificial ())
292 if (printed_args
> 0)
294 gdb_printf (stream
, ", ");
295 stream
->wrap_here (8);
298 c_print_type (arg
.type (), "", stream
, 0, 0, language
, flags
);
304 if (printed_args
== 0)
305 gdb_printf (stream
, "...");
307 gdb_printf (stream
, ", ...");
309 else if (printed_args
== 0)
311 if (language
== language_cplus
)
312 gdb_printf (stream
, "void");
315 gdb_printf (stream
, ")");
317 /* For non-static methods, read qualifiers from the type of
323 gdb_assert (nargs
> 0);
324 gdb_assert (args
[0].type ()->code () == TYPE_CODE_PTR
);
325 domain
= args
[0].type ()->target_type ();
327 if (TYPE_CONST (domain
))
328 gdb_printf (stream
, " const");
330 if (TYPE_VOLATILE (domain
))
331 gdb_printf (stream
, " volatile");
333 if (TYPE_RESTRICT (domain
))
334 gdb_printf (stream
, (language
== language_cplus
338 if (TYPE_ATOMIC (domain
))
339 gdb_printf (stream
, " _Atomic");
344 /* Print any asterisks or open-parentheses needed before the
345 variable name (to describe its type).
347 On outermost call, pass 0 for PASSED_A_PTR.
348 On outermost call, SHOW > 0 means should ignore
349 any typename for TYPE and show its details.
350 SHOW is always zero on recursive calls.
352 NEED_POST_SPACE is non-zero when a space will be be needed
353 between a trailing qualifier and a field, variable, or function
357 c_type_print_varspec_prefix (struct type
*type
,
358 struct ui_file
*stream
,
359 int show
, int passed_a_ptr
,
361 enum language language
,
362 const struct type_print_options
*flags
,
363 struct print_offset_data
*podata
)
370 if (type
->name () && show
<= 0)
375 switch (type
->code ())
378 c_type_print_varspec_prefix (type
->target_type (),
379 stream
, show
, 1, 1, language
, flags
,
381 gdb_printf (stream
, "*");
382 c_type_print_modifier (type
, stream
, 1, need_post_space
, language
);
385 case TYPE_CODE_MEMBERPTR
:
386 c_type_print_varspec_prefix (type
->target_type (),
387 stream
, show
, 0, 0, language
, flags
, podata
);
388 name
= TYPE_SELF_TYPE (type
)->name ();
390 print_name_maybe_canonical (name
, flags
, stream
);
392 c_type_print_base_1 (TYPE_SELF_TYPE (type
),
393 stream
, -1, passed_a_ptr
, language
, flags
,
395 gdb_printf (stream
, "::*");
398 case TYPE_CODE_METHODPTR
:
399 c_type_print_varspec_prefix (type
->target_type (),
400 stream
, show
, 0, 0, language
, flags
,
402 gdb_printf (stream
, "(");
403 name
= TYPE_SELF_TYPE (type
)->name ();
405 print_name_maybe_canonical (name
, flags
, stream
);
407 c_type_print_base_1 (TYPE_SELF_TYPE (type
),
408 stream
, -1, passed_a_ptr
, language
, flags
,
410 gdb_printf (stream
, "::*");
414 case TYPE_CODE_RVALUE_REF
:
415 c_type_print_varspec_prefix (type
->target_type (),
416 stream
, show
, 1, 0, language
, flags
,
418 gdb_printf (stream
, type
->code () == TYPE_CODE_REF
? "&" : "&&");
419 c_type_print_modifier (type
, stream
, 1, need_post_space
, language
);
422 case TYPE_CODE_METHOD
:
424 c_type_print_varspec_prefix (type
->target_type (),
425 stream
, show
, 0, 0, language
, flags
,
428 gdb_printf (stream
, "(");
431 case TYPE_CODE_ARRAY
:
432 c_type_print_varspec_prefix (type
->target_type (),
433 stream
, show
, 0, need_post_space
,
434 language
, flags
, podata
);
436 gdb_printf (stream
, "(");
439 case TYPE_CODE_TYPEDEF
:
440 c_type_print_varspec_prefix (type
->target_type (),
441 stream
, show
, passed_a_ptr
, 0,
442 language
, flags
, podata
);
447 /* Print out "const" and "volatile" attributes,
448 and address space id if present.
449 TYPE is a pointer to the type being printed out.
450 STREAM is the output destination.
451 NEED_PRE_SPACE = 1 indicates an initial white space is needed.
452 NEED_POST_SPACE = 1 indicates a final white space is needed. */
455 c_type_print_modifier (struct type
*type
, struct ui_file
*stream
,
456 int need_pre_space
, int need_post_space
,
457 enum language language
)
459 int did_print_modifier
= 0;
460 const char *address_space_id
;
462 /* We don't print `const' qualifiers for references --- since all
463 operators affect the thing referenced, not the reference itself,
464 every reference is `const'. */
465 if (TYPE_CONST (type
) && !TYPE_IS_REFERENCE (type
))
468 gdb_printf (stream
, " ");
469 gdb_printf (stream
, "const");
470 did_print_modifier
= 1;
473 if (TYPE_VOLATILE (type
))
475 if (did_print_modifier
|| need_pre_space
)
476 gdb_printf (stream
, " ");
477 gdb_printf (stream
, "volatile");
478 did_print_modifier
= 1;
481 if (TYPE_RESTRICT (type
))
483 if (did_print_modifier
|| need_pre_space
)
484 gdb_printf (stream
, " ");
485 gdb_printf (stream
, (language
== language_cplus
488 did_print_modifier
= 1;
491 if (TYPE_ATOMIC (type
))
493 if (did_print_modifier
|| need_pre_space
)
494 gdb_printf (stream
, " ");
495 gdb_printf (stream
, "_Atomic");
496 did_print_modifier
= 1;
500 = address_space_type_instance_flags_to_name (type
->arch (),
501 type
->instance_flags ());
502 if (address_space_id
)
504 if (did_print_modifier
|| need_pre_space
)
505 gdb_printf (stream
, " ");
506 gdb_printf (stream
, "@%s", address_space_id
);
507 did_print_modifier
= 1;
510 if (did_print_modifier
&& need_post_space
)
511 gdb_printf (stream
, " ");
515 /* Print out the arguments of TYPE, which should have TYPE_CODE_METHOD
516 or TYPE_CODE_FUNC, to STREAM. Artificial arguments, such as "this"
517 in non-static methods, are displayed if LINKAGE_NAME is zero. If
518 LINKAGE_NAME is non-zero and LANGUAGE is language_cplus the topmost
519 parameter types get removed their possible const and volatile qualifiers to
520 match demangled linkage name parameters part of such function type.
521 LANGUAGE is the language in which TYPE was defined. This is a necessary
522 evil since this code is used by the C and C++. */
525 c_type_print_args (struct type
*type
, struct ui_file
*stream
,
526 int linkage_name
, enum language language
,
527 const struct type_print_options
*flags
)
532 gdb_printf (stream
, "(");
534 for (i
= 0; i
< type
->num_fields (); i
++)
536 struct type
*param_type
;
538 if (type
->field (i
).is_artificial () && linkage_name
)
543 gdb_printf (stream
, ", ");
544 stream
->wrap_here (4);
547 param_type
= type
->field (i
).type ();
549 if (language
== language_cplus
&& linkage_name
)
551 /* C++ standard, 13.1 Overloadable declarations, point 3, item:
552 - Parameter declarations that differ only in the presence or
553 absence of const and/or volatile are equivalent.
555 And the const/volatile qualifiers are not present in the mangled
556 names as produced by GCC. */
558 param_type
= make_cv_type (0, 0, param_type
, NULL
);
561 c_print_type (param_type
, "", stream
, -1, 0, language
, flags
);
565 if (printed_any
&& type
->has_varargs ())
567 /* Print out a trailing ellipsis for varargs functions. Ignore
568 TYPE_VARARGS if the function has no named arguments; that
569 represents unprototyped (K&R style) C functions. */
570 if (printed_any
&& type
->has_varargs ())
572 gdb_printf (stream
, ", ");
573 stream
->wrap_here (4);
574 gdb_printf (stream
, "...");
577 else if (!printed_any
578 && (type
->is_prototyped () || language
== language_cplus
))
579 gdb_printf (stream
, "void");
581 gdb_printf (stream
, ")");
584 /* Return true iff the j'th overloading of the i'th method of TYPE
585 is a type conversion operator, like `operator int () { ... }'.
586 When listing a class's methods, we don't print the return type of
590 is_type_conversion_operator (struct type
*type
, int i
, int j
)
592 /* I think the whole idea of recognizing type conversion operators
593 by their name is pretty terrible. But I don't think our present
594 data structure gives us any other way to tell. If you know of
595 some other way, feel free to rewrite this function. */
596 const char *name
= TYPE_FN_FIELDLIST_NAME (type
, i
);
598 if (!startswith (name
, CP_OPERATOR_STR
))
602 if (! strchr (" \t\f\n\r", *name
))
605 while (strchr (" \t\f\n\r", *name
))
608 if (!('a' <= *name
&& *name
<= 'z')
609 && !('A' <= *name
&& *name
<= 'Z')
611 /* If this doesn't look like the start of an identifier, then it
612 isn't a type conversion operator. */
614 else if (startswith (name
, "new"))
616 else if (startswith (name
, "delete"))
619 /* If it doesn't look like new or delete, it's a type conversion
623 /* Is that really the end of the name? */
624 if (('a' <= *name
&& *name
<= 'z')
625 || ('A' <= *name
&& *name
<= 'Z')
626 || ('0' <= *name
&& *name
<= '9')
628 /* No, so the identifier following "operator" must be a type name,
629 and this is a type conversion operator. */
632 /* That was indeed the end of the name, so it was `operator new' or
633 `operator delete', neither of which are type conversion
638 /* Given a C++ qualified identifier QID, strip off the qualifiers,
639 yielding the unqualified name. The return value is a pointer into
642 It's a pity we don't have this information in some more structured
643 form. Even the author of this function feels that writing little
644 parsers like this everywhere is stupid. */
647 remove_qualifiers (const char *qid
)
649 int quoted
= 0; /* Zero if we're not in quotes;
650 '"' if we're in a double-quoted string;
651 '\'' if we're in a single-quoted string. */
652 int depth
= 0; /* Number of unclosed parens we've seen. */
653 char *parenstack
= (char *) alloca (strlen (qid
));
655 const char *last
= 0; /* The character after the rightmost
656 `::' token we've seen so far. */
658 for (scan
= qid
; *scan
; scan
++)
664 else if (*scan
== '\\' && *(scan
+ 1))
667 else if (scan
[0] == ':' && scan
[1] == ':')
669 /* If we're inside parenthesis (i.e., an argument list) or
670 angle brackets (i.e., a list of template arguments), then
671 we don't record the position of this :: token, since it's
672 not relevant to the top-level structure we're trying to
680 else if (*scan
== '"' || *scan
== '\'')
682 else if (*scan
== '(')
683 parenstack
[depth
++] = ')';
684 else if (*scan
== '[')
685 parenstack
[depth
++] = ']';
686 /* We're going to treat <> as a pair of matching characters,
687 since we're more likely to see those in template id's than
688 real less-than characters. What a crock. */
689 else if (*scan
== '<')
690 parenstack
[depth
++] = '>';
691 else if (*scan
== ')' || *scan
== ']' || *scan
== '>')
693 if (depth
> 0 && parenstack
[depth
- 1] == *scan
)
697 /* We're going to do a little error recovery here. If
698 we don't find a match for *scan on the paren stack,
699 but there is something lower on the stack that does
700 match, we pop the stack to that point. */
703 for (i
= depth
- 1; i
>= 0; i
--)
704 if (parenstack
[i
] == *scan
)
716 /* We didn't find any :: tokens at the top level, so declare the
717 whole thing an unqualified identifier. */
721 /* Print any array sizes, function arguments or close parentheses
722 needed after the variable name (to describe its type).
723 Args work like c_type_print_varspec_prefix. */
726 c_type_print_varspec_suffix (struct type
*type
,
727 struct ui_file
*stream
,
728 int show
, int passed_a_ptr
,
730 enum language language
,
731 const struct type_print_options
*flags
)
736 if (type
->name () && show
<= 0)
741 switch (type
->code ())
743 case TYPE_CODE_ARRAY
:
745 LONGEST low_bound
, high_bound
;
746 int is_vector
= type
->is_vector ();
749 gdb_printf (stream
, ")");
751 gdb_printf (stream
, (is_vector
?
752 " __attribute__ ((vector_size(" : "["));
753 /* Bounds are not yet resolved, print a bounds placeholder instead. */
754 if (type
->bounds ()->high
.kind () == PROP_LOCEXPR
755 || type
->bounds ()->high
.kind () == PROP_LOCLIST
)
756 gdb_printf (stream
, "variable length");
757 else if (get_array_bounds (type
, &low_bound
, &high_bound
))
758 gdb_printf (stream
, "%s",
759 plongest (high_bound
- low_bound
+ 1));
760 gdb_printf (stream
, (is_vector
? ")))" : "]"));
762 c_type_print_varspec_suffix (type
->target_type (), stream
,
763 show
, 0, 0, language
, flags
);
767 case TYPE_CODE_MEMBERPTR
:
768 c_type_print_varspec_suffix (type
->target_type (), stream
,
769 show
, 0, 0, language
, flags
);
772 case TYPE_CODE_METHODPTR
:
773 gdb_printf (stream
, ")");
774 c_type_print_varspec_suffix (type
->target_type (), stream
,
775 show
, 0, 0, language
, flags
);
780 case TYPE_CODE_RVALUE_REF
:
781 c_type_print_varspec_suffix (type
->target_type (), stream
,
782 show
, 1, 0, language
, flags
);
785 case TYPE_CODE_METHOD
:
788 gdb_printf (stream
, ")");
790 c_type_print_args (type
, stream
, 0, language
, flags
);
791 c_type_print_varspec_suffix (type
->target_type (), stream
,
792 show
, passed_a_ptr
, 0, language
, flags
);
795 case TYPE_CODE_TYPEDEF
:
796 c_type_print_varspec_suffix (type
->target_type (), stream
,
797 show
, passed_a_ptr
, 0, language
, flags
);
802 /* A helper for c_type_print_base that displays template
803 parameters and their bindings, if needed.
805 TABLE is the local bindings table to use. If NULL, no printing is
806 done. Note that, at this point, TABLE won't have any useful
807 information in it -- but it is also used as a flag to
808 print_name_maybe_canonical to activate searching the global typedef
811 TYPE is the type whose template arguments are being displayed.
813 STREAM is the stream on which to print. */
816 c_type_print_template_args (const struct type_print_options
*flags
,
817 struct type
*type
, struct ui_file
*stream
,
818 enum language language
)
825 for (i
= 0; i
< TYPE_N_TEMPLATE_ARGUMENTS (type
); ++i
)
827 struct symbol
*sym
= TYPE_TEMPLATE_ARGUMENT (type
, i
);
829 if (sym
->aclass () != LOC_TYPEDEF
)
834 stream
->wrap_here (4);
835 gdb_printf (stream
, _("[with %s = "), sym
->linkage_name ());
840 gdb_puts (", ", stream
);
841 stream
->wrap_here (9);
842 gdb_printf (stream
, "%s = ", sym
->linkage_name ());
845 c_print_type (sym
->type (), "", stream
, -1, 0, language
, flags
);
849 gdb_puts (_("] "), stream
);
852 /* Use 'print_spaces', but take into consideration the
853 type_print_options FLAGS in order to determine how many whitespaces
857 print_spaces_filtered_with_print_options
858 (int level
, struct ui_file
*stream
, const struct type_print_options
*flags
)
860 if (!flags
->print_offsets
)
861 print_spaces (level
, stream
);
863 print_spaces (level
+ print_offset_data::indentation
, stream
);
866 /* Output an access specifier to STREAM, if needed. LAST_ACCESS is the
867 last access specifier output (typically returned by this function). */
869 static enum access_specifier
870 output_access_specifier (struct ui_file
*stream
,
871 enum access_specifier last_access
,
872 int level
, bool is_protected
, bool is_private
,
873 const struct type_print_options
*flags
)
877 if (last_access
!= s_protected
)
879 last_access
= s_protected
;
880 print_spaces_filtered_with_print_options (level
+ 2, stream
, flags
);
881 gdb_printf (stream
, "protected:\n");
886 if (last_access
!= s_private
)
888 last_access
= s_private
;
889 print_spaces_filtered_with_print_options (level
+ 2, stream
, flags
);
890 gdb_printf (stream
, "private:\n");
895 if (last_access
!= s_public
)
897 last_access
= s_public
;
898 print_spaces_filtered_with_print_options (level
+ 2, stream
, flags
);
899 gdb_printf (stream
, "public:\n");
906 /* Return true if an access label (i.e., "public:", "private:",
907 "protected:") needs to be printed for TYPE. */
910 need_access_label_p (struct type
*type
)
912 if (type
->is_declared_class ())
915 for (int i
= TYPE_N_BASECLASSES (type
); i
< type
->num_fields (); i
++)
916 if (!TYPE_FIELD_PRIVATE (type
, i
))
919 for (int j
= 0; j
< TYPE_NFN_FIELDS (type
); j
++)
920 for (int i
= 0; i
< TYPE_FN_FIELDLIST_LENGTH (type
, j
); i
++)
921 if (!TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type
,
925 for (int i
= 0; i
< TYPE_TYPEDEF_FIELD_COUNT (type
); ++i
)
926 if (!TYPE_TYPEDEF_FIELD_PRIVATE (type
, i
))
932 for (int i
= TYPE_N_BASECLASSES (type
); i
< type
->num_fields (); i
++)
933 if (TYPE_FIELD_PRIVATE (type
, i
) || TYPE_FIELD_PROTECTED (type
, i
))
936 for (int j
= 0; j
< TYPE_NFN_FIELDS (type
); j
++)
939 for (int i
= 0; i
< TYPE_FN_FIELDLIST_LENGTH (type
, j
); i
++)
940 if (TYPE_FN_FIELD_PROTECTED (TYPE_FN_FIELDLIST1 (type
,
942 || TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type
,
948 for (int i
= 0; i
< TYPE_TYPEDEF_FIELD_COUNT (type
); ++i
)
949 if (TYPE_TYPEDEF_FIELD_PROTECTED (type
, i
)
950 || TYPE_TYPEDEF_FIELD_PRIVATE (type
, i
))
957 /* Helper function that temporarily disables FLAGS->PRINT_OFFSETS,
958 calls 'c_print_type_1', and then reenables FLAGS->PRINT_OFFSETS if
962 c_print_type_no_offsets (struct type
*type
,
963 const char *varstring
,
964 struct ui_file
*stream
,
966 enum language language
,
967 struct type_print_options
*flags
,
968 struct print_offset_data
*podata
)
970 unsigned int old_po
= flags
->print_offsets
;
972 /* Temporarily disable print_offsets, because it would mess with
974 flags
->print_offsets
= 0;
975 c_print_type_1 (type
, varstring
, stream
, show
, level
, language
, flags
,
977 flags
->print_offsets
= old_po
;
980 /* Helper for 'c_type_print_base' that handles structs and unions.
981 For a description of the arguments, see 'c_type_print_base'. */
984 c_type_print_base_struct_union (struct type
*type
, struct ui_file
*stream
,
986 enum language language
,
987 const struct type_print_options
*flags
,
988 struct print_offset_data
*podata
)
990 struct type_print_options local_flags
= *flags
;
991 local_flags
.local_typedefs
= NULL
;
993 std::unique_ptr
<typedef_hash_table
> hash_holder
;
996 if (flags
->local_typedefs
)
997 local_flags
.local_typedefs
998 = new typedef_hash_table (*flags
->local_typedefs
);
1000 local_flags
.local_typedefs
= new typedef_hash_table ();
1002 hash_holder
.reset (local_flags
.local_typedefs
);
1005 c_type_print_modifier (type
, stream
, 0, 1, language
);
1006 if (type
->code () == TYPE_CODE_UNION
)
1007 gdb_printf (stream
, "union ");
1008 else if (type
->is_declared_class ())
1009 gdb_printf (stream
, "class ");
1011 gdb_printf (stream
, "struct ");
1013 /* Print the tag if it exists. The HP aCC compiler emits a
1014 spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed
1015 enum}" tag for unnamed struct/union/enum's, which we don't
1017 if (type
->name () != NULL
1018 && !startswith (type
->name (), "{unnamed"))
1020 /* When printing the tag name, we are still effectively
1021 printing in the outer context, hence the use of FLAGS
1023 print_name_maybe_canonical (type
->name (), flags
, stream
);
1025 gdb_puts (" ", stream
);
1030 /* If we just printed a tag name, no need to print anything
1032 if (type
->name () == NULL
)
1033 gdb_printf (stream
, "{...}");
1035 else if (show
> 0 || type
->name () == NULL
)
1037 struct type
*basetype
;
1040 c_type_print_template_args (&local_flags
, type
, stream
, language
);
1042 /* Add in template parameters when printing derivation info. */
1043 if (local_flags
.local_typedefs
!= NULL
)
1044 local_flags
.local_typedefs
->add_template_parameters (type
);
1045 cp_type_print_derivation_info (stream
, type
, &local_flags
);
1047 /* This holds just the global typedefs and the template
1049 struct type_print_options semi_local_flags
= *flags
;
1050 semi_local_flags
.local_typedefs
= NULL
;
1052 std::unique_ptr
<typedef_hash_table
> semi_holder
;
1053 if (local_flags
.local_typedefs
!= nullptr)
1055 semi_local_flags
.local_typedefs
1056 = new typedef_hash_table (*local_flags
.local_typedefs
);
1057 semi_holder
.reset (semi_local_flags
.local_typedefs
);
1059 /* Now add in the local typedefs. */
1060 local_flags
.local_typedefs
->recursively_update (type
);
1063 gdb_printf (stream
, "{\n");
1065 if (type
->num_fields () == 0 && TYPE_NFN_FIELDS (type
) == 0
1066 && TYPE_TYPEDEF_FIELD_COUNT (type
) == 0)
1068 print_spaces_filtered_with_print_options (level
+ 4, stream
, flags
);
1069 if (type
->is_stub ())
1070 gdb_printf (stream
, _("%p[<incomplete type>%p]\n"),
1071 metadata_style
.style ().ptr (), nullptr);
1073 gdb_printf (stream
, _("%p[<no data fields>%p]\n"),
1074 metadata_style
.style ().ptr (), nullptr);
1077 /* Start off with no specific section type, so we can print
1078 one for the first field we find, and use that section type
1079 thereafter until we find another type. */
1081 enum access_specifier section_type
= s_none
;
1083 /* For a class, if all members are private, there's no need
1084 for a "private:" label; similarly, for a struct or union
1085 masquerading as a class, if all members are public, there's
1086 no need for a "public:" label. */
1087 bool need_access_label
= need_access_label_p (type
);
1089 /* If there is a base class for this type,
1090 do not print the field that it occupies. */
1092 int len
= type
->num_fields ();
1093 vptr_fieldno
= get_vptr_fieldno (type
, &basetype
);
1095 struct print_offset_data
local_podata (flags
);
1097 for (int i
= TYPE_N_BASECLASSES (type
); i
< len
; i
++)
1101 /* If we have a virtual table pointer, omit it. Even if
1102 virtual table pointers are not specifically marked in
1103 the debug info, they should be artificial. */
1104 if ((i
== vptr_fieldno
&& type
== basetype
)
1105 || type
->field (i
).is_artificial ())
1108 if (need_access_label
)
1110 section_type
= output_access_specifier
1111 (stream
, section_type
, level
,
1112 TYPE_FIELD_PROTECTED (type
, i
),
1113 TYPE_FIELD_PRIVATE (type
, i
), flags
);
1116 bool is_static
= type
->field (i
).is_static ();
1118 if (flags
->print_offsets
)
1119 podata
->update (type
, i
, stream
);
1121 print_spaces (level
+ 4, stream
);
1123 gdb_printf (stream
, "static ");
1125 int newshow
= show
- 1;
1127 if (!is_static
&& flags
->print_offsets
1128 && (type
->field (i
).type ()->code () == TYPE_CODE_STRUCT
1129 || type
->field (i
).type ()->code () == TYPE_CODE_UNION
))
1131 /* If we're printing offsets and this field's type is
1132 either a struct or an union, then we're interested in
1136 /* Make sure we carry our offset when we expand the
1138 local_podata
.offset_bitpos
1139 = podata
->offset_bitpos
+ type
->field (i
).loc_bitpos ();
1140 /* We're entering a struct/union. Right now,
1141 PODATA->END_BITPOS points right *after* the
1142 struct/union. However, when printing the first field
1143 of this inner struct/union, the end_bitpos we're
1144 expecting is exactly at the beginning of the
1145 struct/union. Therefore, we subtract the length of
1146 the whole struct/union. */
1147 local_podata
.end_bitpos
1148 = podata
->end_bitpos
1149 - type
->field (i
).type ()->length () * TARGET_CHAR_BIT
;
1152 c_print_type_1 (type
->field (i
).type (),
1153 type
->field (i
).name (),
1154 stream
, newshow
, level
+ 4,
1155 language
, &local_flags
, &local_podata
);
1157 if (!is_static
&& type
->field (i
).is_packed ())
1159 /* It is a bitfield. This code does not attempt
1160 to look at the bitpos and reconstruct filler,
1161 unnamed fields. This would lead to misleading
1162 results if the compiler does not put out fields
1163 for such things (I don't know what it does). */
1164 gdb_printf (stream
, " : %d", type
->field (i
).bitsize ());
1166 gdb_printf (stream
, ";\n");
1169 /* If there are both fields and methods, put a blank line
1170 between them. Make sure to count only method that we
1171 will display; artificial methods will be hidden. */
1172 len
= TYPE_NFN_FIELDS (type
);
1173 if (!flags
->print_methods
)
1176 for (int i
= 0; i
< len
; i
++)
1178 struct fn_field
*f
= TYPE_FN_FIELDLIST1 (type
, i
);
1179 int len2
= TYPE_FN_FIELDLIST_LENGTH (type
, i
);
1182 for (j
= 0; j
< len2
; j
++)
1183 if (!TYPE_FN_FIELD_ARTIFICIAL (f
, j
))
1186 if (real_len
> 0 && section_type
!= s_none
)
1187 gdb_printf (stream
, "\n");
1189 /* C++: print out the methods. */
1190 for (int i
= 0; i
< len
; i
++)
1192 struct fn_field
*f
= TYPE_FN_FIELDLIST1 (type
, i
);
1193 int j
, len2
= TYPE_FN_FIELDLIST_LENGTH (type
, i
);
1194 const char *method_name
= TYPE_FN_FIELDLIST_NAME (type
, i
);
1195 const char *name
= type
->name ();
1196 int is_constructor
= name
&& strcmp (method_name
,
1199 for (j
= 0; j
< len2
; j
++)
1201 const char *mangled_name
;
1202 gdb::unique_xmalloc_ptr
<char> mangled_name_holder
;
1203 const char *physname
= TYPE_FN_FIELD_PHYSNAME (f
, j
);
1204 int is_full_physname_constructor
=
1205 TYPE_FN_FIELD_CONSTRUCTOR (f
, j
)
1206 || is_constructor_name (physname
)
1207 || is_destructor_name (physname
)
1208 || method_name
[0] == '~';
1210 /* Do not print out artificial methods. */
1211 if (TYPE_FN_FIELD_ARTIFICIAL (f
, j
))
1215 section_type
= output_access_specifier
1216 (stream
, section_type
, level
,
1217 TYPE_FN_FIELD_PROTECTED (f
, j
),
1218 TYPE_FN_FIELD_PRIVATE (f
, j
), flags
);
1220 print_spaces_filtered_with_print_options (level
+ 4, stream
,
1222 if (TYPE_FN_FIELD_VIRTUAL_P (f
, j
))
1223 gdb_printf (stream
, "virtual ");
1224 else if (TYPE_FN_FIELD_STATIC_P (f
, j
))
1225 gdb_printf (stream
, "static ");
1226 if (TYPE_FN_FIELD_TYPE (f
, j
)->target_type () == 0)
1228 /* Keep GDB from crashing here. */
1230 _("%p[<undefined type>%p] %s;\n"),
1231 metadata_style
.style ().ptr (), nullptr,
1232 TYPE_FN_FIELD_PHYSNAME (f
, j
));
1235 else if (!is_constructor
/* Constructors don't
1238 && !is_full_physname_constructor
/* " " */
1239 && !is_type_conversion_operator (type
, i
, j
))
1241 c_print_type_no_offsets
1242 (TYPE_FN_FIELD_TYPE (f
, j
)->target_type (),
1243 "", stream
, -1, 0, language
, &local_flags
, podata
);
1245 gdb_puts (" ", stream
);
1247 if (TYPE_FN_FIELD_STUB (f
, j
))
1249 /* Build something we can demangle. */
1250 mangled_name_holder
.reset (gdb_mangle_name (type
, i
, j
));
1251 mangled_name
= mangled_name_holder
.get ();
1254 mangled_name
= TYPE_FN_FIELD_PHYSNAME (f
, j
);
1256 gdb::unique_xmalloc_ptr
<char> demangled_name
1257 = gdb_demangle (mangled_name
,
1258 DMGL_ANSI
| DMGL_PARAMS
);
1259 if (demangled_name
== NULL
)
1261 /* In some cases (for instance with the HP
1262 demangling), if a function has more than 10
1263 arguments, the demangling will fail.
1264 Let's try to reconstruct the function
1265 signature from the symbol information. */
1266 if (!TYPE_FN_FIELD_STUB (f
, j
))
1268 int staticp
= TYPE_FN_FIELD_STATIC_P (f
, j
);
1269 struct type
*mtype
= TYPE_FN_FIELD_TYPE (f
, j
);
1271 cp_type_print_method_args (mtype
,
1279 fprintf_styled (stream
, metadata_style
.style (),
1280 _("<badly mangled name '%s'>"),
1286 const char *demangled_no_class
1287 = remove_qualifiers (demangled_name
.get ());
1289 /* Get rid of the `static' appended by the
1291 p
= strstr (demangled_no_class
, " static");
1294 int length
= p
- demangled_no_class
;
1295 std::string
demangled_no_static (demangled_no_class
,
1297 gdb_puts (demangled_no_static
.c_str (), stream
);
1300 gdb_puts (demangled_no_class
, stream
);
1303 gdb_printf (stream
, ";\n");
1307 /* Print out nested types. */
1308 if (TYPE_NESTED_TYPES_COUNT (type
) != 0
1309 && semi_local_flags
.print_nested_type_limit
!= 0)
1311 if (semi_local_flags
.print_nested_type_limit
> 0)
1312 --semi_local_flags
.print_nested_type_limit
;
1314 if (type
->num_fields () != 0 || TYPE_NFN_FIELDS (type
) != 0)
1315 gdb_printf (stream
, "\n");
1317 for (int i
= 0; i
< TYPE_NESTED_TYPES_COUNT (type
); ++i
)
1319 print_spaces_filtered_with_print_options (level
+ 4, stream
,
1321 c_print_type_no_offsets (TYPE_NESTED_TYPES_FIELD_TYPE (type
, i
),
1322 "", stream
, show
, level
+ 4,
1323 language
, &semi_local_flags
, podata
);
1324 gdb_printf (stream
, ";\n");
1328 /* Print typedefs defined in this class. */
1330 if (TYPE_TYPEDEF_FIELD_COUNT (type
) != 0 && flags
->print_typedefs
)
1332 if (type
->num_fields () != 0 || TYPE_NFN_FIELDS (type
) != 0
1333 || TYPE_NESTED_TYPES_COUNT (type
) != 0)
1334 gdb_printf (stream
, "\n");
1336 for (int i
= 0; i
< TYPE_TYPEDEF_FIELD_COUNT (type
); i
++)
1338 struct type
*target
= TYPE_TYPEDEF_FIELD_TYPE (type
, i
);
1340 /* Dereference the typedef declaration itself. */
1341 gdb_assert (target
->code () == TYPE_CODE_TYPEDEF
);
1342 target
= target
->target_type ();
1344 if (need_access_label
)
1346 section_type
= output_access_specifier
1347 (stream
, section_type
, level
,
1348 TYPE_TYPEDEF_FIELD_PROTECTED (type
, i
),
1349 TYPE_TYPEDEF_FIELD_PRIVATE (type
, i
), flags
);
1351 print_spaces_filtered_with_print_options (level
+ 4, stream
,
1353 gdb_printf (stream
, "typedef ");
1355 /* We want to print typedefs with substitutions
1356 from the template parameters or globally-known
1357 typedefs but not local typedefs. */
1358 c_print_type_no_offsets (target
,
1359 TYPE_TYPEDEF_FIELD_NAME (type
, i
),
1360 stream
, show
- 1, level
+ 4,
1361 language
, &semi_local_flags
, podata
);
1362 gdb_printf (stream
, ";\n");
1366 if (flags
->print_offsets
)
1369 podata
->finish (type
, level
, stream
);
1371 print_spaces (print_offset_data::indentation
, stream
);
1373 print_spaces (2, stream
);
1376 gdb_printf (stream
, "%*s}", level
, "");
1380 /* Print the name of the type (or the ultimate pointer target,
1381 function value or array element), or the description of a structure
1384 SHOW positive means print details about the type (e.g. enum
1385 values), and print structure elements passing SHOW - 1 for show.
1387 SHOW negative means just print the type name or struct tag if there
1388 is one. If there is no name, print something sensible but concise
1389 like "struct {...}".
1391 SHOW zero means just print the type name or struct tag if there is
1392 one. If there is no name, print something sensible but not as
1393 concise like "struct {int x; int y;}".
1395 LEVEL is the number of spaces to indent by.
1396 We increase it for some recursive calls. */
1399 c_type_print_base_1 (struct type
*type
, struct ui_file
*stream
,
1400 int show
, int level
,
1401 enum language language
,
1402 const struct type_print_options
*flags
,
1403 struct print_offset_data
*podata
)
1412 fputs_styled (_("<type unknown>"), metadata_style
.style (), stream
);
1416 /* When SHOW is zero or less, and there is a valid type name, then
1417 always just print the type name directly from the type. */
1420 && type
->name () != NULL
)
1422 c_type_print_modifier (type
, stream
, 0, 1, language
);
1424 /* If we have "typedef struct foo {. . .} bar;" do we want to
1425 print it as "struct foo" or as "bar"? Pick the latter for
1426 C++, because C++ folk tend to expect things like "class5
1427 *foo" rather than "struct class5 *foo". We rather
1428 arbitrarily choose to make language_minimal work in a C-like
1430 if (language
== language_c
|| language
== language_minimal
)
1432 if (type
->code () == TYPE_CODE_UNION
)
1433 gdb_printf (stream
, "union ");
1434 else if (type
->code () == TYPE_CODE_STRUCT
)
1436 if (type
->is_declared_class ())
1437 gdb_printf (stream
, "class ");
1439 gdb_printf (stream
, "struct ");
1441 else if (type
->code () == TYPE_CODE_ENUM
)
1442 gdb_printf (stream
, "enum ");
1445 print_name_maybe_canonical (type
->name (), flags
, stream
);
1449 type
= check_typedef (type
);
1451 switch (type
->code ())
1453 case TYPE_CODE_TYPEDEF
:
1454 /* If we get here, the typedef doesn't have a name, and we
1455 couldn't resolve type::target_type. Not much we can do. */
1456 gdb_assert (type
->name () == NULL
);
1457 gdb_assert (type
->target_type () == NULL
);
1458 fprintf_styled (stream
, metadata_style
.style (),
1459 _("<unnamed typedef>"));
1462 case TYPE_CODE_FUNC
:
1463 case TYPE_CODE_METHOD
:
1464 if (type
->target_type () == NULL
)
1465 type_print_unknown_return_type (stream
);
1467 c_type_print_base_1 (type
->target_type (),
1468 stream
, show
, level
, language
, flags
, podata
);
1470 case TYPE_CODE_ARRAY
:
1472 case TYPE_CODE_MEMBERPTR
:
1474 case TYPE_CODE_RVALUE_REF
:
1475 case TYPE_CODE_METHODPTR
:
1476 c_type_print_base_1 (type
->target_type (),
1477 stream
, show
, level
, language
, flags
, podata
);
1480 case TYPE_CODE_STRUCT
:
1481 case TYPE_CODE_UNION
:
1482 c_type_print_base_struct_union (type
, stream
, show
, level
,
1483 language
, flags
, podata
);
1486 case TYPE_CODE_ENUM
:
1487 c_type_print_modifier (type
, stream
, 0, 1, language
);
1488 gdb_printf (stream
, "enum ");
1489 if (type
->is_declared_class ())
1490 gdb_printf (stream
, "class ");
1491 /* Print the tag name if it exists.
1492 The aCC compiler emits a spurious
1493 "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
1494 tag for unnamed struct/union/enum's, which we don't
1496 if (type
->name () != NULL
1497 && !startswith (type
->name (), "{unnamed"))
1499 print_name_maybe_canonical (type
->name (), flags
, stream
);
1501 gdb_puts (" ", stream
);
1504 stream
->wrap_here (4);
1507 /* If we just printed a tag name, no need to print anything
1509 if (type
->name () == NULL
)
1510 gdb_printf (stream
, "{...}");
1512 else if (show
> 0 || type
->name () == NULL
)
1514 LONGEST lastval
= 0;
1516 /* We can't handle this case perfectly, as DWARF does not
1517 tell us whether or not the underlying type was specified
1518 in the source (and other debug formats don't provide this
1519 at all). We choose to print the underlying type, if it
1520 has a name, when in C++ on the theory that it's better to
1521 print too much than too little; but conversely not to
1522 print something egregiously outside the current
1523 language's syntax. */
1524 if (language
== language_cplus
&& type
->target_type () != NULL
)
1526 struct type
*underlying
= check_typedef (type
->target_type ());
1528 if (underlying
->name () != NULL
)
1529 gdb_printf (stream
, ": %s ", underlying
->name ());
1532 gdb_printf (stream
, "{");
1533 len
= type
->num_fields ();
1534 for (i
= 0; i
< len
; i
++)
1538 gdb_printf (stream
, ", ");
1539 stream
->wrap_here (4);
1540 fputs_styled (type
->field (i
).name (),
1541 variable_name_style
.style (), stream
);
1542 if (lastval
!= type
->field (i
).loc_enumval ())
1544 gdb_printf (stream
, " = %s",
1545 plongest (type
->field (i
).loc_enumval ()));
1546 lastval
= type
->field (i
).loc_enumval ();
1550 gdb_printf (stream
, "}");
1554 case TYPE_CODE_FLAGS
:
1556 struct type_print_options local_flags
= *flags
;
1558 local_flags
.local_typedefs
= NULL
;
1560 c_type_print_modifier (type
, stream
, 0, 1, language
);
1561 gdb_printf (stream
, "flag ");
1562 print_name_maybe_canonical (type
->name (), flags
, stream
);
1565 gdb_puts (" ", stream
);
1566 gdb_printf (stream
, "{\n");
1567 if (type
->num_fields () == 0)
1569 if (type
->is_stub ())
1571 _("%*s%p[<incomplete type>%p]\n"),
1573 metadata_style
.style ().ptr (), nullptr);
1576 _("%*s%p[<no data fields>%p]\n"),
1578 metadata_style
.style ().ptr (), nullptr);
1580 len
= type
->num_fields ();
1581 for (i
= 0; i
< len
; i
++)
1584 print_spaces (level
+ 4, stream
);
1585 /* We pass "show" here and not "show - 1" to get enum types
1586 printed. There's no other way to see them. */
1587 c_print_type_1 (type
->field (i
).type (),
1588 type
->field (i
).name (),
1589 stream
, show
, level
+ 4,
1590 language
, &local_flags
, podata
);
1591 gdb_printf (stream
, " @%s",
1592 plongest (type
->field (i
).loc_bitpos ()));
1593 if (type
->field (i
).bitsize () > 1)
1595 gdb_printf (stream
, "-%s",
1596 plongest (type
->field (i
).loc_bitpos ()
1597 + type
->field (i
).bitsize ()
1600 gdb_printf (stream
, ";\n");
1602 gdb_printf (stream
, "%*s}", level
, "");
1607 case TYPE_CODE_VOID
:
1608 gdb_printf (stream
, "void");
1611 case TYPE_CODE_UNDEF
:
1612 gdb_printf (stream
, _("struct <unknown>"));
1615 case TYPE_CODE_ERROR
:
1616 gdb_printf (stream
, "%s", TYPE_ERROR_NAME (type
));
1619 case TYPE_CODE_RANGE
:
1620 /* This should not occur. */
1621 fprintf_styled (stream
, metadata_style
.style (), _("<range type>"));
1624 case TYPE_CODE_FIXED_POINT
:
1625 print_type_fixed_point (type
, stream
);
1628 case TYPE_CODE_NAMESPACE
:
1629 gdb_puts ("namespace ", stream
);
1630 gdb_puts (type
->name (), stream
);
1634 /* Handle types not explicitly handled by the other cases, such
1635 as fundamental types. For these, just print whatever the
1636 type name is, as recorded in the type itself. If there is no
1637 type name, then complain. */
1638 if (type
->name () != NULL
)
1640 c_type_print_modifier (type
, stream
, 0, 1, language
);
1641 print_name_maybe_canonical (type
->name (), flags
, stream
);
1645 /* At least for dump_symtab, it is important that this not
1647 fprintf_styled (stream
, metadata_style
.style (),
1648 _("<invalid type code %d>"), type
->code ());
1654 /* See c_type_print_base_1. */
1657 c_type_print_base (struct type
*type
, struct ui_file
*stream
,
1658 int show
, int level
,
1659 const struct type_print_options
*flags
)
1661 struct print_offset_data
podata (flags
);
1663 c_type_print_base_1 (type
, stream
, show
, level
,
1664 current_language
->la_language
, flags
, &podata
);