20#include "gdbsupport/gdb_obstack.h"
87 gdb::unique_xmalloc_ptr<char> s;
103 const char *varstring,
113 const char *local_name;
120 if (local_name != NULL)
124 if (varstring != NULL && *varstring !=
'\0')
130 if ((varstring != NULL && *varstring !=
'\0')
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
138 ||
code == TYPE_CODE_MEMBERPTR
139 ||
code == TYPE_CODE_METHODPTR
142 need_post_space = (varstring != NULL && strcmp (varstring,
"") != 0);
147 if (varstring != NULL)
149 if (
code == TYPE_CODE_FUNC ||
code == TYPE_CODE_METHOD)
156 if (local_name == NULL)
158 demangled_args = strchr (varstring,
'(') != NULL;
170 const char *varstring,
238 gdb_puts (i == 0 ?
": " :
", ", stream);
242 ?
"protected" :
"private"),
260 const char *varstring,
int staticp,
276 int printed_args = 0;
277 for (i = 0; i < nargs; ++i)
279 if (i == 0 && !staticp)
287 struct field arg = args[i];
292 if (printed_args > 0)
304 if (printed_args == 0)
309 else if (printed_args == 0)
323 gdb_assert (nargs > 0);
324 gdb_assert (args[0].
type ()->
code () == TYPE_CODE_PTR);
325 domain = args[0].type ()->target_type ();
359 int show,
int passed_a_ptr,
385 case TYPE_CODE_MEMBERPTR:
398 case TYPE_CODE_METHODPTR:
414 case TYPE_CODE_RVALUE_REF:
422 case TYPE_CODE_METHOD:
431 case TYPE_CODE_ARRAY:
433 stream, show, 0, need_post_space,
439 case TYPE_CODE_TYPEDEF:
441 stream, show, passed_a_ptr, 0,
456 int need_pre_space,
int need_post_space,
459 int did_print_modifier = 0;
460 const char *address_space_id;
470 did_print_modifier = 1;
475 if (did_print_modifier || need_pre_space)
478 did_print_modifier = 1;
483 if (did_print_modifier || need_pre_space)
488 did_print_modifier = 1;
493 if (did_print_modifier || need_pre_space)
496 did_print_modifier = 1;
502 if (address_space_id)
504 if (did_print_modifier || need_pre_space)
507 did_print_modifier = 1;
510 if (did_print_modifier && need_post_space)
536 struct type *param_type;
577 else if (!printed_any
602 if (! strchr (
" \t\f\n\r", *
name))
605 while (strchr (
" \t\f\n\r", *
name))
614 else if (startswith (
name,
"new"))
616 else if (startswith (
name,
"delete"))
653 char *parenstack = (
char *) alloca (strlen (qid));
655 const char *last = 0;
664 else if (*
scan ==
'\\' && *(
scan + 1))
667 else if (
scan[0] ==
':' &&
scan[1] ==
':')
680 else if (*
scan ==
'"' || *
scan ==
'\'')
682 else if (*
scan ==
'(')
683 parenstack[depth++] =
')';
684 else if (*
scan ==
'[')
685 parenstack[depth++] =
']';
689 else if (*
scan ==
'<')
690 parenstack[depth++] =
'>';
693 if (depth > 0 && parenstack[depth - 1] == *
scan)
703 for (i = depth - 1; i >= 0; i--)
704 if (parenstack[i] == *
scan)
728 int show,
int passed_a_ptr,
743 case TYPE_CODE_ARRAY:
745 LONGEST low_bound, high_bound;
752 " __attribute__ ((vector_size(" :
"["));
759 plongest (high_bound - low_bound + 1));
767 case TYPE_CODE_MEMBERPTR:
772 case TYPE_CODE_METHODPTR:
780 case TYPE_CODE_RVALUE_REF:
785 case TYPE_CODE_METHOD:
795 case TYPE_CODE_TYPEDEF:
860 if (!
flags->print_offsets)
872 int level,
bool is_protected,
bool is_private,
963 const char *varstring,
970 unsigned int old_po =
flags->print_offsets;
974 flags->print_offsets = 0;
977 flags->print_offsets = old_po;
993 std::unique_ptr<typedef_hash_table> hash_holder;
996 if (
flags->local_typedefs)
1006 if (
type->
code () == TYPE_CODE_UNION)
1018 && !startswith (
type->
name (),
"{unnamed"))
1035 else if (show > 0 ||
type->
name () == NULL)
1037 struct type *basetype;
1052 std::unique_ptr<typedef_hash_table> semi_holder;
1070 gdb_printf (stream, _(
"%p[<incomplete type>%p]\n"),
1073 gdb_printf (stream, _(
"%p[<no data fields>%p]\n"),
1104 if ((i == vptr_fieldno &&
type == basetype)
1108 if (need_access_label)
1111 (stream, section_type, level,
1118 if (
flags->print_offsets)
1125 int newshow = show - 1;
1127 if (!is_static &&
flags->print_offsets
1154 stream, newshow, level + 4,
1155 language, &local_flags, &local_podata);
1173 if (!
flags->print_methods)
1176 for (
int i = 0; i < len; i++)
1182 for (j = 0; j < len2; j++)
1186 if (real_len > 0 && section_type !=
s_none)
1190 for (
int i = 0; i < len; i++)
1199 for (j = 0; j < len2; j++)
1201 const char *mangled_name;
1202 gdb::unique_xmalloc_ptr<char> mangled_name_holder;
1204 int is_full_physname_constructor =
1208 || method_name[0] ==
'~';
1216 (stream, section_type, level,
1230 _(
"%p[<undefined type>%p] %s;\n"),
1238 && !is_full_physname_constructor
1243 "", stream, -1, 0,
language, &local_flags, podata);
1251 mangled_name = mangled_name_holder.get ();
1256 gdb::unique_xmalloc_ptr<char> demangled_name
1258 DMGL_ANSI | DMGL_PARAMS);
1259 if (demangled_name == NULL)
1280 _(
"<badly mangled name '%s'>"),
1286 const char *demangled_no_class
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);
1322 "", stream, show, level + 4,
1323 language, &semi_local_flags, podata);
1341 gdb_assert (target->
code () == TYPE_CODE_TYPEDEF);
1344 if (need_access_label)
1347 (stream, section_type, level,
1360 stream, show - 1, level + 4,
1361 language, &semi_local_flags, podata);
1366 if (
flags->print_offsets)
1400 int show,
int level,
1432 if (
type->
code () == TYPE_CODE_UNION)
1434 else if (
type->
code () == TYPE_CODE_STRUCT)
1441 else if (
type->
code () == TYPE_CODE_ENUM)
1453 case TYPE_CODE_TYPEDEF:
1456 gdb_assert (
type->
name () == NULL);
1459 _(
"<unnamed typedef>"));
1462 case TYPE_CODE_FUNC:
1463 case TYPE_CODE_METHOD:
1470 case TYPE_CODE_ARRAY:
1472 case TYPE_CODE_MEMBERPTR:
1474 case TYPE_CODE_RVALUE_REF:
1475 case TYPE_CODE_METHODPTR:
1480 case TYPE_CODE_STRUCT:
1481 case TYPE_CODE_UNION:
1486 case TYPE_CODE_ENUM:
1497 && !startswith (
type->
name (),
"{unnamed"))
1512 else if (show > 0 ||
type->
name () == NULL)
1514 LONGEST lastval = 0;
1528 if (underlying->
name () != NULL)
1534 for (i = 0; i < len; i++)
1554 case TYPE_CODE_FLAGS:
1571 _(
"%*s%p[<incomplete type>%p]\n"),
1576 _(
"%*s%p[<no data fields>%p]\n"),
1581 for (i = 0; i < len; i++)
1589 stream, show, level + 4,
1607 case TYPE_CODE_VOID:
1615 case TYPE_CODE_ERROR:
1619 case TYPE_CODE_RANGE:
1624 case TYPE_CODE_FIXED_POINT:
1628 case TYPE_CODE_NAMESPACE:
1648 _(
"<invalid type code %d>"),
type->
code ());
1658 int show,
int level,
static void c_type_print_template_args(const struct type_print_options *flags, struct type *type, struct ui_file *stream, enum language language)
void c_print_typedef(struct type *type, struct symbol *new_symbol, struct ui_file *stream)
static int is_type_conversion_operator(struct type *type, int i, int j)
static void c_type_print_varspec_prefix(struct type *, struct ui_file *, int, int, int, enum language, const struct type_print_options *, struct print_offset_data *)
static void cp_type_print_method_args(struct type *mtype, const char *prefix, const char *varstring, int staticp, struct ui_file *stream, enum language language, const struct type_print_options *flags)
static void c_print_type_1(struct type *type, const char *varstring, struct ui_file *stream, int show, int level, enum language language, const struct type_print_options *flags, struct print_offset_data *podata)
static const char * find_typedef_for_canonicalize(struct type *t, void *data)
static void c_type_print_modifier(struct type *, struct ui_file *, int, int, enum language)
void c_type_print_args(struct type *type, struct ui_file *stream, int linkage_name, enum language language, const struct type_print_options *flags)
static void c_print_type_no_offsets(struct type *type, const char *varstring, struct ui_file *stream, int show, int level, enum language language, struct type_print_options *flags, struct print_offset_data *podata)
static void print_spaces_filtered_with_print_options(int level, struct ui_file *stream, const struct type_print_options *flags)
void c_print_type(struct type *type, const char *varstring, struct ui_file *stream, int show, int level, enum language language, const struct type_print_options *flags)
static const char * remove_qualifiers(const char *qid)
static void c_type_print_varspec_suffix(struct type *, struct ui_file *, int, int, int, enum language, const struct type_print_options *)
static bool need_access_label_p(struct type *type)
void c_type_print_base(struct type *type, struct ui_file *stream, int show, int level, const struct type_print_options *flags)
static void cp_type_print_derivation_info(struct ui_file *stream, struct type *type, const struct type_print_options *flags)
static void print_name_maybe_canonical(const char *name, const struct type_print_options *flags, struct ui_file *stream)
static enum access_specifier output_access_specifier(struct ui_file *stream, enum access_specifier last_access, int level, bool is_protected, bool is_private, const struct type_print_options *flags)
static void c_type_print_base_struct_union(struct type *type, struct ui_file *stream, int show, int level, enum language language, const struct type_print_options *flags, struct print_offset_data *podata)
static void c_type_print_base_1(struct type *type, struct ui_file *stream, int show, int level, enum language language, const struct type_print_options *flags, struct print_offset_data *podata)
ui_file_style style() const
void add_template_parameters(struct type *t)
static const char * find_typedef(const struct type_print_options *flags, struct type *t)
void recursively_update(struct type *)
virtual void wrap_here(int indent)
cli_style_option function_name_style
cli_style_option variable_name_style
cli_style_option metadata_style
enum dtor_kinds is_destructor_name(const char *name)
enum ctor_kinds is_constructor_name(const char *name)
gdb::unique_xmalloc_ptr< char > cp_canonicalize_string_full(const char *string, canonicalization_ftype *finder, void *data)
gdb::unique_xmalloc_ptr< char > gdb_demangle(const char *name, int options)
struct type * make_cv_type(int cnst, int voltl, struct type *type, struct type **typeptr)
const char * address_space_type_instance_flags_to_name(struct gdbarch *gdbarch, type_instance_flags space_flag)
bool get_array_bounds(struct type *type, LONGEST *low_bound, LONGEST *high_bound)
int get_vptr_fieldno(struct type *type, struct type **basetypep)
struct type * check_typedef(struct type *type)
#define TYPE_FN_FIELD_PHYSNAME(thisfn, n)
#define TYPE_NFN_FIELDS(thistype)
#define TYPE_TYPEDEF_FIELD_PROTECTED(thistype, n)
#define TYPE_NESTED_TYPES_FIELD_TYPE(thistype, n)
#define TYPE_NESTED_TYPES_COUNT(thistype)
#define TYPE_IS_REFERENCE(t)
#define TYPE_FN_FIELDLIST1(thistype, n)
#define TYPE_TYPEDEF_FIELD_TYPE(thistype, n)
#define TYPE_TYPEDEF_FIELD_PRIVATE(thistype, n)
#define TYPE_SELF_TYPE(thistype)
#define TYPE_FN_FIELD_STUB(thisfn, n)
#define TYPE_FN_FIELD_TYPE(thisfn, n)
#define TYPE_BASECLASS(thistype, index)
#define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n)
#define TYPE_FN_FIELD_CONSTRUCTOR(thisfn, n)
char * gdb_mangle_name(struct type *, int, int)
#define TYPE_FN_FIELDLIST_LENGTH(thistype, n)
#define TYPE_FN_FIELD_PROTECTED(thisfn, n)
#define TYPE_FN_FIELD_PRIVATE(thisfn, n)
#define TYPE_N_TEMPLATE_ARGUMENTS(thistype)
#define TYPE_FIELD_PROTECTED(thistype, n)
#define TYPE_TEMPLATE_ARGUMENT(thistype, n)
#define TYPE_FN_FIELD_STATIC_P(thisfn, n)
#define TYPE_ERROR_NAME(type)
#define TYPE_TYPEDEF_FIELD_COUNT(thistype)
#define BASETYPE_VIA_VIRTUAL(thistype, index)
#define TYPE_FN_FIELDLIST_NAME(thistype, n)
#define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n)
#define BASETYPE_VIA_PUBLIC(thistype, index)
#define TYPE_FIELD_PRIVATE(thistype, n)
#define TYPE_N_BASECLASSES(thistype)
#define TYPE_TYPEDEF_FIELD_NAME(thistype, n)
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
const struct language_defn * current_language
static void scan(growable_macro_buffer *dest, shared_macro_buffer *src, struct macro_name_list *no_loop, const macro_scope &scope)
#define prefix(a, b, R, do)
static struct symbol * new_symbol(struct die_info *, struct type *, struct dwarf2_cu *, struct symbol *=NULL)
dynamic_prop_kind kind() const
LONGEST loc_bitpos() const
bool is_artificial() const
LONGEST loc_enumval() const
const char * name() const
unsigned int bitsize() const
struct type * type() const
unsigned int is_constructor
const char * print_name() const
const char * linkage_name() const
enum language la_language
void update(struct type *type, unsigned int field_idx, struct ui_file *stream)
static const int indentation
void finish(struct type *type, int level, struct ui_file *stream)
unsigned int offset_bitpos
address_class aclass() const
struct type * type() const
int print_nested_type_limit
typedef_hash_table * local_typedefs
struct type * target_type() const
struct field & field(int idx) const
bool is_declared_class() const
unsigned int num_fields() const
struct field * fields() const
range_bounds * bounds() const
const char * name() const
bool is_prototyped() const
const type_instance_flags instance_flags() const
const ui_file_style * ptr() const
void print_type_fixed_point(struct type *type, struct ui_file *stream)
void type_print(struct type *type, const char *varstring, struct ui_file *stream, int show)
void type_print_unknown_return_type(struct ui_file *stream)
void print_spaces(int n, struct ui_file *stream)
void fprintf_styled(struct ui_file *stream, const ui_file_style &style, const char *format,...)
void gdb_printf(struct ui_file *stream, const char *format,...)
void fputs_styled(const char *linebuffer, const ui_file_style &style, struct ui_file *stream)
void fprintf_symbol(struct ui_file *stream, const char *name, enum language lang, int arg_mode)
void gdb_puts(const char *linebuffer, struct ui_file *stream)