GDB (xrefs)

Classes | Functions | Variables
/tmp/gdb-8.1/gdb/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 "command.h"`
`#include "gdbcmd.h"`
`#include "target.h"`
`#include "language.h"`
`#include "cp-abi.h"`
`#include "typeprint.h"`
`#include "valprint.h"`
`#include <ctype.h>`
`#include "cli/cli-utils.h"`
`#include "extension.h"`
`#include "completer.h"`

Go to the source code of this file.

## Classes
struct | typedef_hash_table

## Functions
static hashval_t | hash_typedef_field (const void *p)
static int | eq_typedef_field (const void *a, const void *b)
void | recursively_update_typedef_hash (struct typedef_hash_table *table, struct type *t)
void | add_template_parameters (struct typedef_hash_table *table, struct type *t)
struct typedef_hash_table * | create_typedef_hash (void)
void | free_typedef_hash (struct typedef_hash_table *table)
static void | do_free_typedef_hash (void *arg)
struct cleanup * | make_cleanup_free_typedef_hash (struct typedef_hash_table *table)
static int | copy_typedef_hash_element (void **slot, void *nt)
struct typedef_hash_table * | copy_typedef_hash (struct typedef_hash_table *table)
static void | do_free_global_table (void *arg)
static struct cleanup * | create_global_typedef_table (struct type_print_options *flags)
static const char * | find_global_typedef (const struct type_print_options *flags, struct type *t)
const char * | find_typedef_in_hash (const struct type_print_options *flags, struct type *t)
void | typedef_print (struct type *type, struct symbol *newobj, struct ui_file *stream)
void | default_print_typedef (struct type *type, struct symbol *new_symbol, struct ui_file *stream)
void | type_print (struct type *type, const char *varstring, struct ui_file *stream, int show)
std::string | type_to_string (struct type *type)
void | type_print_unknown_return_type (struct ui_file *stream)
void | error_unknown_type (const char *sym_print_name)
static void | whatis_exp (const char *exp, int show)
static void | whatis_command (const char *exp, int from_tty)
static void | ptype_command (const char *type_name, int from_tty)
void | print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
void | maintenance_print_type (const char *type_name, int from_tty)
static void | set_print_type (const char *arg, int from_tty)
static void | show_print_type (const char *args, int from_tty)
static void | set_print_type_methods (const char *args, int from_tty, struct cmd_list_element *c)
static void | show_print_type_methods (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void | set_print_type_typedefs (const char *args, int from_tty, struct cmd_list_element *c)
static void | show_print_type_typedefs (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void | set_print_type_nested_types (const char *args, int from_tty, struct cmd_list_element *c)
static void | show_print_type_nested_types (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
void | _initialize_typeprint (void)
void | val_print_not_allocated (struct ui_file *stream)
void | val_print_not_associated (struct ui_file *stream)

## Variables
const struct type_print_options | type_print_raw_options
static struct type_print_options | default_ptype_flags
struct cmd_list_element * | setprinttypelist
struct cmd_list_element * | showprinttypelist
static int | print_methods = 1
static int | print_typedefs = 1
static int | print_nested_type_limit = 0

## Function Documentation

## ◆ _initialize_typeprint()

void _initialize_typeprint | ( | void |  | ) |

Definition at line 769 of file typeprint.c.

References _, add_com(), add_prefix_cmd(), add_setshow_boolean_cmd(), add_setshow_zuinteger_unlimited_cmd(), class_vars, expression_completer(), no_class, print_methods, print_nested_type_limit, print_typedefs, ptype_command(), set_cmd_completer(), set_print_type(), set_print_type_methods(), set_print_type_nested_types(), set_print_type_typedefs(), setprintlist, setprinttypelist, show_print_type(), show_print_type_methods(), show_print_type_nested_types(), show_print_type_typedefs(), showprintlist, showprinttypelist, and whatis_command().

## ◆ add_template_parameters()

void add_template_parameters | ( | struct typedef_hash_table * | table,
|  | struct type * | t
| ) |  |

Definition at line 135 of file typeprint.c.

References LOC_TYPEDEF, decl_field::name, typedef_hash_table::storage, SYMBOL_CLASS, SYMBOL_LINKAGE_NAME, SYMBOL_TYPE, typedef_hash_table::table, decl_field::type, TYPE_N_TEMPLATE_ARGUMENTS, and TYPE_TEMPLATE_ARGUMENT.

Referenced by c_type_print_base_struct_union().

## ◆ copy_typedef_hash()

struct typedef_hash_table* copy_typedef_hash | ( | struct typedef_hash_table * | table | ) |

Definition at line 223 of file typeprint.c.

References copy_typedef_hash_element(), create_typedef_hash(), and typedef_hash_table::table.

Referenced by c_type_print_base_struct_union().

## ◆ copy_typedef_hash_element()

static int copy_typedef_hash_element | ( | void ** | slot,
|  | void * | nt
| ) |  |
| static

Definition at line 208 of file typeprint.c.

Referenced by copy_typedef_hash().

## ◆ create_global_typedef_table()

static struct cleanup* create_global_typedef_table | ( | struct type_print_options * | flags | ) |
| static

Definition at line 250 of file typeprint.c.

References create_typedef_hash(), do_free_global_table(), flags, gdb_assert, make_cleanup(), and start_ext_lang_type_printers().

Referenced by whatis_exp().

## ◆ create_typedef_hash()

struct typedef_hash_table* create_typedef_hash | ( | void |  | ) |

Definition at line 164 of file typeprint.c.

References eq_typedef_field(), hash_typedef_field(), typedef_hash_table::storage, typedef_hash_table::table, xcalloc(), xfree(), and XNEW.

Referenced by c_type_print_base_struct_union(), copy_typedef_hash(), and create_global_typedef_table().

## ◆ default_print_typedef()

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

Definition at line 344 of file typeprint.c.

References _, and error().

## ◆ do_free_global_table()

static void do_free_global_table | ( | void * | arg | ) |
| static

Definition at line 239 of file typeprint.c.

References flags, free_ext_lang_type_printers(), and free_typedef_hash().

Referenced by create_global_typedef_table().

## ◆ do_free_typedef_hash()

static void do_free_typedef_hash | ( | void * | arg | ) |
| static

Definition at line 192 of file typeprint.c.

References free_typedef_hash().

Referenced by make_cleanup_free_typedef_hash().

## ◆ eq_typedef_field()

static int eq_typedef_field | ( | const void * | a,
|  | const void * | b
| ) |  |
| static

Definition at line 95 of file typeprint.c.

References decl_field::type, and types_equal().

Referenced by create_typedef_hash().

## ◆ error_unknown_type()

void error_unknown_type | ( | const char * | sym_print_name | ) |

Definition at line 396 of file typeprint.c.

References _, and error().

Referenced by evaluate_subexp_for_sizeof(), evaluate_subexp_standard(), and gen_expr().

## ◆ find_global_typedef()

static const char* find_global_typedef | ( | const struct type_print_options * | flags,
|  | struct type * | t
| ) |  |
| static

Definition at line 264 of file typeprint.c.

References apply_ext_lang_type_printers(), flags, decl_field::name, decl_field::type, and xfree().

Referenced by find_typedef_in_hash().

## ◆ find_typedef_in_hash()

const char* find_typedef_in_hash | ( | const struct type_print_options * | flags,
|  | struct type * | t
| ) |  |

Definition at line 311 of file typeprint.c.

References find_global_typedef(), flags, decl_field::name, and decl_field::type.

Referenced by c_print_type_1(), and find_typedef_for_canonicalize().

## ◆ free_typedef_hash()

void free_typedef_hash | ( | struct typedef_hash_table * | table | ) |

Definition at line 179 of file typeprint.c.

References typedef_hash_table::table, and xfree().

Referenced by do_free_global_table(), and do_free_typedef_hash().

## ◆ hash_typedef_field()

static hashval_t hash_typedef_field | ( | const void * | p | ) |
| static

Definition at line 84 of file typeprint.c.

References check_typedef(), decl_field::type, and TYPE_SAFE_NAME.

Referenced by create_typedef_hash().

## ◆ maintenance_print_type()

void maintenance_print_type | ( | const char * | type_name,
|  | int | from_tty
| ) |  |

Definition at line 653 of file typeprint.c.

References evaluate_type(), parse_expression(), recursive_dump_type(), type, and value_type().

Referenced by _initialize_maint_cmds().

## ◆ make_cleanup_free_typedef_hash()

struct cleanup* make_cleanup_free_typedef_hash | ( | struct typedef_hash_table * | table | ) |

Definition at line 200 of file typeprint.c.

References do_free_typedef_hash(), and make_cleanup().

Referenced by c_type_print_base_struct_union().

## ◆ print_type_scalar()

void print_type_scalar | ( | struct type * | type,
|  | LONGEST | val,
|  | struct ui_file * | stream
| ) |  |

Definition at line 577 of file typeprint.c.

References _, check_typedef(), error(), fprintf_filtered(), fputs_filtered(), gdb_flush(), LA_PRINT_CHAR, print_longest(), print_type_scalar(), TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_BOOL, TYPE_CODE_CHAR, TYPE_CODE_ENUM, TYPE_CODE_ERROR, 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_UNDEF, TYPE_CODE_UNION, TYPE_CODE_VOID, TYPE_FIELD_ENUMVAL, TYPE_FIELD_NAME, TYPE_NFIELDS, TYPE_TARGET_TYPE, and TYPE_UNSIGNED.

Referenced by m2_print_bounds(), m2_print_long_set(), m2_range(), m2_val_print(), pascal_type_print_base(), pascal_val_print(), and print_type_scalar().

## ◆ ptype_command()

static void ptype_command | ( | const char * | type_name,
|  | int | from_tty
| ) |  |
| static

Definition at line 559 of file typeprint.c.

References whatis_exp().

Referenced by _initialize_typeprint().

## ◆ recursively_update_typedef_hash()

void recursively_update_typedef_hash | ( | struct typedef_hash_table * | table,
|  | struct type * | t
| ) |  |

Definition at line 106 of file typeprint.c.

References recursively_update_typedef_hash(), typedef_hash_table::table, TYPE_BASECLASS, TYPE_N_BASECLASSES, TYPE_TYPEDEF_FIELD, and TYPE_TYPEDEF_FIELD_COUNT.

Referenced by c_type_print_base_struct_union(), and recursively_update_typedef_hash().

## ◆ set_print_type()

static void set_print_type | ( | const char * | arg,
|  | int | from_tty
| ) |  |
| static

Definition at line 686 of file typeprint.c.

References all_commands, gdb_stdout, help_list(), printf_unfiltered(), and setprintlist.

Referenced by _initialize_typeprint().

## ◆ set_print_type_methods()

static void set_print_type_methods | ( | const char * | args,
|  | int | from_tty,
|  | struct cmd_list_element * | c
| ) |  |
| static

Definition at line 702 of file typeprint.c.

References default_ptype_flags, type_print_options::print_methods, and print_methods.

Referenced by _initialize_typeprint().

## ◆ set_print_type_nested_types()

static void set_print_type_nested_types | ( | const char * | args,
|  | int | from_tty,
|  | struct cmd_list_element * | c
| ) |  |
| static

Definition at line 743 of file typeprint.c.

References default_ptype_flags, type_print_options::print_nested_type_limit, and print_nested_type_limit.

Referenced by _initialize_typeprint().

## ◆ set_print_type_typedefs()

static void set_print_type_typedefs | ( | const char * | args,
|  | int | from_tty,
|  | struct cmd_list_element * | c
| ) |  |
| static

Definition at line 719 of file typeprint.c.

References default_ptype_flags, type_print_options::print_typedefs, and print_typedefs.

Referenced by _initialize_typeprint().

## ◆ show_print_type()

static void show_print_type | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 694 of file typeprint.c.

References cmd_show_list(), and showprinttypelist.

Referenced by _initialize_typeprint().

## ◆ show_print_type_methods()

static void show_print_type_methods | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 709 of file typeprint.c.

References _, and fprintf_filtered().

Referenced by _initialize_typeprint().

## ◆ show_print_type_nested_types()

static void show_print_type_nested_types | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 752 of file typeprint.c.

References _, and fprintf_filtered().

Referenced by _initialize_typeprint().

## ◆ show_print_type_typedefs()

static void show_print_type_typedefs | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 726 of file typeprint.c.

References _, and fprintf_filtered().

Referenced by _initialize_typeprint().

## ◆ type_print()

void type_print | ( | struct type * | type,
|  | const char * | varstring,
|  | struct ui_file * | stream,
|  | int | show
| ) |  |

Definition at line 358 of file typeprint.c.

References default_ptype_flags, and LA_PRINT_TYPE.

Referenced by ada_dump_subexp_body(), ada_print_subexp(), ada_val_print_num(), ada_value_print(), c_print_typedef(), c_value_print(), disassemble_dwarf_expression(), dump_subexp_body_standard(), generic_val_print_func(), inspect_type(), list_arg_or_local(), m2_print_typedef(), pascal_print_typedef(), pascal_type_print_base(), pascal_value_print(), print_subexp_standard(), print_symbol_info(), print_variable_or_computed(), py_print_type(), rust_dump_subexp_body(), rust_print_subexp(), rust_print_typedef(), type_as_string(), type_to_string(), and whatis_exp().

## ◆ type_print_unknown_return_type()

void type_print_unknown_return_type | ( | struct ui_file * | stream | ) |

Definition at line 388 of file typeprint.c.

References _, and fprintf_filtered().

Referenced by c_type_print_base_1(), f_type_print_base(), m2_procedure(), and pascal_type_print_func_varspec_suffix().

## ◆ type_to_string()

std::string type_to_string | ( | struct type * | type | ) |

Definition at line 368 of file typeprint.c.

References CATCH, END_CATCH, RETURN_MASK_ALL, string_file::string(), TRY, and type_print().

Referenced by c_get_string(), c_watch_location_expression(), convert_ast_to_type(), convert_name(), gnuv3_get_typeid(), lookup_struct_elt_type(), print_return_value_1(), rust_watch_location_expression(), update_type_if_necessary(), and varobj_get_type().

## ◆ typedef_print()

void typedef_print | ( | struct type * | type,
|  | struct symbol * | newobj,
|  | struct ui_file * | stream
| ) |  |

Definition at line 336 of file typeprint.c.

References LA_PRINT_TYPEDEF.

Referenced by print_symbol_info().

## ◆ val_print_not_allocated()

void val_print_not_allocated | ( | struct ui_file * | stream | ) |

Definition at line 832 of file typeprint.c.

References _, and fprintf_filtered().

Referenced by f_print_type(), f_type_print_varspec_suffix(), valprint_check_validity(), and value_check_printable().

## ◆ val_print_not_associated()

void val_print_not_associated | ( | struct ui_file * | stream | ) |

Definition at line 840 of file typeprint.c.

References _, and fprintf_filtered().

Referenced by f_print_type(), f_type_print_varspec_suffix(), valprint_check_validity(), and value_check_printable().

## ◆ whatis_command()

static void whatis_command | ( | const char * | exp,
|  | int | from_tty
| ) |  |
| static

Definition at line 548 of file typeprint.c.

References whatis_exp().

Referenced by _initialize_typeprint().

## ◆ whatis_exp()

static void whatis_exp | ( | const char * | exp,
|  | int | show
| ) |  |
| static

Definition at line 406 of file typeprint.c.

References _, access_value_history(), check_typedef(), create_global_typedef_table(), current_language, default_ptype_flags, do_cleanups(), error(), evaluate_type(), flags, fprintf_filtered(), gdb_stdout, get_user_print_options(), language_defn::la_language, LA_PRINT_TYPE, language_c, language_cplus, make_cleanup(), null_cleanup(), value_print_options::objectprint, parse_expression(), printf_filtered(), skip_spaces(), type, TYPE_CODE, TYPE_CODE_PTR, TYPE_CODE_STRUCT, TYPE_CODE_TYPEDEF, TYPE_CODE_UNION, TYPE_IS_REFERENCE, type_print(), TYPE_TARGET_TYPE, value_rtti_indirect_type(), value_rtti_type(), and value_type().

Referenced by ptype_command(), and whatis_command().

## Variable Documentation

## ◆ default_ptype_flags

struct type_print_options default_ptype_flags
| static

Initial value:
=
{
0,
1,
1,
0,
0,
NULL,
NULL,
NULL
}

Definition at line 54 of file typeprint.c.

Referenced by set_print_type_methods(), set_print_type_nested_types(), set_print_type_typedefs(), type_print(), and whatis_exp().

## ◆ print_methods

int print_methods = 1
| static

Definition at line 699 of file typeprint.c.

Referenced by _initialize_typeprint(), and set_print_type_methods().

## ◆ print_nested_type_limit

int print_nested_type_limit = 0
| static

Definition at line 737 of file typeprint.c.

Referenced by _initialize_typeprint(), and set_print_type_nested_types().

## ◆ print_typedefs

int print_typedefs = 1
| static

Definition at line 716 of file typeprint.c.

Referenced by _initialize_typeprint(), and set_print_type_typedefs().

## ◆ setprinttypelist

struct cmd_list_element* setprinttypelist

Definition at line 681 of file typeprint.c.

Referenced by _initialize_typeprint().

## ◆ showprinttypelist

struct cmd_list_element* showprinttypelist

Definition at line 683 of file typeprint.c.

Referenced by _initialize_typeprint(), and show_print_type().

## ◆ type_print_raw_options

const struct type_print_options type_print_raw_options

Initial value:
=
{
1,
1,
1,
0,
0,
NULL,
NULL,
NULL
}

Definition at line 40 of file typeprint.c.

Referenced by ada_print_subexp(), ada_print_typedef(), cp_print_class_member(), dwarf2_compute_name(), gnuv3_print_method_ptr(), print_symbol(), typy_str(), tyscm_type_name(), user_select_syms(), and yyparse().