GDB (xrefs)

Macros | Enumerations | Functions
/tmp/gdb-8.1/gdb/c-typeprint.c File Reference
`#include "defs.h"`
`#include "gdb_obstack.h"`
`#include "bfd.h"`
`#include "symtab.h"`
`#include "gdbtypes.h"`
`#include "expression.h"`
`#include "value.h"`
`#include "gdbcore.h"`
`#include "target.h"`
`#include "language.h"`
`#include "demangle.h"`
`#include "c-lang.h"`
`#include "typeprint.h"`
`#include "cp-abi.h"`
`#include "cp-support.h"`

Go to the source code of this file.

## Macros
#define | OFFSET_SPC_LEN 23

## Enumerations
enum | access_specifier { s_none, s_public, s_private, s_protected }

## Functions
static void | c_type_print_varspec_prefix (struct type *, struct ui_file *, int, int, int, const struct type_print_options *, struct print_offset_data *)
static void | c_type_print_modifier (struct type *, struct ui_file *, int, int)
static void | c_type_print_base_1 (struct type *type, struct ui_file *stream, int show, int level, 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 | print_name_maybe_canonical (const char *name, const struct type_print_options *flags, struct ui_file *stream)
static void | c_print_type_1 (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags, struct print_offset_data *podata)
void | c_print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags)
void | c_print_typedef (struct type *type, struct symbol *new_symbol, struct ui_file *stream)
static void | cp_type_print_derivation_info (struct ui_file *stream, struct type *type, const struct type_print_options *flags)
static void | cp_type_print_method_args (struct type *mtype, const char *prefix, const char *varstring, int staticp, struct ui_file *stream, const struct type_print_options *flags)
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 int | is_type_conversion_operator (struct type *type, int i, int j)
static char * | remove_qualifiers (char *qid)
void | c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, int show, int passed_a_ptr, int demangled_args, const struct type_print_options *flags)
static void | c_type_print_template_args (const struct type_print_options *flags, struct type *type, struct ui_file *stream)
static void | print_spaces_filtered_with_print_options (int level, struct ui_file *stream, const struct type_print_options *flags)
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_print_type_union_field_offset (struct type *type, unsigned int field_idx, struct ui_file *stream)
static void | c_print_type_struct_field_offset (struct type *type, unsigned int field_idx, struct ui_file *stream, struct print_offset_data *podata)
static bool | need_access_label_p (struct type *type)
static void | c_print_type_no_offsets (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, struct type_print_options *flags, struct print_offset_data *podata)
static void | c_type_print_base_struct_union (struct type *type, struct ui_file *stream, int show, int level, const struct type_print_options *flags, struct print_offset_data *podata)
void | c_type_print_base (struct type *type, struct ui_file *stream, int show, int level, const struct type_print_options *flags)

## Macro Definition Documentation

## ◆ OFFSET_SPC_LEN

#define OFFSET_SPC_LEN 23

Definition at line 41 of file c-typeprint.c.

Referenced by c_type_print_base_struct_union(), and print_spaces_filtered_with_print_options().

## Enumeration Type Documentation

## ◆ access_specifier

enum access_specifier

Enumerator
s_none |
s_public |
s_private |
s_protected |

Definition at line 45 of file c-typeprint.c.

## Function Documentation

## ◆ c_print_type()

void c_print_type | ( | struct type * | type,
|  | const char * | varstring,
|  | struct ui_file * | stream,
|  | int | show,
|  | int | level,
|  | const struct type_print_options * | flags
| ) |  |

Definition at line 164 of file c-typeprint.c.

References c_print_type_1(), and flags.

Referenced by ada_print_type(), c_type_print_args(), c_type_print_template_args(), cp_type_print_method_args(), dwarf2_compute_name(), gnuv3_print_method_ptr(), go_print_type(), opencl_print_type(), rust_print_struct_def(), rust_print_type(), and yyparse().

## ◆ c_print_type_1()

static void c_print_type_1 | ( | struct type * | type,
|  | const char * | varstring,
|  | struct ui_file * | stream,
|  | int | show,
|  | int | level,
|  | const struct type_print_options * | flags,
|  | struct print_offset_data * | podata
| ) |  |
| static

Definition at line 102 of file c-typeprint.c.

References c_type_print_base_1(), c_type_print_varspec_prefix(), c_type_print_varspec_suffix(), check_typedef(), code, find_typedef_in_hash(), flags, fputs_filtered(), TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_FUNC, TYPE_CODE_MEMBERPTR, TYPE_CODE_METHOD, TYPE_CODE_METHODPTR, TYPE_CODE_PTR, TYPE_IS_REFERENCE, TYPE_NAME, and TYPE_VECTOR.

Referenced by c_print_type(), c_print_type_no_offsets(), c_type_print_base_1(), and c_type_print_base_struct_union().

## ◆ c_print_type_no_offsets()

static void c_print_type_no_offsets | ( | struct type * | type,
|  | const char * | varstring,
|  | struct ui_file * | stream,
|  | int | show,
|  | int | level,
|  | struct type_print_options * | flags,
|  | struct print_offset_data * | podata
| ) |  |
| static

Definition at line 1086 of file c-typeprint.c.

References c_print_type_1(), and flags.

Referenced by c_type_print_base_struct_union().

## ◆ c_print_type_struct_field_offset()

static void c_print_type_struct_field_offset | ( | struct type * | type,
|  | unsigned int | field_idx,
|  | struct ui_file * | stream,
|  | struct print_offset_data * | podata
| ) |  |
| static

Definition at line 956 of file c-typeprint.c.

References check_typedef(), print_offset_data::end_bitpos, fprintf_filtered(), print_offset_data::offset_bitpos, TARGET_CHAR_BIT, TYPE_FIELD_BITPOS, TYPE_FIELD_BITSIZE, TYPE_FIELD_PACKED, TYPE_FIELD_TYPE, and TYPE_LENGTH.

Referenced by c_type_print_base_struct_union().

## ◆ c_print_type_union_field_offset()

static void c_print_type_union_field_offset | ( | struct type * | type,
|  | unsigned int | field_idx,
|  | struct ui_file * | stream
| ) |  |
| static

Definition at line 931 of file c-typeprint.c.

References check_typedef(), fprintf_filtered(), TYPE_FIELD_TYPE, and TYPE_LENGTH.

Referenced by c_type_print_base_struct_union().

## ◆ c_print_typedef()

void c_print_typedef | ( | struct type * | type,
|  | struct symbol * | new_symbol,
|  | struct ui_file * | stream
| ) |  |

Definition at line 180 of file c-typeprint.c.

References check_typedef(), fprintf_filtered(), new_symbol(), SYMBOL_LINKAGE_NAME, SYMBOL_PRINT_NAME, SYMBOL_TYPE, TYPE_CODE, TYPE_CODE_TYPEDEF, TYPE_NAME, and type_print().

## ◆ c_type_print_args()

void c_type_print_args | ( | struct type * | type,
|  | struct ui_file * | stream,
|  | int | linkage_name,
|  | enum language language | ,
|  | const struct type_print_options * | flags
| ) |  |

Definition at line 518 of file c-typeprint.c.

References c_print_type(), flags, fprintf_filtered(), language_cplus, make_cv_type(), TYPE_FIELD_ARTIFICIAL, TYPE_FIELD_TYPE, TYPE_NFIELDS, TYPE_PROTOTYPED, TYPE_VARARGS, and wrap_here().

Referenced by c_type_print_varspec_suffix(), and dwarf2_compute_name().

## ◆ c_type_print_base()

void c_type_print_base | ( | struct type * | type,
|  | struct ui_file * | stream,
|  | int | show,
|  | int | level,
|  | const struct type_print_options * | flags
| ) |  |

Definition at line 1774 of file c-typeprint.c.

References c_type_print_base_1(), and flags.

Referenced by cp_print_class_member().

## ◆ c_type_print_base_1()

static void c_type_print_base_1 | ( | struct type * | type,
|  | struct ui_file * | stream,
|  | int | show,
|  | int | level,
|  | const struct type_print_options * | flags,
|  | struct print_offset_data * | podata
| ) |  |
| static

Definition at line 1544 of file c-typeprint.c.

References _, c_print_type_1(), c_type_print_base_struct_union(), c_type_print_modifier(), check_typedef(), current_language, flags, fprintf_filtered(), fprintfi_filtered(), fputs_filtered(), gdb_assert, language_defn::la_language, language_cplus, type_print_options::local_typedefs, plongest(), print_name_maybe_canonical(), print_spaces_filtered(), QUIT, startswith(), TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_ENUM, TYPE_CODE_ERROR, TYPE_CODE_FLAGS, TYPE_CODE_FUNC, TYPE_CODE_MEMBERPTR, TYPE_CODE_METHOD, TYPE_CODE_METHODPTR, TYPE_CODE_NAMESPACE, TYPE_CODE_PTR, TYPE_CODE_RANGE, TYPE_CODE_REF, TYPE_CODE_RVALUE_REF, TYPE_CODE_STRUCT, TYPE_CODE_TYPEDEF, TYPE_CODE_UNDEF, TYPE_CODE_UNION, TYPE_CODE_VOID, TYPE_DECLARED_CLASS, TYPE_ERROR_NAME, TYPE_FIELD_BITPOS, TYPE_FIELD_BITSIZE, TYPE_FIELD_ENUMVAL, TYPE_FIELD_NAME, TYPE_FIELD_TYPE, TYPE_NAME, TYPE_NFIELDS, type_print_unknown_return_type(), TYPE_STUB, TYPE_TAG_NAME, TYPE_TARGET_TYPE, and wrap_here().

Referenced by c_print_type_1(), c_type_print_base(), and c_type_print_varspec_prefix().

## ◆ c_type_print_base_struct_union()

static void c_type_print_base_struct_union | ( | struct type * | type,
|  | struct ui_file * | stream,
|  | int | show,
|  | int | level,
|  | const struct type_print_options * | flags,
|  | struct print_offset_data * | podata
| ) |  |
| static

Definition at line 1106 of file c-typeprint.c.

References _, add_template_parameters(), c_print_type_1(), c_print_type_no_offsets(), c_print_type_struct_field_offset(), c_print_type_union_field_offset(), c_type_print_modifier(), c_type_print_template_args(), copy_typedef_hash(), cp_type_print_derivation_info(), cp_type_print_method_args(), create_typedef_hash(), do_cleanups(), print_offset_data::end_bitpos, field_is_static(), flags, fprintf_filtered(), fprintfi_filtered(), fputs_filtered(), gdb_assert, gdb_demangle(), gdb_mangle_name(), get_vptr_fieldno(), cleanup_check::is_constructor(), is_constructor_name(), is_destructor_name(), is_type_conversion_operator(), type::length, type_print_options::local_typedefs, make_cleanup(), make_cleanup_free_typedef_hash(), name, need_access_label_p(), null_cleanup(), print_offset_data::offset_bitpos, OFFSET_SPC_LEN, output_access_specifier(), fn_field::physname, print_name_maybe_canonical(), type_print_options::print_nested_type_limit, print_spaces_filtered(), print_spaces_filtered_with_print_options(), QUIT, recursively_update_typedef_hash(), remove_qualifiers(), s_none, startswith(), TARGET_CHAR_BIT, TYPE_CODE, TYPE_CODE_STRUCT, TYPE_CODE_TYPEDEF, TYPE_CODE_UNION, TYPE_DECLARED_CLASS, TYPE_FIELD, TYPE_FIELD_ARTIFICIAL, TYPE_FIELD_BITPOS, TYPE_FIELD_BITSIZE, TYPE_FIELD_NAME, TYPE_FIELD_PACKED, TYPE_FIELD_PRIVATE, TYPE_FIELD_PROTECTED, TYPE_FIELD_TYPE, TYPE_FN_FIELD_ARTIFICIAL, TYPE_FN_FIELD_CONSTRUCTOR, TYPE_FN_FIELD_PHYSNAME, TYPE_FN_FIELD_PRIVATE, TYPE_FN_FIELD_PROTECTED, TYPE_FN_FIELD_STATIC_P, TYPE_FN_FIELD_STUB, TYPE_FN_FIELD_TYPE, TYPE_FN_FIELD_VIRTUAL_P, TYPE_FN_FIELDLIST1, TYPE_FN_FIELDLIST_LENGTH, TYPE_FN_FIELDLIST_NAME, TYPE_LENGTH, TYPE_N_BASECLASSES, type_name_no_tag(), TYPE_NESTED_TYPES_COUNT, TYPE_NESTED_TYPES_FIELD_TYPE, TYPE_NFIELDS, TYPE_NFN_FIELDS, TYPE_STUB, TYPE_TAG_NAME, TYPE_TARGET_TYPE, TYPE_TYPEDEF_FIELD_COUNT, TYPE_TYPEDEF_FIELD_NAME, TYPE_TYPEDEF_FIELD_PRIVATE, TYPE_TYPEDEF_FIELD_PROTECTED, TYPE_TYPEDEF_FIELD_TYPE, xfree(), and xmalloc().

Referenced by c_type_print_base_1().

## ◆ c_type_print_modifier()

static void c_type_print_modifier | ( | struct type * | type,
|  | struct ui_file * | stream,
|  | int | need_pre_space,
|  | int | need_post_space
| ) |  |
| static

Definition at line 452 of file c-typeprint.c.

References address_space_int_to_name(), fprintf_filtered(), get_type_arch(), TYPE_ATOMIC, TYPE_CONST, TYPE_INSTANCE_FLAGS, TYPE_IS_REFERENCE, TYPE_RESTRICT, and TYPE_VOLATILE.

Referenced by c_type_print_base_1(), c_type_print_base_struct_union(), and c_type_print_varspec_prefix().

## ◆ c_type_print_template_args()

static void c_type_print_template_args | ( | const struct type_print_options * | flags,
|  | struct type * | type,
|  | struct ui_file * | stream
| ) |  |
| static

Definition at line 834 of file c-typeprint.c.

References _, c_print_type(), flags, fprintf_filtered(), fputs_filtered(), LOC_TYPEDEF, SYMBOL_CLASS, SYMBOL_LINKAGE_NAME, SYMBOL_TYPE, TYPE_N_TEMPLATE_ARGUMENTS, TYPE_TEMPLATE_ARGUMENT, and wrap_here().

Referenced by c_type_print_base_struct_union().

## ◆ c_type_print_varspec_prefix()

static void c_type_print_varspec_prefix | ( | struct type * | type,
|  | struct ui_file * | stream,
|  | int | show,
|  | int | passed_a_ptr,
|  | int | need_post_space,
|  | const struct type_print_options * | flags,
|  | struct print_offset_data * | podata
| ) |  |
| static

Definition at line 338 of file c-typeprint.c.

References _, c_type_print_base_1(), c_type_print_modifier(), error(), flags, fprintf_filtered(), name, print_name_maybe_canonical(), QUIT, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_BOOL, TYPE_CODE_CHAR, TYPE_CODE_COMPLEX, TYPE_CODE_DECFLOAT, TYPE_CODE_ENUM, TYPE_CODE_ERROR, TYPE_CODE_FLAGS, TYPE_CODE_FLT, TYPE_CODE_FUNC, TYPE_CODE_INT, TYPE_CODE_MEMBERPTR, TYPE_CODE_METHOD, TYPE_CODE_METHODPTR, TYPE_CODE_NAMESPACE, TYPE_CODE_PTR, TYPE_CODE_RANGE, TYPE_CODE_REF, TYPE_CODE_RVALUE_REF, TYPE_CODE_SET, TYPE_CODE_STRING, TYPE_CODE_STRUCT, TYPE_CODE_TYPEDEF, TYPE_CODE_UNDEF, TYPE_CODE_UNION, TYPE_CODE_VOID, TYPE_NAME, type_name_no_tag(), TYPE_SELF_TYPE, and TYPE_TARGET_TYPE.

Referenced by c_print_type_1().

## ◆ c_type_print_varspec_suffix()

void c_type_print_varspec_suffix | ( | struct type * | type,
|  | struct ui_file * | stream,
|  | int | show,
|  | int | passed_a_ptr,
|  | int | demangled_args,
|  | const struct type_print_options * | flags
| ) |  |

Definition at line 719 of file c-typeprint.c.

References _, c_type_print_args(), c_type_print_varspec_suffix(), current_language, error(), flags, fprintf_filtered(), get_array_bounds(), language_defn::la_language, plongest(), PROP_LOCEXPR, PROP_LOCLIST, QUIT, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_BOOL, TYPE_CODE_CHAR, TYPE_CODE_COMPLEX, TYPE_CODE_DECFLOAT, TYPE_CODE_ENUM, TYPE_CODE_ERROR, TYPE_CODE_FLAGS, TYPE_CODE_FLT, TYPE_CODE_FUNC, TYPE_CODE_INT, TYPE_CODE_MEMBERPTR, TYPE_CODE_METHOD, TYPE_CODE_METHODPTR, TYPE_CODE_NAMESPACE, TYPE_CODE_PTR, TYPE_CODE_RANGE, TYPE_CODE_REF, TYPE_CODE_RVALUE_REF, TYPE_CODE_SET, TYPE_CODE_STRING, TYPE_CODE_STRUCT, TYPE_CODE_TYPEDEF, TYPE_CODE_UNDEF, TYPE_CODE_UNION, TYPE_CODE_VOID, TYPE_HIGH_BOUND_KIND, TYPE_INDEX_TYPE, TYPE_NAME, TYPE_TARGET_TYPE, and TYPE_VECTOR.

Referenced by c_print_type_1(), and c_type_print_varspec_suffix().

## ◆ cp_type_print_derivation_info()

static void cp_type_print_derivation_info | ( | struct ui_file * | stream,
|  | struct type * | type,
|  | const struct type_print_options * | flags
| ) |  |
| static

Definition at line 221 of file c-typeprint.c.

References BASETYPE_VIA_PUBLIC, BASETYPE_VIA_VIRTUAL, flags, fprintf_filtered(), fputs_filtered(), name, print_name_maybe_canonical(), TYPE_BASECLASS, TYPE_FIELD_PROTECTED, TYPE_N_BASECLASSES, type_name_no_tag(), and wrap_here().

Referenced by c_type_print_base_struct_union().

## ◆ cp_type_print_method_args()

static void cp_type_print_method_args | ( | struct type * | mtype,
|  | const char * | prefix,
|  | const char * | varstring,
|  | int | staticp,
|  | struct ui_file * | stream,
|  | const struct type_print_options * | flags
| ) |  |
| static

Definition at line 252 of file c-typeprint.c.

References c_print_type(), current_language, FIELD_ARTIFICIAL, flags, fprintf_filtered(), fprintf_symbol_filtered(), fputs_filtered(), gdb_assert, language_defn::la_language, language_cplus, field::type, TYPE_ATOMIC, TYPE_CODE, TYPE_CODE_PTR, TYPE_CONST, TYPE_FIELDS, TYPE_NFIELDS, TYPE_RESTRICT, TYPE_TARGET_TYPE, TYPE_VARARGS, TYPE_VOLATILE, and wrap_here().

Referenced by c_type_print_base_struct_union().

## ◆ find_typedef_for_canonicalize()

static const char* find_typedef_for_canonicalize | ( | struct type * | t,
|  | void * | data
| ) |  |
| static

Definition at line 74 of file c-typeprint.c.

References find_typedef_in_hash().

Referenced by print_name_maybe_canonical().

## ◆ is_type_conversion_operator()

static int is_type_conversion_operator | ( | struct type * | type,
|  | int | i,
|  | int | j
| ) |  |
| static

Definition at line 583 of file c-typeprint.c.

References CP_OPERATOR_STR, name, startswith(), and TYPE_FN_FIELDLIST_NAME.

Referenced by c_type_print_base_struct_union().

## ◆ need_access_label_p()

static bool need_access_label_p | ( | struct type * | type | ) |
| static

Definition at line 1034 of file c-typeprint.c.

References QUIT, TYPE_DECLARED_CLASS, TYPE_FIELD_PRIVATE, TYPE_FIELD_PROTECTED, TYPE_FN_FIELD_PRIVATE, TYPE_FN_FIELD_PROTECTED, TYPE_FN_FIELDLIST1, TYPE_FN_FIELDLIST_LENGTH, TYPE_N_BASECLASSES, TYPE_NFIELDS, TYPE_NFN_FIELDS, TYPE_TYPEDEF_FIELD_COUNT, TYPE_TYPEDEF_FIELD_PRIVATE, and TYPE_TYPEDEF_FIELD_PROTECTED.

Referenced by c_type_print_base_struct_union().

## ◆ output_access_specifier()

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

Definition at line 888 of file c-typeprint.c.

References flags, fprintf_filtered(), print_spaces_filtered_with_print_options(), s_private, s_protected, and s_public.

Referenced by c_type_print_base_struct_union().

## ◆ print_name_maybe_canonical()

static void print_name_maybe_canonical | ( | const char * | name,
|  | const struct type_print_options * | flags,
|  | struct ui_file * | stream
| ) |  |
| static

Definition at line 83 of file c-typeprint.c.

References cp_canonicalize_string_full(), find_typedef_for_canonicalize(), flags, fputs_filtered(), name, and string.

Referenced by c_type_print_base_1(), c_type_print_base_struct_union(), c_type_print_varspec_prefix(), and cp_type_print_derivation_info().

## ◆ print_spaces_filtered_with_print_options()

static void print_spaces_filtered_with_print_options | ( | int | level,
|  | struct ui_file * | stream,
|  | const struct type_print_options * | flags
| ) |  |
| static

Definition at line 876 of file c-typeprint.c.

References flags, OFFSET_SPC_LEN, and print_spaces_filtered().

Referenced by c_type_print_base_struct_union(), and output_access_specifier().

## ◆ remove_qualifiers()

static char* remove_qualifiers | ( | char * | qid | ) |
| static

Definition at line 640 of file c-typeprint.c.

References scan().

Referenced by c_type_print_base_struct_union().