From 987012b89bce7f6385ed88585547f852a8005a3f Mon Sep 17 00:00:00 2001 From: Christian Biesinger Date: Fri, 22 Nov 2019 12:05:14 -0600 Subject: [PATCH] Replace SYMBOL_*_NAME accessors with member functions Similar to the MSYMBOL version of this patch, improves readability and will eventually allow making name private. gdb/ChangeLog: 2019-11-22 Christian Biesinger * ada-exp.y: Update. * ada-lang.c (sort_choices): Update. (ada_print_symbol_signature): Update. (resolve_subexp): Update. (ada_parse_renaming): Update. (ada_read_renaming_var_value): Update. (lesseq_defined_than): Update. (remove_extra_symbols): Update. (remove_irrelevant_renamings): Update. (ada_add_block_symbols): Update. (ada_collect_symbol_completion_matches): Update. (ada_is_renaming_symbol): Update. (aggregate_assign_from_choices): Update. (ada_evaluate_subexp): Update. (ada_has_this_exception_support): Update. (ada_is_non_standard_exception_sym): Update. (ada_add_exceptions_from_frame): Update. (ada_add_global_exceptions): Update. (ada_print_subexp): Update. * ax-gdb.c (gen_var_ref): Update. (gen_maybe_namespace_elt): Update. (gen_expr_for_cast): Update. (gen_expr): Update. * block.h: Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (print_breakpoint_location): Update. (update_static_tracepoint): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * buildsym.c (find_symbol_in_list): Update. * c-exp.y: Update. * c-typeprint.c (c_print_typedef): Update. (c_type_print_template_args): Update. * cli/cli-cmds.c (edit_command): Update. (list_command): Update. (print_sal_location): Update. * coffread.c (patch_opaque_types): Update. (process_coff_symbol): Update. (coff_read_enum_type): Update. * compile/compile-c-symbols.c (c_symbol_substitution_name): Update. (convert_one_symbol): Update. (hash_symname): Update. (eq_symname): Update. * compile/compile-cplus-symbols.c (convert_one_symbol): Update. * compile/compile-cplus-types.c (debug_print_scope): Update. * compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update. * compile/compile-object-load.c (get_out_value_type): Update. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Update. (search_symbol_list): Update. (cp_lookup_symbol_imports_or_template): Update. * cp-support.c (overload_list_add_symbol): Update. * ctfread.c (psymtab_to_symtab): Update. * dbxread.c (cp_set_block_scope): Update. * dictionary.c (iter_match_first_hashed): Update. (iter_match_next_hashed): Update. (insert_symbol_hashed): Update. (iter_match_next_linear): Update. * dictionary.h: Update. * dwarf2loc.c (func_get_frame_base_dwarf_block): Update. (locexpr_describe_location_piece): Update. (locexpr_describe_location_1): Update. (locexpr_generate_c_location): Update. (loclist_describe_location): Update. (loclist_generate_c_location): Update. * dwarf2read.c (dw2_debug_names_lookup_symbol): Update. (read_func_scope): Update. (process_enumeration_scope): Update. (new_symbol): Update. (dwarf2_const_value): Update. (dwarf2_symbol_mark_computed): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * f-valprint.c (info_common_command_for_block): Update. * findvar.c (get_hosting_frame): Update. (default_read_var_value): Update. * go-lang.c (go_symbol_package_name): Update. * guile/scm-block.c (bkscm_print_block_smob): Update. * guile/scm-symbol.c (syscm_print_symbol_smob): Update. (gdbscm_symbol_name): Update. (gdbscm_symbol_linkage_name): Update. (gdbscm_symbol_print_name): Update. * infcall.c (get_function_name): Update. * infcmd.c (jump_command): Update. (finish_command): Update. * infrun.c (insert_exception_resume_breakpoint): Update. * linespec.c (canonicalize_linespec): Update. (create_sals_line_offset): Update. (convert_linespec_to_sals): Update. (complete_label): Update. (find_label_symbols_in_block): Update. * m2-typeprint.c (m2_print_typedef): Update. * mdebugread.c (mdebug_reg_to_regnum): Update. (parse_symbol): Update. (mylookup_symbol): Update. * mi/mi-cmd-stack.c (list_arg_or_local): Update. (list_args_or_locals): Update. * objc-lang.c (compare_selectors): Update. (info_selectors_command): Update. (compare_classes): Update. (info_classes_command): Update. (find_imps): Update. * p-typeprint.c (pascal_print_typedef): Update. * printcmd.c (build_address_symbolic): Update. (info_address_command): Update. (print_variable_and_value): Update. * python/py-framefilter.c (extract_sym): Update. (py_print_single_arg): Update. * python/py-symbol.c (sympy_str): Update. (sympy_get_name): Update. (sympy_get_linkage_name): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rust-lang.c (rust_print_typedef): Update. * solib-frv.c (frv_fdpic_find_canonical_descriptor): Update. * stabsread.c (stab_reg_to_regnum): Update. (define_symbol): Update. (read_enum_type): Update. (common_block_end): Update. (cleanup_undefined_types_1): Update. (scan_file_globals): Update. * stack.c (print_frame_arg): Update. (print_frame_args): Update. (find_frame_funname): Update. (info_frame_command_core): Update. (iterate_over_block_locals): Update. (print_block_frame_labels): Update. (do_print_variable_and_value): Update. (iterate_over_block_arg_vars): Update. (return_command): Update. * symmisc.c (dump_symtab_1): Update. (print_symbol): Update. * symtab.c (eq_symbol_entry): Update. (symbol_cache_dump): Update. (lookup_language_this): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (symbol_search::compare_search_syms): Update. (treg_matches_sym_type_name): Update. (search_symbols): Update. (print_symbol_info): Update. (rbreak_command): Update. (completion_list_add_symbol): Update. (find_gnu_ifunc): Update. (get_symbol_address): Update. (search_module_symbols): Update. (info_module_subcommand): Update. * symtab.h (SYMBOL_NATURAL_NAME): Remove. (SYMBOL_LINKAGE_NAME): Remove. (SYMBOL_DEMANGLED_NAME): Remove. (SYMBOL_PRINT_NAME): Remove. (SYMBOL_SEARCH_NAME): Remove. * tracepoint.c (set_traceframe_context): Update. (validate_actionline): Update. (collection_list::collect_symbol): Update. (encode_actions_1): Update. (info_scope_command): Update. (print_one_static_tracepoint_marker): Update. * typeprint.c (typedef_hash_table::add_template_parameters): Update. * valops.c (address_of_variable): Update. (find_overload_match): Update. (find_oload_champ): Update. Change-Id: I76bdc8b44eea6876bf03af9d351f8e90cc0154b2 --- gdb/ChangeLog | 167 ++++++++++++++++++++++++++++ gdb/ada-exp.y | 3 +- gdb/ada-lang.c | 98 ++++++++-------- gdb/ax-gdb.c | 18 +-- gdb/block.h | 4 +- gdb/blockframe.c | 2 +- gdb/breakpoint.c | 4 +- gdb/btrace.c | 4 +- gdb/buildsym.c | 6 +- gdb/c-exp.y | 2 +- gdb/c-typeprint.c | 9 +- gdb/cli/cli-cmds.c | 6 +- gdb/coffread.c | 21 ++-- gdb/compile/compile-c-symbols.c | 26 ++--- gdb/compile/compile-cplus-symbols.c | 22 ++-- gdb/compile/compile-cplus-types.c | 2 +- gdb/compile/compile-loc2c.c | 6 +- gdb/compile/compile-object-load.c | 2 +- gdb/cp-namespace.c | 10 +- gdb/cp-support.c | 5 +- gdb/ctfread.c | 2 +- gdb/dbxread.c | 4 +- gdb/dictionary.c | 8 +- gdb/dictionary.h | 4 +- gdb/dwarf2loc.c | 16 +-- gdb/dwarf2read.c | 16 +-- gdb/eval.c | 6 +- gdb/expprint.c | 12 +- gdb/f-valprint.c | 10 +- gdb/findvar.c | 22 ++-- gdb/go-lang.c | 2 +- gdb/guile/scm-block.c | 2 +- gdb/guile/scm-symbol.c | 8 +- gdb/infcall.c | 2 +- gdb/infcmd.c | 4 +- gdb/infrun.c | 2 +- gdb/linespec.c | 13 +-- gdb/m2-typeprint.c | 4 +- gdb/mdebugread.c | 10 +- gdb/mi/mi-cmd-stack.c | 4 +- gdb/objc-lang.c | 14 +-- gdb/p-typeprint.c | 2 +- gdb/printcmd.c | 10 +- gdb/python/py-framefilter.c | 6 +- gdb/python/py-symbol.c | 6 +- gdb/python/python.c | 2 +- gdb/record-btrace.c | 4 +- gdb/rust-lang.c | 2 +- gdb/solib-frv.c | 2 +- gdb/stabsread.c | 62 +++++------ gdb/stack.c | 31 +++--- gdb/symmisc.c | 14 +-- gdb/symtab.c | 40 ++++--- gdb/symtab.h | 42 +------ gdb/tracepoint.c | 42 +++---- gdb/typeprint.c | 2 +- gdb/valops.c | 8 +- 57 files changed, 481 insertions(+), 376 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f4878447ac3..5dd8d428143 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,170 @@ +2019-11-22 Christian Biesinger + + * ada-exp.y: Update. + * ada-lang.c (sort_choices): Update. + (ada_print_symbol_signature): Update. + (resolve_subexp): Update. + (ada_parse_renaming): Update. + (ada_read_renaming_var_value): Update. + (lesseq_defined_than): Update. + (remove_extra_symbols): Update. + (remove_irrelevant_renamings): Update. + (ada_add_block_symbols): Update. + (ada_collect_symbol_completion_matches): Update. + (ada_is_renaming_symbol): Update. + (aggregate_assign_from_choices): Update. + (ada_evaluate_subexp): Update. + (ada_has_this_exception_support): Update. + (ada_is_non_standard_exception_sym): Update. + (ada_add_exceptions_from_frame): Update. + (ada_add_global_exceptions): Update. + (ada_print_subexp): Update. + * ax-gdb.c (gen_var_ref): Update. + (gen_maybe_namespace_elt): Update. + (gen_expr_for_cast): Update. + (gen_expr): Update. + * block.h: Update. + * blockframe.c (find_pc_partial_function): Update. + * breakpoint.c (print_breakpoint_location): Update. + (update_static_tracepoint): Update. + * btrace.c (ftrace_print_function_name): Update. + (ftrace_function_switched): Update. + * buildsym.c (find_symbol_in_list): Update. + * c-exp.y: Update. + * c-typeprint.c (c_print_typedef): Update. + (c_type_print_template_args): Update. + * cli/cli-cmds.c (edit_command): Update. + (list_command): Update. + (print_sal_location): Update. + * coffread.c (patch_opaque_types): Update. + (process_coff_symbol): Update. + (coff_read_enum_type): Update. + * compile/compile-c-symbols.c (c_symbol_substitution_name): Update. + (convert_one_symbol): Update. + (hash_symname): Update. + (eq_symname): Update. + * compile/compile-cplus-symbols.c (convert_one_symbol): Update. + * compile/compile-cplus-types.c (debug_print_scope): Update. + * compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update. + * compile/compile-object-load.c (get_out_value_type): Update. + * cp-namespace.c (cp_scan_for_anonymous_namespaces): Update. + (search_symbol_list): Update. + (cp_lookup_symbol_imports_or_template): Update. + * cp-support.c (overload_list_add_symbol): Update. + * ctfread.c (psymtab_to_symtab): Update. + * dbxread.c (cp_set_block_scope): Update. + * dictionary.c (iter_match_first_hashed): Update. + (iter_match_next_hashed): Update. + (insert_symbol_hashed): Update. + (iter_match_next_linear): Update. + * dictionary.h: Update. + * dwarf2loc.c (func_get_frame_base_dwarf_block): Update. + (locexpr_describe_location_piece): Update. + (locexpr_describe_location_1): Update. + (locexpr_generate_c_location): Update. + (loclist_describe_location): Update. + (loclist_generate_c_location): Update. + * dwarf2read.c (dw2_debug_names_lookup_symbol): Update. + (read_func_scope): Update. + (process_enumeration_scope): Update. + (new_symbol): Update. + (dwarf2_const_value): Update. + (dwarf2_symbol_mark_computed): Update. + * eval.c (evaluate_funcall): Update. + (evaluate_subexp_standard): Update. + * expprint.c (print_subexp_standard): Update. + (dump_subexp_body_standard): Update. + * f-valprint.c (info_common_command_for_block): Update. + * findvar.c (get_hosting_frame): Update. + (default_read_var_value): Update. + * go-lang.c (go_symbol_package_name): Update. + * guile/scm-block.c (bkscm_print_block_smob): Update. + * guile/scm-symbol.c (syscm_print_symbol_smob): Update. + (gdbscm_symbol_name): Update. + (gdbscm_symbol_linkage_name): Update. + (gdbscm_symbol_print_name): Update. + * infcall.c (get_function_name): Update. + * infcmd.c (jump_command): Update. + (finish_command): Update. + * infrun.c (insert_exception_resume_breakpoint): Update. + * linespec.c (canonicalize_linespec): Update. + (create_sals_line_offset): Update. + (convert_linespec_to_sals): Update. + (complete_label): Update. + (find_label_symbols_in_block): Update. + * m2-typeprint.c (m2_print_typedef): Update. + * mdebugread.c (mdebug_reg_to_regnum): Update. + (parse_symbol): Update. + (mylookup_symbol): Update. + * mi/mi-cmd-stack.c (list_arg_or_local): Update. + (list_args_or_locals): Update. + * objc-lang.c (compare_selectors): Update. + (info_selectors_command): Update. + (compare_classes): Update. + (info_classes_command): Update. + (find_imps): Update. + * p-typeprint.c (pascal_print_typedef): Update. + * printcmd.c (build_address_symbolic): Update. + (info_address_command): Update. + (print_variable_and_value): Update. + * python/py-framefilter.c (extract_sym): Update. + (py_print_single_arg): Update. + * python/py-symbol.c (sympy_str): Update. + (sympy_get_name): Update. + (sympy_get_linkage_name): Update. + * python/python.c (gdbpy_rbreak): Update. + * record-btrace.c (btrace_get_bfun_name): Update. + (btrace_call_history): Update. + * rust-lang.c (rust_print_typedef): Update. + * solib-frv.c (frv_fdpic_find_canonical_descriptor): Update. + * stabsread.c (stab_reg_to_regnum): Update. + (define_symbol): Update. + (read_enum_type): Update. + (common_block_end): Update. + (cleanup_undefined_types_1): Update. + (scan_file_globals): Update. + * stack.c (print_frame_arg): Update. + (print_frame_args): Update. + (find_frame_funname): Update. + (info_frame_command_core): Update. + (iterate_over_block_locals): Update. + (print_block_frame_labels): Update. + (do_print_variable_and_value): Update. + (iterate_over_block_arg_vars): Update. + (return_command): Update. + * symmisc.c (dump_symtab_1): Update. + (print_symbol): Update. + * symtab.c (eq_symbol_entry): Update. + (symbol_cache_dump): Update. + (lookup_language_this): Update. + (find_pc_sect_line): Update. + (skip_prologue_sal): Update. + (symbol_search::compare_search_syms): Update. + (treg_matches_sym_type_name): Update. + (search_symbols): Update. + (print_symbol_info): Update. + (rbreak_command): Update. + (completion_list_add_symbol): Update. + (find_gnu_ifunc): Update. + (get_symbol_address): Update. + (search_module_symbols): Update. + (info_module_subcommand): Update. + * symtab.h (SYMBOL_NATURAL_NAME): Remove. + (SYMBOL_LINKAGE_NAME): Remove. + (SYMBOL_DEMANGLED_NAME): Remove. + (SYMBOL_PRINT_NAME): Remove. + (SYMBOL_SEARCH_NAME): Remove. + * tracepoint.c (set_traceframe_context): Update. + (validate_actionline): Update. + (collection_list::collect_symbol): Update. + (encode_actions_1): Update. + (info_scope_command): Update. + (print_one_static_tracepoint_marker): Update. + * typeprint.c (typedef_hash_table::add_template_parameters): Update. + * valops.c (address_of_variable): Update. + (find_overload_match): Update. + (find_oload_champ): Update. + 2019-11-22 Christian Biesinger * ada-lang.c (ada_lookup_simple_minsym): Update. diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index ff3ce763924..5e9d3e70b92 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -1105,7 +1105,8 @@ write_ambiguous_var (struct parser_state *par_state, struct symbol *sym = new (&temp_parse_space) symbol (); SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN; - SYMBOL_LINKAGE_NAME (sym) = obstack_strndup (&temp_parse_space, name, len); + SYMBOL_SET_LINKAGE_NAME (sym, + obstack_strndup (&temp_parse_space, name, len)); SYMBOL_LANGUAGE (sym) = language_ada; write_exp_elt_opcode (par_state, OP_VAR_VALUE); diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 723ac36659c..7959a5f06e2 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3201,8 +3201,8 @@ sort_choices (struct block_symbol syms[], int nsyms) for (j = i - 1; j >= 0; j -= 1) { - if (encoded_ordered_before (SYMBOL_LINKAGE_NAME (syms[j].symbol), - SYMBOL_LINKAGE_NAME (sym.symbol))) + if (encoded_ordered_before (syms[j].symbol->linkage_name (), + sym.symbol->linkage_name ())) break; syms[j + 1] = syms[j]; } @@ -3225,7 +3225,7 @@ ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym, { struct type *type = SYMBOL_TYPE (sym); - fprintf_filtered (stream, "%s", SYMBOL_PRINT_NAME (sym)); + fprintf_filtered (stream, "%s", sym->print_name ()); if (!print_signatures || type == NULL || TYPE_CODE (type) != TYPE_CODE_FUNC) @@ -3431,7 +3431,7 @@ See set/show multiple-symbol.")); ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL, gdb_stdout, -1, 0, &type_print_raw_options); printf_filtered (_("'(%s) (enumeral)\n"), - SYMBOL_PRINT_NAME (syms[i].symbol)); + syms[i].symbol->print_name ()); } else { @@ -3675,8 +3675,7 @@ resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, int n_candidates; n_candidates = - ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME - (exp->elts[pc + 2].symbol), + ada_lookup_symbol_list (exp->elts[pc + 2].symbol->linkage_name (), exp->elts[pc + 1].block, VAR_DOMAIN, &candidates); @@ -3718,7 +3717,7 @@ resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, if (n_candidates == 0) error (_("No definition found for %s"), - SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol)); + exp->elts[pc + 2].symbol->print_name ()); else if (n_candidates == 1) i = 0; else if (deprocedure_p @@ -3726,16 +3725,16 @@ resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, { i = ada_resolve_function (candidates.data (), n_candidates, NULL, 0, - SYMBOL_LINKAGE_NAME (exp->elts[pc + 2].symbol), + exp->elts[pc + 2].symbol->linkage_name (), context_type, parse_completion); if (i < 0) error (_("Could not find a match for %s"), - SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol)); + exp->elts[pc + 2].symbol->print_name ()); } else { printf_filtered (_("Multiple matches for %s\n"), - SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol)); + exp->elts[pc + 2].symbol->print_name ()); user_select_syms (candidates.data (), n_candidates, 1); i = 0; } @@ -3765,8 +3764,7 @@ resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, int n_candidates; n_candidates = - ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME - (exp->elts[pc + 5].symbol), + ada_lookup_symbol_list (exp->elts[pc + 5].symbol->linkage_name (), exp->elts[pc + 4].block, VAR_DOMAIN, &candidates); @@ -3777,11 +3775,11 @@ resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, i = ada_resolve_function (candidates.data (), n_candidates, argvec, nargs, - SYMBOL_LINKAGE_NAME (exp->elts[pc + 5].symbol), + exp->elts[pc + 5].symbol->linkage_name (), context_type, parse_completion); if (i < 0) error (_("Could not find a match for %s"), - SYMBOL_PRINT_NAME (exp->elts[pc + 5].symbol)); + exp->elts[pc + 5].symbol->print_name ()); } exp->elts[pc + 4].block = candidates[i].block; @@ -4264,7 +4262,7 @@ ada_parse_renaming (struct symbol *sym, case LOC_STATIC: case LOC_COMPUTED: case LOC_OPTIMIZED_OUT: - info = strstr (SYMBOL_LINKAGE_NAME (sym), "___XR"); + info = strstr (sym->linkage_name (), "___XR"); if (info == NULL) return ADA_NOT_RENAMING; switch (info[5]) @@ -4313,7 +4311,7 @@ ada_read_renaming_var_value (struct symbol *renaming_sym, { const char *sym_name; - sym_name = SYMBOL_LINKAGE_NAME (renaming_sym); + sym_name = renaming_sym->linkage_name (); expression_up expr = parse_exp_1 (&sym_name, 0, block, 0); return evaluate_expression (expr.get ()); } @@ -4834,8 +4832,8 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) { struct type *type0 = SYMBOL_TYPE (sym0); struct type *type1 = SYMBOL_TYPE (sym1); - const char *name0 = SYMBOL_LINKAGE_NAME (sym0); - const char *name1 = SYMBOL_LINKAGE_NAME (sym1); + const char *name0 = sym0->linkage_name (); + const char *name1 = sym1->linkage_name (); int len0 = strlen (name0); return @@ -4850,8 +4848,8 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) case LOC_STATIC: { - const char *name0 = SYMBOL_LINKAGE_NAME (sym0); - const char *name1 = SYMBOL_LINKAGE_NAME (sym1); + const char *name0 = sym0->linkage_name (); + const char *name1 = sym1->linkage_name (); return (strcmp (name0, name1) == 0 && SYMBOL_VALUE_ADDRESS (sym0) == SYMBOL_VALUE_ADDRESS (sym1)); } @@ -5112,15 +5110,15 @@ remove_extra_symbols (std::vector *syms) the get rid of the stub. */ if (TYPE_STUB (SYMBOL_TYPE ((*syms)[i].symbol)) - && SYMBOL_LINKAGE_NAME ((*syms)[i].symbol) != NULL) + && (*syms)[i].symbol->linkage_name () != NULL) { for (j = 0; j < syms->size (); j++) { if (j != i && !TYPE_STUB (SYMBOL_TYPE ((*syms)[j].symbol)) - && SYMBOL_LINKAGE_NAME ((*syms)[j].symbol) != NULL - && strcmp (SYMBOL_LINKAGE_NAME ((*syms)[i].symbol), - SYMBOL_LINKAGE_NAME ((*syms)[j].symbol)) == 0) + && (*syms)[j].symbol->linkage_name () != NULL + && strcmp ((*syms)[i].symbol->linkage_name (), + (*syms)[j].symbol->linkage_name ()) == 0) remove_p = 1; } } @@ -5128,16 +5126,16 @@ remove_extra_symbols (std::vector *syms) /* Two symbols with the same name, same class and same address should be identical. */ - else if (SYMBOL_LINKAGE_NAME ((*syms)[i].symbol) != NULL + else if ((*syms)[i].symbol->linkage_name () != NULL && SYMBOL_CLASS ((*syms)[i].symbol) == LOC_STATIC && is_nondebugging_type (SYMBOL_TYPE ((*syms)[i].symbol))) { for (j = 0; j < syms->size (); j += 1) { if (i != j - && SYMBOL_LINKAGE_NAME ((*syms)[j].symbol) != NULL - && strcmp (SYMBOL_LINKAGE_NAME ((*syms)[i].symbol), - SYMBOL_LINKAGE_NAME ((*syms)[j].symbol)) == 0 + && (*syms)[j].symbol->linkage_name () != NULL + && strcmp ((*syms)[i].symbol->linkage_name (), + (*syms)[j].symbol->linkage_name ()) == 0 && SYMBOL_CLASS ((*syms)[i].symbol) == SYMBOL_CLASS ((*syms)[j].symbol) && SYMBOL_VALUE_ADDRESS ((*syms)[i].symbol) @@ -5314,7 +5312,7 @@ remove_irrelevant_renamings (std::vector *syms, if (sym == NULL || SYMBOL_CLASS (sym) == LOC_TYPEDEF) continue; - name = SYMBOL_LINKAGE_NAME (sym); + name = sym->linkage_name (); suffix = strstr (name, "___XR"); if (suffix != NULL) @@ -5325,7 +5323,7 @@ remove_irrelevant_renamings (std::vector *syms, is_new_style_renaming = 1; for (j = 0; j < syms->size (); j += 1) if (i != j && (*syms)[j].symbol != NULL - && strncmp (name, SYMBOL_LINKAGE_NAME ((*syms)[j].symbol), + && strncmp (name, (*syms)[j].symbol->linkage_name (), name_len) == 0 && block == (*syms)[j].block) (*syms)[j].symbol = NULL; @@ -5354,7 +5352,7 @@ remove_irrelevant_renamings (std::vector *syms, if (current_function == NULL) return syms->size (); - current_function_name = SYMBOL_LINKAGE_NAME (current_function); + current_function_name = current_function->linkage_name (); if (current_function_name == NULL) return syms->size (); @@ -6267,17 +6265,17 @@ ada_add_block_symbols (struct obstack *obstackp, { int cmp; - cmp = (int) '_' - (int) SYMBOL_LINKAGE_NAME (sym)[0]; + cmp = (int) '_' - (int) sym->linkage_name ()[0]; if (cmp == 0) { - cmp = !startswith (SYMBOL_LINKAGE_NAME (sym), "_ada_"); + cmp = !startswith (sym->linkage_name (), "_ada_"); if (cmp == 0) - cmp = strncmp (name, SYMBOL_LINKAGE_NAME (sym) + 5, + cmp = strncmp (name, sym->linkage_name () + 5, name_len); } if (cmp == 0 - && is_name_suffix (SYMBOL_LINKAGE_NAME (sym) + name_len + 5)) + && is_name_suffix (sym->linkage_name () + name_len + 5)) { if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED) { @@ -6469,7 +6467,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker, completion_list_add_name (tracker, SYMBOL_LANGUAGE (sym), - SYMBOL_LINKAGE_NAME (sym), + sym->linkage_name (), lookup_name, text, word); } } @@ -6490,7 +6488,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker, completion_list_add_name (tracker, SYMBOL_LANGUAGE (sym), - SYMBOL_LINKAGE_NAME (sym), + sym->linkage_name (), lookup_name, text, word); } } @@ -6512,7 +6510,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker, completion_list_add_name (tracker, SYMBOL_LANGUAGE (sym), - SYMBOL_LINKAGE_NAME (sym), + sym->linkage_name (), lookup_name, text, word); } } @@ -7856,7 +7854,7 @@ ada_find_any_type (const char *name) static bool ada_is_renaming_symbol (struct symbol *name_sym) { - const char *name = SYMBOL_LINKAGE_NAME (name_sym); + const char *name = name_sym->linkage_name (); return strstr (name, "___XR") != NULL; } @@ -9945,7 +9943,7 @@ aggregate_assign_from_choices (struct value *container, name = &exp->elts[choice_pos + 2].string; break; case OP_VAR_VALUE: - name = SYMBOL_NATURAL_NAME (exp->elts[choice_pos + 2].symbol); + name = exp->elts[choice_pos + 2].symbol->natural_name (); break; default: error (_("Invalid record component association.")); @@ -10610,7 +10608,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, context other than a function call, in which case, it is invalid. */ error (_("Unexpected unresolved symbol, %s, during evaluation"), - SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol)); + exp->elts[pc + 2].symbol->print_name ()); if (noside == EVAL_AVOID_SIDE_EFFECTS) { @@ -10700,7 +10698,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, if (exp->elts[*pos].opcode == OP_VAR_VALUE && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN) error (_("Unexpected unresolved symbol, %s, during evaluation"), - SYMBOL_PRINT_NAME (exp->elts[pc + 5].symbol)); + exp->elts[pc + 5].symbol->print_name ()); else { for (tem = 0; tem <= nargs; tem += 1) @@ -11923,7 +11921,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo) if (SYMBOL_CLASS (sym) != LOC_BLOCK) { error (_("Symbol \"%s\" is not a function (class = %d)"), - SYMBOL_LINKAGE_NAME (sym), SYMBOL_CLASS (sym)); + sym->linkage_name (), SYMBOL_CLASS (sym)); return 0; } @@ -11946,7 +11944,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo) if (SYMBOL_CLASS (sym) != LOC_BLOCK) { error (_("Symbol \"%s\" is not a function (class = %d)"), - SYMBOL_LINKAGE_NAME (sym), SYMBOL_CLASS (sym)); + sym->linkage_name (), SYMBOL_CLASS (sym)); return 0; } @@ -13141,13 +13139,13 @@ ada_is_non_standard_exception_sym (struct symbol *sym) return 0; for (i = 0; i < ARRAY_SIZE (standard_exc); i++) - if (strcmp (SYMBOL_LINKAGE_NAME (sym), standard_exc[i]) == 0) + if (strcmp (sym->linkage_name (), standard_exc[i]) == 0) return 0; /* A standard exception. */ /* Numeric_Error is also a standard exception, so exclude it. See the STANDARD_EXC description for more details as to why this exception is not listed in that array. */ - if (strcmp (SYMBOL_LINKAGE_NAME (sym), "numeric_error") == 0) + if (strcmp (sym->linkage_name (), "numeric_error") == 0) return 0; return 1; @@ -13260,7 +13258,7 @@ ada_add_exceptions_from_frame (compiled_regex *preg, default: if (ada_is_exception_sym (sym)) { - struct ada_exc_info info = {SYMBOL_PRINT_NAME (sym), + struct ada_exc_info info = {sym->print_name (), SYMBOL_VALUE_ADDRESS (sym)}; exceptions->push_back (info); @@ -13333,10 +13331,10 @@ ada_add_global_exceptions (compiled_regex *preg, ALL_BLOCK_SYMBOLS (b, iter, sym) if (ada_is_non_standard_exception_sym (sym) - && name_matches_regex (SYMBOL_NATURAL_NAME (sym), preg)) + && name_matches_regex (sym->natural_name (), preg)) { struct ada_exc_info info - = {SYMBOL_PRINT_NAME (sym), SYMBOL_VALUE_ADDRESS (sym)}; + = {sym->print_name (), SYMBOL_VALUE_ADDRESS (sym)}; exceptions->push_back (info); } @@ -13664,7 +13662,7 @@ ada_print_subexp (struct expression *exp, int *pos, return; case OP_VAR_VALUE: - fputs_filtered (SYMBOL_NATURAL_NAME (exp->elts[pc + 2].symbol), stream); + fputs_filtered (exp->elts[pc + 2].symbol->natural_name (), stream); return; case BINOP_IN_BOUNDS: diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 23a4120e165..84895870643 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -675,7 +675,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) case LOC_TYPEDEF: error (_("Cannot compute value of typedef `%s'."), - SYMBOL_PRINT_NAME (var)); + var->print_name ()); break; case LOC_BLOCK: @@ -705,10 +705,10 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) case LOC_UNRESOLVED: { struct bound_minimal_symbol msym - = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL); + = lookup_minimal_symbol (var->linkage_name (), NULL, NULL); if (!msym.minsym) - error (_("Couldn't resolve symbol `%s'."), SYMBOL_PRINT_NAME (var)); + error (_("Couldn't resolve symbol `%s'."), var->print_name ()); /* Push the address of the variable. */ ax_const_l (ax, BMSYMBOL_VALUE_ADDRESS (msym)); @@ -727,7 +727,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) default: error (_("Cannot find value of botched symbol `%s'."), - SYMBOL_PRINT_NAME (var)); + var->print_name ()); break; } } @@ -1658,7 +1658,7 @@ gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value, if (value->optimized_out) error (_("`%s' has been optimized out, cannot use"), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); return 1; } @@ -1784,7 +1784,7 @@ gen_expr_for_cast (struct expression *exp, union exp_element **pc, if (value->optimized_out) error (_("`%s' has been optimized out, cannot use"), - SYMBOL_PRINT_NAME ((*pc)[2].symbol)); + (*pc)[2].symbol->print_name ()); } else gen_msym_var_ref (ax, value, (*pc)[2].msymbol, (*pc)[1].objfile); @@ -2008,10 +2008,10 @@ gen_expr (struct expression *exp, union exp_element **pc, if (value->optimized_out) error (_("`%s' has been optimized out, cannot use"), - SYMBOL_PRINT_NAME ((*pc)[2].symbol)); + (*pc)[2].symbol->print_name ()); if (TYPE_CODE (value->type) == TYPE_CODE_ERROR) - error_unknown_type (SYMBOL_PRINT_NAME ((*pc)[2].symbol)); + error_unknown_type ((*pc)[2].symbol->print_name ()); (*pc) += 4; break; @@ -2240,7 +2240,7 @@ gen_expr (struct expression *exp, union exp_element **pc, if (value->optimized_out) error (_("`%s' has been optimized out, cannot use"), - SYMBOL_PRINT_NAME (sym)); + sym->print_name ()); (*pc) += 2; } diff --git a/gdb/block.h b/gdb/block.h index 4c02e01d906..118046d446d 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -325,7 +325,7 @@ extern struct symbol *block_iterator_first (const struct block *block, extern struct symbol *block_iterator_next (struct block_iterator *iterator); /* Initialize ITERATOR to point at the first symbol in BLOCK whose - SYMBOL_SEARCH_NAME matches NAME, and return that first symbol, or + search_name () matches NAME, and return that first symbol, or NULL if there are no such symbols. */ extern struct symbol *block_iter_match_first (const struct block *block, @@ -333,7 +333,7 @@ extern struct symbol *block_iter_match_first (const struct block *block, struct block_iterator *iterator); /* Advance ITERATOR to point at the next symbol in BLOCK whose - SYMBOL_SEARCH_NAME matches NAME, or NULL if there are no more such + search_name () matches NAME, or NULL if there are no more such symbols. Don't call this if you've previously received NULL from block_iterator_match_first or block_iterator_match_next on this iteration. And don't call it unless ITERATOR was created by a diff --git a/gdb/blockframe.c b/gdb/blockframe.c index fd835174df2..d9c28e0a017 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -269,7 +269,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address, { const struct block *b = SYMBOL_BLOCK_VALUE (f); - cache_pc_function_name = SYMBOL_LINKAGE_NAME (f); + cache_pc_function_name = f->linkage_name (); cache_pc_function_section = section; cache_pc_function_block = b; diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index e90a1c0fbe8..583f46d8521 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5818,7 +5818,7 @@ print_breakpoint_location (struct breakpoint *b, if (sym) { uiout->text ("in "); - uiout->field_string ("func", SYMBOL_PRINT_NAME (sym), + uiout->field_string ("func", sym->print_name (), function_name_style.style ()); uiout->text (" "); uiout->wrap_hint (wrap_indent_at_field (uiout, "what")); @@ -13304,7 +13304,7 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal) uiout->text ("Now in "); if (sym) { - uiout->field_string ("func", SYMBOL_PRINT_NAME (sym), + uiout->field_string ("func", sym->print_name (), function_name_style.style ()); uiout->text (" at "); } diff --git a/gdb/btrace.c b/gdb/btrace.c index 9422c2b7158..f6a0643ba17 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -82,7 +82,7 @@ ftrace_print_function_name (const struct btrace_function *bfun) sym = bfun->sym; if (sym != NULL) - return SYMBOL_PRINT_NAME (sym); + return sym->print_name (); if (msym != NULL) return msym->print_name (); @@ -206,7 +206,7 @@ ftrace_function_switched (const struct btrace_function *bfun, const char *bfname, *fname; /* Check the function name. */ - if (strcmp (SYMBOL_LINKAGE_NAME (fun), SYMBOL_LINKAGE_NAME (sym)) != 0) + if (strcmp (fun->linkage_name (), sym->linkage_name ()) != 0) return 1; /* Check the location of those functions, as well. */ diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 24d1e0f806b..79f83057634 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -164,7 +164,7 @@ find_symbol_in_list (struct pending *list, char *name, int length) { for (j = list->nsyms; --j >= 0;) { - pp = SYMBOL_LINKAGE_NAME (list->symbol[j]); + pp = list->symbol[j]->linkage_name (); if (*pp == *name && strncmp (pp, name, length) == 0 && pp[length] == '\0') { @@ -319,7 +319,7 @@ buildsym_compunit::finish_block_internal { complaint (_("block end address less than block " "start address in %s (patched it)"), - SYMBOL_PRINT_NAME (symbol)); + symbol->print_name ()); } else { @@ -356,7 +356,7 @@ buildsym_compunit::finish_block_internal if (symbol) { complaint (_("inner block not inside outer block in %s"), - SYMBOL_PRINT_NAME (symbol)); + symbol->print_name ()); } else { diff --git a/gdb/c-exp.y b/gdb/c-exp.y index e0abbd83ddb..0ec6b193dc6 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -3393,7 +3393,7 @@ c_print_token (FILE *file, int type, YYSTYPE value) parser_fprintf (file, "ssym", copy_name (value.ssym.stoken).c_str (), (value.ssym.sym.symbol == NULL - ? "(null)" : SYMBOL_PRINT_NAME (value.ssym.sym.symbol)), + ? "(null)" : value.ssym.sym.symbol->print_name ()), value.ssym.is_a_field_of_this); break; diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index e0f1714da11..677b85ee842 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -208,9 +208,9 @@ c_print_typedef (struct type *type, type_print (type, "", stream, -1); if (TYPE_NAME ((SYMBOL_TYPE (new_symbol))) == 0 || strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))), - SYMBOL_LINKAGE_NAME (new_symbol)) != 0 + new_symbol->linkage_name ()) != 0 || TYPE_CODE (SYMBOL_TYPE (new_symbol)) == TYPE_CODE_TYPEDEF) - fprintf_filtered (stream, " %s", SYMBOL_PRINT_NAME (new_symbol)); + fprintf_filtered (stream, " %s", new_symbol->print_name ()); fprintf_filtered (stream, ";"); } @@ -880,15 +880,14 @@ c_type_print_template_args (const struct type_print_options *flags, if (first) { wrap_here (" "); - fprintf_filtered (stream, _("[with %s = "), - SYMBOL_LINKAGE_NAME (sym)); + fprintf_filtered (stream, _("[with %s = "), sym->linkage_name ()); first = 0; } else { fputs_filtered (", ", stream); wrap_here (" "); - fprintf_filtered (stream, "%s = ", SYMBOL_LINKAGE_NAME (sym)); + fprintf_filtered (stream, "%s = ", sym->linkage_name ()); } c_print_type (SYMBOL_TYPE (sym), "", stream, -1, 0, flags); diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 409240c118c..681d53c574d 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -938,7 +938,7 @@ edit_command (const char *arg, int from_tty) if (sym) printf_filtered ("%s is in %s (%s:%d).\n", paddress (gdbarch, sal.pc), - SYMBOL_PRINT_NAME (sym), + sym->print_name (), symtab_to_filename_for_display (sal.symtab), sal.line); else @@ -1270,7 +1270,7 @@ list_command (const char *arg, int from_tty) if (sym) printf_filtered ("%s is in %s (%s:%d).\n", paddress (gdbarch, sal.pc), - SYMBOL_PRINT_NAME (sym), + sym->print_name (), symtab_to_filename_for_display (sal.symtab), sal.line); else printf_filtered ("%s is at %s:%d.\n", @@ -1758,7 +1758,7 @@ print_sal_location (const symtab_and_line &sal) const char *sym_name = NULL; if (sal.symbol != NULL) - sym_name = SYMBOL_PRINT_NAME (sal.symbol); + sym_name = sal.symbol->print_name (); printf_filtered (_("file: \"%s\", line number: %d, symbol: \"%s\"\n"), symtab_to_filename_for_display (sal.symtab), sal.line, sym_name != NULL ? sym_name : "???"); diff --git a/gdb/coffread.c b/gdb/coffread.c index 8564be1faa2..ac00e1c1e3b 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1502,15 +1502,15 @@ patch_opaque_types (struct symtab *s) && TYPE_CODE (SYMBOL_TYPE (real_sym)) == TYPE_CODE_PTR && TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (real_sym))) != 0) { - const char *name = SYMBOL_LINKAGE_NAME (real_sym); + const char *name = real_sym->linkage_name (); int hash = hashname (name); struct symbol *sym, *prev; prev = 0; for (sym = opaque_type_chain[hash]; sym;) { - if (name[0] == SYMBOL_LINKAGE_NAME (sym)[0] - && strcmp (name + 1, SYMBOL_LINKAGE_NAME (sym) + 1) == 0) + if (name[0] == sym->linkage_name ()[0] + && strcmp (name + 1, sym->linkage_name () + 1) == 0) { if (prev) { @@ -1693,7 +1693,7 @@ process_coff_symbol (struct coff_symbol *cs, } else TYPE_NAME (SYMBOL_TYPE (sym)) = - xstrdup (SYMBOL_LINKAGE_NAME (sym)); + xstrdup (sym->linkage_name ()); } /* Keep track of any type which points to empty structured @@ -1707,7 +1707,7 @@ process_coff_symbol (struct coff_symbol *cs, && TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) != TYPE_CODE_UNDEF) { - int i = hashname (SYMBOL_LINKAGE_NAME (sym)); + int i = hashname (sym->linkage_name ()); SYMBOL_VALUE_CHAIN (sym) = opaque_type_chain[i]; opaque_type_chain[i] = sym; @@ -1725,11 +1725,10 @@ process_coff_symbol (struct coff_symbol *cs, names for anonymous enums, structures, and unions, like "~0fake" or ".0fake". Thanks, but no thanks... */ if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) - if (SYMBOL_LINKAGE_NAME (sym) != NULL - && *SYMBOL_LINKAGE_NAME (sym) != '~' - && *SYMBOL_LINKAGE_NAME (sym) != '.') - TYPE_NAME (SYMBOL_TYPE (sym)) = - xstrdup (SYMBOL_LINKAGE_NAME (sym)); + if (sym->linkage_name () != NULL + && *sym->linkage_name () != '~' + && *sym->linkage_name () != '.') + TYPE_NAME (SYMBOL_TYPE (sym)) = xstrdup (sym->linkage_name ()); add_symbol_to_list (sym, get_file_symbols ()); break; @@ -2154,7 +2153,7 @@ coff_read_enum_type (int index, int length, int lastsym, struct symbol *xsym = syms->symbol[j]; SYMBOL_TYPE (xsym) = type; - TYPE_FIELD_NAME (type, n) = SYMBOL_LINKAGE_NAME (xsym); + TYPE_FIELD_NAME (type, n) = xsym->linkage_name (); SET_FIELD_ENUMVAL (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym)); if (SYMBOL_VALUE (xsym) < 0) unsigned_enum = 0; diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index abd0aeabab7..51430880586 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -40,7 +40,7 @@ gdb::unique_xmalloc_ptr c_symbol_substitution_name (struct symbol *sym) { return gdb::unique_xmalloc_ptr - (concat ("__", SYMBOL_NATURAL_NAME (sym), "_ptr", (char *) NULL)); + (concat ("__", sym->natural_name (), "_ptr", (char *) NULL)); } /* Convert a given symbol, SYM, to the compiler's representation. @@ -70,7 +70,7 @@ convert_one_symbol (compile_c_instance *context, if (SYMBOL_DOMAIN (sym.symbol) == STRUCT_DOMAIN) { /* Binding a tag, so we don't need to build a decl. */ - context->plugin ().tagbind (SYMBOL_NATURAL_NAME (sym.symbol), + context->plugin ().tagbind (sym.symbol->natural_name (), sym_type, filename, line); } else @@ -105,28 +105,28 @@ convert_one_symbol (compile_c_instance *context, return; } context->plugin ().build_constant - (sym_type, SYMBOL_NATURAL_NAME (sym.symbol), + (sym_type, sym.symbol->natural_name (), SYMBOL_VALUE (sym.symbol), filename, line); return; case LOC_CONST_BYTES: error (_("Unsupported LOC_CONST_BYTES for symbol \"%s\"."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); case LOC_UNDEF: internal_error (__FILE__, __LINE__, _("LOC_UNDEF found for \"%s\"."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); case LOC_COMMON_BLOCK: error (_("Fortran common block is unsupported for compilation " "evaluaton of symbol \"%s\"."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); case LOC_OPTIMIZED_OUT: error (_("Symbol \"%s\" cannot be used for compilation evaluation " "as it is optimized out."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); case LOC_COMPUTED: if (is_local) @@ -135,7 +135,7 @@ convert_one_symbol (compile_c_instance *context, warning (_("Symbol \"%s\" is thread-local and currently can only " "be referenced from the current thread in " "compiled code."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); /* FALLTHROUGH */ case LOC_UNRESOLVED: /* 'symbol_name' cannot be used here as that one is used only for @@ -152,14 +152,14 @@ convert_one_symbol (compile_c_instance *context, if (frame == NULL) error (_("Symbol \"%s\" cannot be used because " "there is no selected frame"), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); } val = read_var_value (sym.symbol, sym.block, frame); if (VALUE_LVAL (val) != lval_memory) error (_("Symbol \"%s\" cannot be used for compilation " "evaluation as its address has not been found."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); kind = GCC_C_SYMBOL_VARIABLE; addr = value_address (val); @@ -193,7 +193,7 @@ convert_one_symbol (compile_c_instance *context, || symbol_name == NULL) { decl = context->plugin ().build_decl - (SYMBOL_NATURAL_NAME (sym.symbol), + (sym.symbol->natural_name (), kind, sym_type, symbol_name.get (), addr, @@ -450,7 +450,7 @@ hash_symname (const void *a) { const struct symbol *sym = (const struct symbol *) a; - return htab_hash_string (SYMBOL_NATURAL_NAME (sym)); + return htab_hash_string (sym->natural_name ()); } /* A comparison function for hash tables that just looks at symbol @@ -462,7 +462,7 @@ eq_symname (const void *a, const void *b) const struct symbol *syma = (const struct symbol *) a; const struct symbol *symb = (const struct symbol *) b; - return strcmp (SYMBOL_NATURAL_NAME (syma), SYMBOL_NATURAL_NAME (symb)) == 0; + return strcmp (syma->natural_name (), symb->natural_name ()) == 0; } /* If a symbol with the same name as SYM is already in HASHTAB, return diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index 1acd07d316a..65b27f89e7b 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -100,27 +100,27 @@ convert_one_symbol (compile_cplus_instance *instance, return; } instance->plugin ().build_constant - (sym_type, SYMBOL_NATURAL_NAME (sym.symbol), + (sym_type, sym.symbol->natural_name (), SYMBOL_VALUE (sym.symbol), filename, line); return; case LOC_CONST_BYTES: error (_("Unsupported LOC_CONST_BYTES for symbol \"%s\"."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); case LOC_UNDEF: internal_error (__FILE__, __LINE__, _("LOC_UNDEF found for \"%s\"."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); case LOC_COMMON_BLOCK: error (_("Fortran common block is unsupported for compilation " "evaluaton of symbol \"%s\"."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); case LOC_OPTIMIZED_OUT: error (_("Symbol \"%s\" cannot be used for compilation evaluation " "as it is optimized out."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); case LOC_COMPUTED: if (is_local) @@ -129,7 +129,7 @@ convert_one_symbol (compile_cplus_instance *instance, warning (_("Symbol \"%s\" is thread-local and currently can only " "be referenced from the current thread in " "compiled code."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); /* FALLTHROUGH */ case LOC_UNRESOLVED: /* 'symbol_name' cannot be used here as that one is used only for @@ -146,14 +146,14 @@ convert_one_symbol (compile_cplus_instance *instance, if (frame == nullptr) error (_("Symbol \"%s\" cannot be used because " "there is no selected frame"), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); } val = read_var_value (sym.symbol, sym.block, frame); if (VALUE_LVAL (val) != lval_memory) error (_("Symbol \"%s\" cannot be used for compilation " "evaluation as its address has not been found."), - SYMBOL_PRINT_NAME (sym.symbol)); + sym.symbol->print_name ()); kind = GCC_CP_SYMBOL_VARIABLE; addr = value_address (val); @@ -189,7 +189,7 @@ convert_one_symbol (compile_cplus_instance *instance, if (!is_local) { compile_scope scope - = instance->new_scope (SYMBOL_NATURAL_NAME (sym.symbol), + = instance->new_scope (sym.symbol->natural_name (), SYMBOL_TYPE (sym.symbol)); if (scope.nested_type () != GCC_TYPE_NONE) { @@ -202,9 +202,9 @@ convert_one_symbol (compile_cplus_instance *instance, } /* Get the `raw' name of the symbol. */ - if (name.empty () && SYMBOL_NATURAL_NAME (sym.symbol) != nullptr) + if (name.empty () && sym.symbol->natural_name () != nullptr) name = compile_cplus_instance::decl_name - (SYMBOL_NATURAL_NAME (sym.symbol)).get (); + (sym.symbol->natural_name ()).get (); /* Define the decl. */ instance->plugin ().build_decl diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 042c2afbe90..c6d2b294ab2 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -112,7 +112,7 @@ debug_print_scope (const compile_scope &scope) for (const auto &comp: scope) { const char *symbol = (comp.bsymbol.symbol != nullptr - ? SYMBOL_NATURAL_NAME (comp.bsymbol.symbol) + ? comp.bsymbol.symbol->natural_name () : ""); printf_unfiltered ("\tname = %s, symbol = %s\n", comp.name.c_str (), diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c index 22253c4dbfd..2580f9d6b84 100644 --- a/gdb/compile/compile-loc2c.c +++ b/gdb/compile/compile-loc2c.c @@ -622,18 +622,18 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, if (frame == NULL) error (_("Symbol \"%s\" cannot be used because " "there is no selected frame"), - SYMBOL_PRINT_NAME (sym)); + sym->print_name ()); val = read_var_value (sym, NULL, frame); if (VALUE_LVAL (val) != lval_memory) error (_("Symbol \"%s\" cannot be used for compilation evaluation " "as its address has not been found."), - SYMBOL_PRINT_NAME (sym)); + sym->print_name ()); warning (_("Symbol \"%s\" is thread-local and currently can only " "be referenced from the current thread in " "compiled code."), - SYMBOL_PRINT_NAME (sym)); + sym->print_name ()); fprintfi_filtered (indent, stream, "%s = %s;\n", result_name, diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index a30c5573038..c9bf1518372 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -433,7 +433,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile, if (function != NULL && (BLOCK_SUPERBLOCK (function_block) == BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) - && (strcmp_iw (SYMBOL_LINKAGE_NAME (function), + && (strcmp_iw (function->linkage_name (), GCC_FE_WRAPPER_FUNCTION) == 0)) break; diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index e15b77e701d..2b3f014253a 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -54,9 +54,9 @@ cp_scan_for_anonymous_namespaces (struct buildsym_compunit *compunit, const struct symbol *const symbol, struct objfile *const objfile) { - if (SYMBOL_DEMANGLED_NAME (symbol) != NULL) + if (symbol->demangled_name () != NULL) { - const char *name = SYMBOL_DEMANGLED_NAME (symbol); + const char *name = symbol->demangled_name (); unsigned int previous_component; unsigned int next_component; @@ -488,7 +488,7 @@ search_symbol_list (const char *name, int num, /* Maybe we should store a dictionary in here instead. */ for (i = 0; i < num; ++i) { - if (strcmp (name, SYMBOL_NATURAL_NAME (syms[i])) == 0) + if (strcmp (name, syms[i]->natural_name ()) == 0) return syms[i]; } return NULL; @@ -542,10 +542,10 @@ cp_lookup_symbol_imports_or_template (const char *scope, /* Search the template parameters of the function's defining context. */ - if (SYMBOL_NATURAL_NAME (function)) + if (function->natural_name ()) { struct type *context; - std::string name_copy (SYMBOL_NATURAL_NAME (function)); + std::string name_copy (function->natural_name ()); const struct language_defn *lang = language_def (language_cplus); struct gdbarch *arch = symbol_arch (function); const struct block *parent = BLOCK_SUPERBLOCK (block); diff --git a/gdb/cp-support.c b/gdb/cp-support.c index fd7ddc1dbf3..55a2e42b34b 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1154,13 +1154,12 @@ overload_list_add_symbol (struct symbol *sym, /* skip any symbols that we've already considered. */ for (symbol *listed_sym : *overload_list) - if (strcmp (SYMBOL_LINKAGE_NAME (sym), - SYMBOL_LINKAGE_NAME (listed_sym)) == 0) + if (strcmp (sym->linkage_name (), listed_sym->linkage_name ()) == 0) return; /* Get the demangled name without parameters */ gdb::unique_xmalloc_ptr sym_name - = cp_remove_params (SYMBOL_NATURAL_NAME (sym)); + = cp_remove_params (sym->natural_name ()); if (!sym_name) return; diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 0e80150394a..c5f9130c6a8 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -1230,7 +1230,7 @@ psymtab_to_symtab (struct partial_symtab *pst) if (sym == NULL) continue; - set_symbol_address (ccp->of, sym, SYMBOL_LINKAGE_NAME (sym)); + set_symbol_address (ccp->of, sym, sym->linkage_name ()); } pst->readin = 1; diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 462f7f0ddae..73f1ba8759a 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2341,7 +2341,7 @@ cp_set_block_scope (const struct symbol *symbol, struct block *block, struct obstack *obstack) { - if (SYMBOL_DEMANGLED_NAME (symbol) != NULL) + if (symbol->demangled_name () != NULL) { /* Try to figure out the appropriate namespace from the demangled name. */ @@ -2351,7 +2351,7 @@ cp_set_block_scope (const struct symbol *symbol, name of the class as well. This should be harmless, but is a little unfortunate. */ - const char *name = SYMBOL_DEMANGLED_NAME (symbol); + const char *name = symbol->demangled_name (); unsigned int prefix_len = cp_entire_prefix_len (name); block_set_scope (block, obstack_strndup (obstack, name, prefix_len), diff --git a/gdb/dictionary.c b/gdb/dictionary.c index 2546c054e17..e47e0217b9c 100644 --- a/gdb/dictionary.c +++ b/gdb/dictionary.c @@ -608,7 +608,7 @@ iter_match_first_hashed (const struct dictionary *dict, sym = sym->hash_next) { /* Warning: the order of arguments to compare matters! */ - if (matches_name (SYMBOL_SEARCH_NAME (sym), name, NULL)) + if (matches_name (sym->search_name (), name, NULL)) break; } @@ -629,7 +629,7 @@ iter_match_next_hashed (const lookup_name_info &name, next != NULL; next = next->hash_next) { - if (matches_name (SYMBOL_SEARCH_NAME (next), name, NULL)) + if (matches_name (next->search_name (), name, NULL)) break; } @@ -652,7 +652,7 @@ insert_symbol_hashed (struct dictionary *dict, language. The two may not use the same hashing algorithm. */ gdb_assert (SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language); - hash = search_name_hash (SYMBOL_LANGUAGE (sym), SYMBOL_SEARCH_NAME (sym)); + hash = search_name_hash (SYMBOL_LANGUAGE (sym), sym->search_name ()); hash_index = hash % DICT_HASHED_NBUCKETS (dict); sym->hash_next = buckets[hash_index]; buckets[hash_index] = sym; @@ -847,7 +847,7 @@ iter_match_next_linear (const lookup_name_info &name, { sym = DICT_LINEAR_SYM (dict, i); - if (matches_name (SYMBOL_SEARCH_NAME (sym), name, NULL)) + if (matches_name (sym->search_name (), name, NULL)) { retval = sym; break; diff --git a/gdb/dictionary.h b/gdb/dictionary.h index 5705dbba2b2..e6481cd38ce 100644 --- a/gdb/dictionary.h +++ b/gdb/dictionary.h @@ -142,7 +142,7 @@ extern struct symbol * extern struct symbol *mdict_iterator_next (struct mdict_iterator *miterator); /* Initialize MITERATOR to point at the first symbol in MDICT whose - SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (which must use + search_name () is NAME, as tested using COMPARE (which must use the same conventions as strcmp_iw and be compatible with any dictionary hashing function), and return that first symbol, or NULL if there are no such symbols. */ @@ -153,7 +153,7 @@ extern struct symbol * struct mdict_iterator *miterator); /* Advance MITERATOR to point at the next symbol in MDICT whose - SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (see + search_name () is NAME, as tested using COMPARE (see dict_iter_match_first), or NULL if there are no more such symbols. Don't call this if you've previously received NULL from mdict_iterator_match_first or mdict_iterator_match_next on this diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 1ac56b273ad..0b22745074a 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -524,7 +524,7 @@ func_get_frame_base_dwarf_block (struct symbol *framefunc, CORE_ADDR pc, if (*length == 0) error (_("Could not find the frame base for \"%s\"."), - SYMBOL_NATURAL_NAME (framefunc)); + framefunc->natural_name ()); } static CORE_ADDR @@ -3635,13 +3635,13 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, if (!b) error (_("No block found for address for symbol \"%s\"."), - SYMBOL_PRINT_NAME (symbol)); + symbol->print_name ()); framefunc = block_linkage_function (b); if (!framefunc) error (_("No function found for block for symbol \"%s\"."), - SYMBOL_PRINT_NAME (symbol)); + symbol->print_name ()); func_get_frame_base_dwarf_block (framefunc, addr, &base_data, &base_size); @@ -3655,7 +3655,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, if (buf_end != base_data + base_size) error (_("Unexpected opcode after " "DW_OP_breg%u for symbol \"%s\"."), - frame_reg, SYMBOL_PRINT_NAME (symbol)); + frame_reg, symbol->print_name ()); } else if (base_data[0] >= DW_OP_reg0 && base_data[0] <= DW_OP_reg31) { @@ -4229,7 +4229,7 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr, if (bad || data > end) error (_("Corrupted DWARF2 expression for \"%s\"."), - SYMBOL_PRINT_NAME (symbol)); + symbol->print_name ()); } /* Print a natural-language description of SYMBOL to STREAM. This @@ -4282,7 +4282,7 @@ locexpr_generate_c_location (struct symbol *sym, string_file *stream, unsigned int addr_size = dwarf2_per_cu_addr_size (dlbaton->per_cu); if (dlbaton->size == 0) - error (_("symbol \"%s\" is optimized out"), SYMBOL_NATURAL_NAME (sym)); + error (_("symbol \"%s\" is optimized out"), sym->natural_name ()); compile_dwarf_expr_to_c (stream, result_name, sym, pc, gdbarch, registers_used, addr_size, @@ -4428,7 +4428,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr, case DEBUG_LOC_BUFFER_OVERFLOW: case DEBUG_LOC_INVALID_ENTRY: error (_("Corrupted DWARF expression for symbol \"%s\"."), - SYMBOL_PRINT_NAME (symbol)); + symbol->print_name ()); default: gdb_assert_not_reached ("bad debug_loc_kind"); } @@ -4495,7 +4495,7 @@ loclist_generate_c_location (struct symbol *sym, string_file *stream, data = dwarf2_find_location_expression (dlbaton, &size, pc); if (size == 0) - error (_("symbol \"%s\" is optimized out"), SYMBOL_NATURAL_NAME (sym)); + error (_("symbol \"%s\" is optimized out"), sym->natural_name ()); compile_dwarf_expr_to_c (stream, result_name, sym, pc, gdbarch, registers_used, addr_size, diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index d89a54138be..1ca801c3977 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -6073,10 +6073,10 @@ dw2_debug_names_lookup_symbol (struct objfile *objfile, block_enum block_index, information (but NAME might contain it). */ if (sym != NULL - && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0) + && strcmp_iw (sym->search_name (), name) == 0) return stab; if (with_opaque != NULL - && strcmp_iw (SYMBOL_SEARCH_NAME (with_opaque), name) == 0) + && strcmp_iw (with_opaque->search_name (), name) == 0) stab_best = stab; /* Keep looking through other CUs. */ @@ -13776,7 +13776,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) (struct symbol *) templ_func); if (dwarf2_flag_true_p (die, DW_AT_main_subprogram, cu)) - set_objfile_main_name (objfile, SYMBOL_LINKAGE_NAME (newobj->name), + set_objfile_main_name (objfile, newobj->name->linkage_name (), cu->language); /* If there is a location expression for DW_AT_frame_base, record @@ -16476,7 +16476,7 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) * sizeof (struct field)); } - FIELD_NAME (fields[num_fields]) = SYMBOL_LINKAGE_NAME (sym); + FIELD_NAME (fields[num_fields]) = sym->linkage_name (); FIELD_TYPE (fields[num_fields]) = NULL; SET_FIELD_ENUMVAL (fields[num_fields], SYMBOL_VALUE (sym)); FIELD_BITSIZE (fields[num_fields]) = 0; @@ -21800,7 +21800,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, apply. */ bound_minimal_symbol found = (lookup_minimal_symbol_linkage - (SYMBOL_LINKAGE_NAME (sym), objfile)); + (sym->linkage_name (), objfile)); if (found.minsym != nullptr) sym->maybe_copied = 1; } @@ -21929,7 +21929,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, with this objfile, so we don't need to duplicate it for the type. */ if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) - TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_SEARCH_NAME (sym); + TYPE_NAME (SYMBOL_TYPE (sym)) = sym->search_name (); } } } @@ -22162,7 +22162,7 @@ dwarf2_const_value (const struct attribute *attr, struct symbol *sym, struct dwarf2_locexpr_baton *baton; dwarf2_const_value_attr (attr, SYMBOL_TYPE (sym), - SYMBOL_PRINT_NAME (sym), + sym->print_name (), &objfile->objfile_obstack, cu, &value, &bytes, &baton); @@ -25344,7 +25344,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym, else { dwarf2_invalid_attrib_class_complaint ("location description", - SYMBOL_NATURAL_NAME (sym)); + sym->natural_name ()); baton->size = 0; } diff --git a/gdb/eval.c b/gdb/eval.c index 6dca8be93cc..72f5109a7c4 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1049,7 +1049,7 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos, else if (op == OP_VAR_VALUE) { symbol *sym = exp->elts[*pos + 2].symbol; - var_func_name = SYMBOL_PRINT_NAME (sym); + var_func_name = sym->print_name (); } argvec[0] = evaluate_subexp_with_coercion (exp, pos, noside); @@ -1300,7 +1300,7 @@ evaluate_subexp_standard (struct type *expect_type, (*pos) += 3; symbol *var = exp->elts[pc + 2].symbol; if (TYPE_CODE (SYMBOL_TYPE (var)) == TYPE_CODE_ERROR) - error_unknown_type (SYMBOL_PRINT_NAME (var)); + error_unknown_type (var->print_name ()); if (noside != EVAL_SKIP) return evaluate_var_value (noside, exp->elts[pc + 1].block, var); else @@ -1342,7 +1342,7 @@ evaluate_subexp_standard (struct type *expect_type, if (SYMBOL_COMPUTED_OPS (sym) == NULL || SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry == NULL) error (_("Symbol \"%s\" does not have any specific entry value"), - SYMBOL_PRINT_NAME (sym)); + sym->print_name ()); frame = get_selected_frame (NULL); return SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry (sym, frame); diff --git a/gdb/expprint.c b/gdb/expprint.c index 70b9eb5bf66..70cc7ca594a 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -126,12 +126,12 @@ print_subexp_standard (struct expression *exp, int *pos, b = exp->elts[pc + 1].block; if (b != NULL && BLOCK_FUNCTION (b) != NULL - && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)) != NULL) + && BLOCK_FUNCTION (b)->print_name () != NULL) { - fputs_filtered (SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)), stream); + fputs_filtered (BLOCK_FUNCTION (b)->print_name (), stream); fputs_filtered ("::", stream); } - fputs_filtered (SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol), stream); + fputs_filtered (exp->elts[pc + 2].symbol->print_name (), stream); } return; @@ -154,7 +154,7 @@ print_subexp_standard (struct expression *exp, int *pos, { (*pos) += 2; fprintf_filtered (stream, "%s@entry", - SYMBOL_PRINT_NAME (exp->elts[pc + 1].symbol)); + exp->elts[pc + 1].symbol->print_name ()); } return; @@ -899,7 +899,7 @@ dump_subexp_body_standard (struct expression *exp, fprintf_filtered (stream, ", symbol @"); gdb_print_host_address (exp->elts[elt + 1].symbol, stream); fprintf_filtered (stream, " (%s)", - SYMBOL_PRINT_NAME (exp->elts[elt + 1].symbol)); + exp->elts[elt + 1].symbol->print_name ()); elt += 3; break; case OP_VAR_MSYM_VALUE: @@ -915,7 +915,7 @@ dump_subexp_body_standard (struct expression *exp, fprintf_filtered (stream, "Entry value of symbol @"); gdb_print_host_address (exp->elts[elt].symbol, stream); fprintf_filtered (stream, " (%s)", - SYMBOL_PRINT_NAME (exp->elts[elt].symbol)); + exp->elts[elt].symbol->print_name ()); elt += 2; break; case OP_LAST: diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index f9d49233fca..d5515c8f8fe 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -387,17 +387,17 @@ info_common_command_for_block (const struct block *block, const char *comname, gdb_assert (SYMBOL_CLASS (sym) == LOC_COMMON_BLOCK); - if (comname && (!SYMBOL_LINKAGE_NAME (sym) - || strcmp (comname, SYMBOL_LINKAGE_NAME (sym)) != 0)) + if (comname && (!sym->linkage_name () + || strcmp (comname, sym->linkage_name ()) != 0)) continue; if (*any_printed) putchar_filtered ('\n'); else *any_printed = 1; - if (SYMBOL_PRINT_NAME (sym)) + if (sym->print_name ()) printf_filtered (_("Contents of F77 COMMON block '%s':\n"), - SYMBOL_PRINT_NAME (sym)); + sym->print_name ()); else printf_filtered (_("Contents of blank COMMON block:\n")); @@ -406,7 +406,7 @@ info_common_command_for_block (const struct block *block, const char *comname, struct value *val = NULL; printf_filtered ("%s = ", - SYMBOL_PRINT_NAME (common->contents[index])); + common->contents[index]->print_name ()); try { diff --git a/gdb/findvar.c b/gdb/findvar.c index 95cc58d83f8..50e99f48d1f 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -566,9 +566,9 @@ get_hosting_frame (struct symbol *var, const struct block *var_block, { if (BLOCK_FUNCTION (var_block) && !block_inlined_p (var_block) - && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (var_block))) + && BLOCK_FUNCTION (var_block)->print_name ()) error (_("No frame is currently executing in block %s."), - SYMBOL_PRINT_NAME (BLOCK_FUNCTION (var_block))); + BLOCK_FUNCTION (var_block)->print_name ()); else error (_("No frame is currently executing in specified" " block")); @@ -601,7 +601,7 @@ default_read_var_value (struct symbol *var, const struct block *var_block, if (sym_need == SYMBOL_NEEDS_FRAME) gdb_assert (frame != NULL); else if (sym_need == SYMBOL_NEEDS_REGISTERS && !target_has_registers) - error (_("Cannot read `%s' without registers"), SYMBOL_PRINT_NAME (var)); + error (_("Cannot read `%s' without registers"), var->print_name ()); if (frame != NULL) frame = get_hosting_frame (var, var_block, frame); @@ -668,7 +668,7 @@ default_read_var_value (struct symbol *var, const struct block *var_block, addr = get_frame_args_address (frame); if (!addr) error (_("Unknown argument list address for `%s'."), - SYMBOL_PRINT_NAME (var)); + var->print_name ()); addr += SYMBOL_VALUE (var); break; @@ -680,7 +680,7 @@ default_read_var_value (struct symbol *var, const struct block *var_block, argref = get_frame_args_address (frame); if (!argref) error (_("Unknown argument list address for `%s'."), - SYMBOL_PRINT_NAME (var)); + var->print_name ()); argref += SYMBOL_VALUE (var); ref = value_at (lookup_pointer_type (type), argref); addr = value_as_address (ref); @@ -694,7 +694,7 @@ default_read_var_value (struct symbol *var, const struct block *var_block, case LOC_TYPEDEF: error (_("Cannot look up value of a typedef `%s'."), - SYMBOL_PRINT_NAME (var)); + var->print_name ()); break; case LOC_BLOCK: @@ -721,7 +721,7 @@ default_read_var_value (struct symbol *var, const struct block *var_block, if (regval == NULL) error (_("Value of register variable not available for `%s'."), - SYMBOL_PRINT_NAME (var)); + var->print_name ()); addr = value_as_address (regval); } @@ -731,7 +731,7 @@ default_read_var_value (struct symbol *var, const struct block *var_block, if (regval == NULL) error (_("Value of register variable not available for `%s'."), - SYMBOL_PRINT_NAME (var)); + var->print_name ()); return regval; } } @@ -747,7 +747,7 @@ default_read_var_value (struct symbol *var, const struct block *var_block, struct obj_section *obj_section; memset (&lookup_data, 0, sizeof (lookup_data)); - lookup_data.name = SYMBOL_LINKAGE_NAME (var); + lookup_data.name = var->linkage_name (); gdbarch_iterate_over_objfiles_in_search_order (symbol_arch (var), @@ -767,7 +767,7 @@ default_read_var_value (struct symbol *var, const struct block *var_block, can't be NULL. */ gdb_assert (flavour_name != NULL); error (_("Missing %s symbol \"%s\"."), - flavour_name, SYMBOL_LINKAGE_NAME (var)); + flavour_name, var->linkage_name ()); } obj_section = MSYMBOL_OBJ_SECTION (lookup_data.result.objfile, msym); /* Relocate address, unless there is no section or the variable is @@ -793,7 +793,7 @@ default_read_var_value (struct symbol *var, const struct block *var_block, default: error (_("Cannot look up value of a botched symbol `%s'."), - SYMBOL_PRINT_NAME (var)); + var->print_name ()); break; } diff --git a/gdb/go-lang.c b/gdb/go-lang.c index c5ab306c3bd..bf2eb1b6f71 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -411,7 +411,7 @@ go_sniff_from_mangled_name (const char *mangled, char **demangled) char * go_symbol_package_name (const struct symbol *sym) { - const char *mangled_name = SYMBOL_LINKAGE_NAME (sym); + const char *mangled_name = sym->linkage_name (); const char *package_name; const char *object_name; const char *method_type_package_name; diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c index fbb2f4ae1d8..20037b2e66c 100644 --- a/gdb/guile/scm-block.c +++ b/gdb/guile/scm-block.c @@ -157,7 +157,7 @@ bkscm_print_block_smob (SCM self, SCM port, scm_print_state *pstate) gdbscm_printf (port, " static"); if (BLOCK_FUNCTION (b) != NULL) - gdbscm_printf (port, " %s", SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b))); + gdbscm_printf (port, " %s", BLOCK_FUNCTION (b)->print_name ()); gdbscm_printf (port, " %s-%s", hex_string (BLOCK_START (b)), hex_string (BLOCK_END (b))); diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c index 7b44b56581d..c1b3635deac 100644 --- a/gdb/guile/scm-symbol.c +++ b/gdb/guile/scm-symbol.c @@ -157,7 +157,7 @@ syscm_print_symbol_smob (SCM self, SCM port, scm_print_state *pstate) gdbscm_printf (port, "#<%s ", symbol_smob_name); gdbscm_printf (port, "%s", s_smob->symbol != NULL - ? SYMBOL_PRINT_NAME (s_smob->symbol) + ? s_smob->symbol->print_name () : ""); if (pstate->writingp) scm_puts (">", port); @@ -376,7 +376,7 @@ gdbscm_symbol_name (SCM self) = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); const struct symbol *symbol = s_smob->symbol; - return gdbscm_scm_from_c_string (SYMBOL_NATURAL_NAME (symbol)); + return gdbscm_scm_from_c_string (symbol->natural_name ()); } /* (symbol-linkage-name ) -> string */ @@ -388,7 +388,7 @@ gdbscm_symbol_linkage_name (SCM self) = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); const struct symbol *symbol = s_smob->symbol; - return gdbscm_scm_from_c_string (SYMBOL_LINKAGE_NAME (symbol)); + return gdbscm_scm_from_c_string (symbol->linkage_name ()); } /* (symbol-print-name ) -> string */ @@ -400,7 +400,7 @@ gdbscm_symbol_print_name (SCM self) = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); const struct symbol *symbol = s_smob->symbol; - return gdbscm_scm_from_c_string (SYMBOL_PRINT_NAME (symbol)); + return gdbscm_scm_from_c_string (symbol->print_name ()); } /* (symbol-addr-class ) -> integer */ diff --git a/gdb/infcall.c b/gdb/infcall.c index 7ea2e2ee542..5553fc97791 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -387,7 +387,7 @@ get_function_name (CORE_ADDR funaddr, char *buf, int buf_size) struct symbol *symbol = find_pc_function (funaddr); if (symbol) - return SYMBOL_PRINT_NAME (symbol); + return symbol->print_name (); } { diff --git a/gdb/infcmd.c b/gdb/infcmd.c index eb18efab513..2a253469e74 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1210,7 +1210,7 @@ jump_command (const char *arg, int from_tty) if (fn != NULL && sfn != fn) { if (!query (_("Line %d is not in `%s'. Jump anyway? "), sal.line, - SYMBOL_PRINT_NAME (fn))) + fn->print_name ())) { error (_("Not confirmed.")); /* NOTREACHED */ @@ -1939,7 +1939,7 @@ finish_command (const char *arg, int from_tty) if (sm->function != NULL && TYPE_NO_RETURN (sm->function->type) && !query (_("warning: Function %s does not return normally.\n" "Try to finish anyway? "), - SYMBOL_PRINT_NAME (sm->function))) + sm->function->print_name ())) error (_("Not confirmed.")); printf_filtered (_("Run till exit from ")); } diff --git a/gdb/infrun.c b/gdb/infrun.c index d8a6eeda7a9..37186745dbf 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -7281,7 +7281,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp, CORE_ADDR handler; struct breakpoint *bp; - vsym = lookup_symbol_search_name (SYMBOL_SEARCH_NAME (sym), + vsym = lookup_symbol_search_name (sym->search_name (), b, VAR_DOMAIN); value = read_var_value (vsym.symbol, vsym.block, frame); /* If the value was optimized out, revert to the old behavior. */ diff --git a/gdb/linespec.c b/gdb/linespec.c index 817d1a42ef8..61dcb4830e2 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -2066,8 +2066,7 @@ canonicalize_linespec (struct linespec_state *state, const linespec_p ls) gdb_assert (!ls->labels.function_symbols->empty () && (ls->labels.function_symbols->size () == 1)); block_symbol s = ls->labels.function_symbols->front (); - explicit_loc->function_name - = xstrdup (SYMBOL_NATURAL_NAME (s.symbol)); + explicit_loc->function_name = xstrdup (s.symbol->natural_name ()); } } @@ -2195,7 +2194,7 @@ create_sals_line_offset (struct linespec_state *self, skip_prologue_sal (&intermediate_results[i]); intermediate_results[i].symbol = sym; add_sal_to_sals (self, &values, &intermediate_results[i], - sym ? SYMBOL_NATURAL_NAME (sym) : NULL, 0); + sym ? sym->natural_name () : NULL, 0); } } @@ -2250,7 +2249,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls) if (symbol_to_sal (&sal, state->funfirstline, sym.symbol) && maybe_add_address (state->addr_set, pspace, sal.pc)) add_sal_to_sals (state, &sals, &sal, - SYMBOL_NATURAL_NAME (sym.symbol), 0); + sym.symbol->natural_name (), 0); } } else if (ls->function_symbols != NULL || ls->minimal_symbols != NULL) @@ -2315,7 +2314,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls) if (symbol_to_sal (&sal, state->funfirstline, sym.symbol) && maybe_add_address (state->addr_set, pspace, sal.pc)) add_sal_to_sals (state, &sals, &sal, - SYMBOL_NATURAL_NAME (sym.symbol), 0); + sym.symbol->natural_name (), 0); } } } @@ -2903,7 +2902,7 @@ complete_label (completion_tracker &tracker, { for (const auto &label : *labels) { - char *match = xstrdup (SYMBOL_SEARCH_NAME (label.symbol)); + char *match = xstrdup (label.symbol->search_name ()); tracker.add_completion (gdb::unique_xmalloc_ptr (match)); } delete labels; @@ -4001,7 +4000,7 @@ find_label_symbols_in_block (const struct block *block, { if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), SYMBOL_DOMAIN (sym), LABEL_DOMAIN) - && cmp (SYMBOL_SEARCH_NAME (sym), name, name_len) == 0) + && cmp (sym->search_name (), name, name_len) == 0) { result->push_back ({sym, block}); label_funcs_ret->push_back ({fn_sym, block}); diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c index e81a9e56888..41cdc87f409 100644 --- a/gdb/m2-typeprint.c +++ b/gdb/m2-typeprint.c @@ -165,8 +165,8 @@ m2_print_typedef (struct type *type, struct symbol *new_symbol, fprintf_filtered (stream, "TYPE "); if (!TYPE_NAME (SYMBOL_TYPE (new_symbol)) || strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))), - SYMBOL_LINKAGE_NAME (new_symbol)) != 0) - fprintf_filtered (stream, "%s = ", SYMBOL_PRINT_NAME (new_symbol)); + new_symbol->linkage_name ()) != 0) + fprintf_filtered (stream, "%s = ", new_symbol->print_name ()); else fprintf_filtered (stream, " = "); type_print (type, "", stream, 0); diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 454929381d9..c58e40c94a0 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -541,7 +541,7 @@ mdebug_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch) if (regno < 0 || regno >= gdbarch_num_cooked_regs (gdbarch)) { reg_value_complaint (regno, gdbarch_num_cooked_regs (gdbarch), - SYMBOL_PRINT_NAME (sym)); + sym->print_name ()); regno = gdbarch_sp_regnum (gdbarch); /* Known safe, though useless. */ } @@ -646,7 +646,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, /* It is a FORTRAN common block. At least for SGI Fortran the address is not in the symbol; we need to fix it later in scan_file_globals. */ - int bucket = hashname (SYMBOL_LINKAGE_NAME (s)); + int bucket = hashname (s->linkage_name ()); SYMBOL_VALUE_CHAIN (s) = global_sym_chain[bucket]; global_sym_chain[bucket] = s; } @@ -1334,7 +1334,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, for anything except pointers or functions. */ } else - TYPE_NAME (SYMBOL_TYPE (s)) = SYMBOL_LINKAGE_NAME (s); + TYPE_NAME (SYMBOL_TYPE (s)) = s->linkage_name (); } break; @@ -4489,10 +4489,10 @@ mylookup_symbol (const char *name, const struct block *block, inc = name[0]; ALL_BLOCK_SYMBOLS (block, iter, sym) { - if (SYMBOL_LINKAGE_NAME (sym)[0] == inc + if (sym->linkage_name ()[0] == inc && SYMBOL_DOMAIN (sym) == domain && SYMBOL_CLASS (sym) == theclass - && strcmp (SYMBOL_LINKAGE_NAME (sym), name) == 0) + && strcmp (sym->linkage_name (), name) == 0) return sym; } diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 7a3ba476415..50843313f85 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -515,7 +515,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, string_file stb; - stb.puts (SYMBOL_PRINT_NAME (arg->sym)); + stb.puts (arg->sym->print_name ()); if (arg->entry_kind == print_entry_values_only) stb.puts ("@entry"); uiout->field_stream ("name", stb); @@ -634,7 +634,7 @@ list_args_or_locals (const frame_print_options &fp_opts, struct frame_arg arg, entryarg; if (SYMBOL_IS_ARGUMENT (sym)) - sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), + sym2 = lookup_symbol (sym->linkage_name (), block, VAR_DOMAIN, NULL).symbol; else diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index bd0626411d0..e2a6e800b55 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -537,8 +537,8 @@ compare_selectors (const void *a, const void *b) { const char *aname, *bname; - aname = SYMBOL_PRINT_NAME (*(struct symbol **) a); - bname = SYMBOL_PRINT_NAME (*(struct symbol **) b); + aname = (*(struct symbol **) a)->print_name (); + bname = (*(struct symbol **) b)->print_name (); if (aname == NULL || bname == NULL) error (_("internal: compare_selectors(1)")); @@ -675,7 +675,7 @@ info_selectors_command (const char *regexp, int from_tty) char *p = asel; QUIT; - name = SYMBOL_NATURAL_NAME (sym_arr[ix]); + name = sym_arr[ix]->natural_name (); name = strchr (name, ' ') + 1; if (p[0] && specialcmp(name, p) == 0) continue; /* Seen this one already (not unique). */ @@ -706,8 +706,8 @@ compare_classes (const void *a, const void *b) { const char *aname, *bname; - aname = SYMBOL_PRINT_NAME (*(struct symbol **) a); - bname = SYMBOL_PRINT_NAME (*(struct symbol **) b); + aname = (*(struct symbol **) a)->print_name (); + bname = (*(struct symbol **) b)->print_name (); if (aname == NULL || bname == NULL) error (_("internal: compare_classes(1)")); @@ -809,7 +809,7 @@ info_classes_command (const char *regexp, int from_tty) char *p = aclass; QUIT; - name = SYMBOL_NATURAL_NAME (sym_arr[ix]); + name = sym_arr[ix]->natural_name (); name += 2; if (p[0] && specialcmp(name, p) == 0) continue; /* Seen this one already (not unique). */ @@ -1145,7 +1145,7 @@ find_imps (const char *method, std::vector *symbol_names) 0).symbol; if (sym != NULL) - symbol_names->push_back (SYMBOL_NATURAL_NAME (sym)); + symbol_names->push_back (sym->natural_name ()); else { struct bound_minimal_symbol msym diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index da30d4a3ac2..f501aad549b 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -99,7 +99,7 @@ pascal_print_typedef (struct type *type, struct symbol *new_symbol, { type = check_typedef (type); fprintf_filtered (stream, "type "); - fprintf_filtered (stream, "%s = ", SYMBOL_PRINT_NAME (new_symbol)); + fprintf_filtered (stream, "%s = ", new_symbol->print_name ()); type_print (type, "", stream, 0); fprintf_filtered (stream, ";"); } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index bf61d590381..fe0efd371a5 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -628,9 +628,9 @@ build_address_symbolic (struct gdbarch *gdbarch, name_location = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (symbol)); if (do_demangle || asm_demangle) - name_temp = SYMBOL_PRINT_NAME (symbol); + name_temp = symbol->print_name (); else - name_temp = SYMBOL_LINKAGE_NAME (symbol); + name_temp = symbol->linkage_name (); } if (msymbol.minsym != NULL @@ -1472,7 +1472,7 @@ info_address_command (const char *exp, int from_tty) } printf_filtered ("Symbol \""); - fprintf_symbol_filtered (gdb_stdout, SYMBOL_PRINT_NAME (sym), + fprintf_symbol_filtered (gdb_stdout, sym->print_name (), current_language->la_language, DMGL_ANSI); printf_filtered ("\" is "); val = SYMBOL_VALUE (sym); @@ -1592,7 +1592,7 @@ info_address_command (const char *exp, int from_tty) { struct bound_minimal_symbol msym; - msym = lookup_bound_minimal_symbol (SYMBOL_LINKAGE_NAME (sym)); + msym = lookup_bound_minimal_symbol (sym->linkage_name ()); if (msym.minsym == NULL) printf_filtered ("unresolved"); else @@ -2214,7 +2214,7 @@ print_variable_and_value (const char *name, struct symbol *var, { if (!name) - name = SYMBOL_PRINT_NAME (var); + name = var->print_name (); fprintf_filtered (stream, "%s%ps = ", n_spaces (2 * indent), styled_string (variable_name_style.style (), name)); diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index 3ef5b6a488d..8e38d8d7a45 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -103,7 +103,7 @@ extract_sym (PyObject *obj, gdb::unique_xmalloc_ptr *name, /* Duplicate the symbol name, so the caller has consistency in garbage collection. */ - name->reset (xstrdup (SYMBOL_PRINT_NAME (*sym))); + name->reset (xstrdup ((*sym)->print_name ())); /* If a symbol is specified attempt to determine the language from the symbol. If mode is not "auto", then the language @@ -348,14 +348,14 @@ py_print_single_arg (struct ui_out *out, { string_file stb; - fprintf_symbol_filtered (&stb, SYMBOL_PRINT_NAME (fa->sym), + fprintf_symbol_filtered (&stb, fa->sym->print_name (), SYMBOL_LANGUAGE (fa->sym), DMGL_PARAMS | DMGL_ANSI); if (fa->entry_kind == print_entry_values_compact) { stb.puts ("="); - fprintf_symbol_filtered (&stb, SYMBOL_PRINT_NAME (fa->sym), + fprintf_symbol_filtered (&stb, fa->sym->print_name (), SYMBOL_LANGUAGE (fa->sym), DMGL_PARAMS | DMGL_ANSI); } diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index b112ce115f1..e79fbd06d28 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -60,7 +60,7 @@ sympy_str (PyObject *self) SYMPY_REQUIRE_VALID (self, symbol); - result = PyString_FromString (SYMBOL_PRINT_NAME (symbol)); + result = PyString_FromString (symbol->print_name ()); return result; } @@ -101,7 +101,7 @@ sympy_get_name (PyObject *self, void *closure) SYMPY_REQUIRE_VALID (self, symbol); - return PyString_FromString (SYMBOL_NATURAL_NAME (symbol)); + return PyString_FromString (symbol->natural_name ()); } static PyObject * @@ -111,7 +111,7 @@ sympy_get_linkage_name (PyObject *self, void *closure) SYMPY_REQUIRE_VALID (self, symbol); - return PyString_FromString (SYMBOL_LINKAGE_NAME (symbol)); + return PyString_FromString (symbol->linkage_name ()); } static PyObject * diff --git a/gdb/python/python.c b/gdb/python/python.c index 609e1fbf0a7..7b561a1c35f 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -791,7 +791,7 @@ gdbpy_rbreak (PyObject *self, PyObject *args, PyObject *kw) symbol_name = fullname; symbol_name += ":"; - symbol_name += SYMBOL_LINKAGE_NAME (p.symbol); + symbol_name += p.symbol->linkage_name (); } else symbol_name = p.msymbol.minsym->linkage_name (); diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 04bd09ae9ce..459d0da8402 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1115,7 +1115,7 @@ btrace_get_bfun_name (const struct btrace_function *bfun) sym = bfun->sym; if (sym != NULL) - return SYMBOL_PRINT_NAME (sym); + return sym->print_name (); else if (msym != NULL) return msym->print_name (); else @@ -1175,7 +1175,7 @@ btrace_call_history (struct ui_out *uiout, } if (sym != NULL) - uiout->field_string ("function", SYMBOL_PRINT_NAME (sym), + uiout->field_string ("function", sym->print_name (), function_name_style.style ()); else if (msym != NULL) uiout->field_string ("function", msym->print_name (), diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index b872a2dbf1c..f9adb5d07cc 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -829,7 +829,7 @@ rust_print_typedef (struct type *type, struct ui_file *stream) { type = check_typedef (type); - fprintf_filtered (stream, "type %s = ", SYMBOL_PRINT_NAME (new_symbol)); + fprintf_filtered (stream, "type %s = ", new_symbol->print_name ()); type_print (type, "", stream, 0); fprintf_filtered (stream, ";"); } diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 08fa5768676..13d14122e5f 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -959,7 +959,7 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point) if (sym == 0) name = 0; else - name = SYMBOL_LINKAGE_NAME (sym); + name = sym->linkage_name (); /* Check the main executable. */ addr = find_canonical_descriptor_in_load_object diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 0fde12080fe..6ec9f971e16 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -629,7 +629,7 @@ stab_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch) if (regno < 0 || regno >= gdbarch_num_cooked_regs (gdbarch)) { reg_value_complaint (regno, gdbarch_num_cooked_regs (gdbarch), - SYMBOL_PRINT_NAME (sym)); + sym->print_name ()); regno = gdbarch_sp_regnum (gdbarch); /* Known safe, though useless. */ } @@ -1039,9 +1039,9 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, Symbol references don't have valid names and wont't match up with minimal symbols when the global_sym_chain is relocated. We'll fixup symbol references when we fixup the defining symbol. */ - if (SYMBOL_LINKAGE_NAME (sym) && SYMBOL_LINKAGE_NAME (sym)[0] != '#') + if (sym->linkage_name () && sym->linkage_name ()[0] != '#') { - i = hashname (SYMBOL_LINKAGE_NAME (sym)); + i = hashname (sym->linkage_name ()); SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i]; global_sym_chain[i] = sym; } @@ -1142,8 +1142,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, the same name to represent an argument passed in a register. GCC uses 'P' for the same case. So if we find such a symbol pair we combine it into one 'P' symbol. - For Sun cc we need to do this regardless of - stabs_argument_has_addr, because the compiler puts out + For Sun cc we need to do this regardless of stabs_argument_has_addr, because the compiler puts out the 'p' symbol even if it never saves the argument onto the stack. @@ -1168,8 +1167,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, prev_sym = local_symbols->symbol[local_symbols->nsyms - 1]; if ((SYMBOL_CLASS (prev_sym) == LOC_REF_ARG || SYMBOL_CLASS (prev_sym) == LOC_ARG) - && strcmp (SYMBOL_LINKAGE_NAME (prev_sym), - SYMBOL_LINKAGE_NAME (sym)) == 0) + && strcmp (prev_sym->linkage_name (), + sym->linkage_name ()) == 0) { SYMBOL_ACLASS_INDEX (prev_sym) = stab_register_index; /* Use the type from the LOC_REGISTER; that is the type @@ -1192,18 +1191,16 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; SET_SYMBOL_VALUE_ADDRESS (sym, valu); if (gdbarch_static_transform_name_p (gdbarch) - && gdbarch_static_transform_name (gdbarch, - SYMBOL_LINKAGE_NAME (sym)) - != SYMBOL_LINKAGE_NAME (sym)) + && gdbarch_static_transform_name (gdbarch, sym->linkage_name ()) + != sym->linkage_name ()) { struct bound_minimal_symbol msym; - msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), - NULL, objfile); + msym = lookup_minimal_symbol (sym->linkage_name (), NULL, objfile); if (msym.minsym != NULL) { const char *new_name = gdbarch_static_transform_name - (gdbarch, SYMBOL_LINKAGE_NAME (sym)); + (gdbarch, sym->linkage_name ()); SYMBOL_SET_LINKAGE_NAME (sym, new_name); SET_SYMBOL_VALUE_ADDRESS (sym, @@ -1262,7 +1259,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, if (TYPE_NAME (SYMBOL_TYPE (sym)) == NULL) { if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR - && strcmp (SYMBOL_LINKAGE_NAME (sym), vtbl_ptr_name)) + && strcmp (sym->linkage_name (), vtbl_ptr_name)) || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC) { /* If we are giving a name to a type such as "pointer to @@ -1303,11 +1300,11 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* Pascal accepts names for pointer types. */ if (get_current_subfile ()->language == language_pascal) { - TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_LINKAGE_NAME (sym); + TYPE_NAME (SYMBOL_TYPE (sym)) = sym->linkage_name (); } } else - TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_LINKAGE_NAME (sym); + TYPE_NAME (SYMBOL_TYPE (sym)) = sym->linkage_name (); } add_symbol_to_list (sym, get_file_symbols ()); @@ -1323,8 +1320,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN; if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) TYPE_NAME (SYMBOL_TYPE (sym)) - = obconcat (&objfile->objfile_obstack, - SYMBOL_LINKAGE_NAME (sym), + = obconcat (&objfile->objfile_obstack, sym->linkage_name (), (char *) NULL); add_symbol_to_list (struct_sym, get_file_symbols ()); } @@ -1351,8 +1347,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) TYPE_NAME (SYMBOL_TYPE (sym)) - = obconcat (&objfile->objfile_obstack, - SYMBOL_LINKAGE_NAME (sym), + = obconcat (&objfile->objfile_obstack, sym->linkage_name (), (char *) NULL); add_symbol_to_list (sym, get_file_symbols ()); @@ -1367,8 +1362,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) TYPE_NAME (SYMBOL_TYPE (sym)) - = obconcat (&objfile->objfile_obstack, - SYMBOL_LINKAGE_NAME (sym), + = obconcat (&objfile->objfile_obstack, sym->linkage_name (), (char *) NULL); add_symbol_to_list (typedef_sym, get_file_symbols ()); } @@ -1380,18 +1374,16 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; SET_SYMBOL_VALUE_ADDRESS (sym, valu); if (gdbarch_static_transform_name_p (gdbarch) - && gdbarch_static_transform_name (gdbarch, - SYMBOL_LINKAGE_NAME (sym)) - != SYMBOL_LINKAGE_NAME (sym)) + && gdbarch_static_transform_name (gdbarch, sym->linkage_name ()) + != sym->linkage_name ()) { struct bound_minimal_symbol msym; - msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), - NULL, objfile); + msym = lookup_minimal_symbol (sym->linkage_name (), NULL, objfile); if (msym.minsym != NULL) { const char *new_name = gdbarch_static_transform_name - (gdbarch, SYMBOL_LINKAGE_NAME (sym)); + (gdbarch, sym->linkage_name ()); SYMBOL_SET_LINKAGE_NAME (sym, new_name); SET_SYMBOL_VALUE_ADDRESS (sym, BMSYMBOL_VALUE_ADDRESS (msym)); @@ -1684,7 +1676,7 @@ again: if (SYMBOL_CLASS (sym) == LOC_TYPEDEF && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN && (TYPE_CODE (SYMBOL_TYPE (sym)) == code) - && strcmp (SYMBOL_LINKAGE_NAME (sym), type_name) == 0) + && strcmp (sym->linkage_name (), type_name) == 0) { obstack_free (&objfile->objfile_obstack, type_name); type = SYMBOL_TYPE (sym); @@ -3692,7 +3684,7 @@ read_enum_type (const char **pp, struct type *type, struct symbol *xsym = syms->symbol[j]; SYMBOL_TYPE (xsym) = type; - TYPE_FIELD_NAME (type, n) = SYMBOL_LINKAGE_NAME (xsym); + TYPE_FIELD_NAME (type, n) = xsym->linkage_name (); SET_FIELD_ENUMVAL (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym)); TYPE_FIELD_BITSIZE (type, n) = 0; } @@ -4341,7 +4333,7 @@ common_block_end (struct objfile *objfile) /* Should we be putting local_symbols back to what it was? Does it matter? */ - i = hashname (SYMBOL_LINKAGE_NAME (sym)); + i = hashname (sym->linkage_name ()); SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i]; global_sym_chain[i] = sym; common_block_name = NULL; @@ -4527,8 +4519,7 @@ cleanup_undefined_types_1 (void) TYPE_CODE (*type)) && (TYPE_INSTANCE_FLAGS (*type) == TYPE_INSTANCE_FLAGS (SYMBOL_TYPE (sym))) - && strcmp (SYMBOL_LINKAGE_NAME (sym), - type_name) == 0) + && strcmp (sym->linkage_name (), type_name) == 0) replace_type (*type, SYMBOL_TYPE (sym)); } } @@ -4614,8 +4605,7 @@ scan_file_globals (struct objfile *objfile) for (sym = global_sym_chain[hash]; sym;) { - if (strcmp (msymbol->linkage_name (), - SYMBOL_LINKAGE_NAME (sym)) == 0) + if (strcmp (msymbol->linkage_name (), sym->linkage_name ()) == 0) { /* Splice this symbol out of the hash chain and assign the value we have to it. */ @@ -4689,7 +4679,7 @@ scan_file_globals (struct objfile *objfile) else complaint (_("%s: common block `%s' from " "global_sym_chain unresolved"), - objfile_name (objfile), SYMBOL_PRINT_NAME (prev)); + objfile_name (objfile), prev->print_name ()); } } memset (global_sym_chain, 0, sizeof (global_sym_chain)); diff --git a/gdb/stack.c b/gdb/stack.c index 0568e704f48..5099f613666 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -427,7 +427,7 @@ print_frame_arg (const frame_print_options &fp_opts, annotate_arg_emitter arg_emitter; ui_out_emit_tuple tuple_emitter (uiout, NULL); - fprintf_symbol_filtered (&stb, SYMBOL_PRINT_NAME (arg->sym), + fprintf_symbol_filtered (&stb, arg->sym->print_name (), SYMBOL_LANGUAGE (arg->sym), DMGL_PARAMS | DMGL_ANSI); if (arg->entry_kind == print_entry_values_compact) { @@ -435,7 +435,7 @@ print_frame_arg (const frame_print_options &fp_opts, PRINT_ENTRY_VALUE_COMPACT we never use MI. */ stb.puts ("="); - fprintf_symbol_filtered (&stb, SYMBOL_PRINT_NAME (arg->sym), + fprintf_symbol_filtered (&stb, arg->sym->print_name (), SYMBOL_LANGUAGE (arg->sym), DMGL_PARAMS | DMGL_ANSI); } @@ -817,11 +817,11 @@ print_frame_args (const frame_print_options &fp_opts, parameter names occur on the RS/6000, for traceback tables. FIXME, should we even print them? */ - if (*SYMBOL_LINKAGE_NAME (sym)) + if (*sym->linkage_name ()) { struct symbol *nsym; - nsym = lookup_symbol_search_name (SYMBOL_SEARCH_NAME (sym), + nsym = lookup_symbol_search_name (sym->search_name (), b, VAR_DOMAIN).symbol; gdb_assert (nsym != NULL); if (SYMBOL_CLASS (nsym) == LOC_REGISTER @@ -1259,14 +1259,14 @@ find_frame_funname (struct frame_info *frame, enum language *funlang, func = get_frame_function (frame); if (func) { - const char *print_name = SYMBOL_PRINT_NAME (func); + const char *print_name = func->print_name (); *funlang = SYMBOL_LANGUAGE (func); if (funcp) *funcp = func; if (*funlang == language_cplus) { - /* It seems appropriate to use SYMBOL_PRINT_NAME() here, + /* It seems appropriate to use print_name() here, to display the demangled name that we already have stored in the symbol table, but we stored a version with DMGL_PARAMS turned on, and here we don't want to @@ -1494,11 +1494,11 @@ info_frame_command_core (struct frame_info *fi, bool selected_frame_p) gdb::unique_xmalloc_ptr func_only; if (func) { - funname = SYMBOL_PRINT_NAME (func); + funname = func->print_name (); funlang = SYMBOL_LANGUAGE (func); if (funlang == language_cplus) { - /* It seems appropriate to use SYMBOL_PRINT_NAME() here, + /* It seems appropriate to use print_name() here, to display the demangled name that we already have stored in the symbol table, but we stored a version with DMGL_PARAMS turned on, and here we don't want to @@ -2246,7 +2246,7 @@ iterate_over_block_locals (const struct block *b, break; if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN) break; - (*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data); + (*cb) (sym->print_name (), sym, cb_data); break; default: @@ -2276,7 +2276,7 @@ print_block_frame_labels (struct gdbarch *gdbarch, struct block *b, ALL_BLOCK_SYMBOLS (b, iter, sym) { - if (strcmp (SYMBOL_LINKAGE_NAME (sym), "default") == 0) + if (strcmp (sym->linkage_name (), "default") == 0) { if (*have_default) continue; @@ -2289,7 +2289,7 @@ print_block_frame_labels (struct gdbarch *gdbarch, struct block *b, sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym), 0); values_printed = 1; - fputs_filtered (SYMBOL_PRINT_NAME (sym), stream); + fputs_filtered (sym->print_name (), stream); get_user_print_options (&opts); if (opts.addressprint) { @@ -2351,8 +2351,7 @@ do_print_variable_and_value (const char *print_name, struct frame_info *frame; if (p->preg.has_value () - && p->preg->exec (SYMBOL_NATURAL_NAME (sym), 0, - NULL, 0) != 0) + && p->preg->exec (sym->natural_name (), 0, NULL, 0) != 0) return; if (p->treg.has_value () && !treg_matches_sym_type_name (*p->treg, sym)) @@ -2554,9 +2553,9 @@ iterate_over_block_arg_vars (const struct block *b, float). There are also LOC_ARG/LOC_REGISTER pairs which are not combined in symbol-reading. */ - sym2 = lookup_symbol_search_name (SYMBOL_SEARCH_NAME (sym), + sym2 = lookup_symbol_search_name (sym->search_name (), b, VAR_DOMAIN).symbol; - (*cb) (SYMBOL_PRINT_NAME (sym), sym2, cb_data); + (*cb) (sym->print_name (), sym2, cb_data); } } } @@ -2856,7 +2855,7 @@ return_command (const char *retval_exp, int from_tty) if (TYPE_NO_RETURN (thisfun->type)) warning (_("Function does not return normally to caller.")); confirmed = query (_("%sMake %s return now? "), query_prefix, - SYMBOL_PRINT_NAME (thisfun)); + thisfun->print_name ()); } if (!confirmed) error (_("Not confirmed")); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index bf48435bff2..69d035dc843 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -339,11 +339,11 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) if (BLOCK_FUNCTION (b)) { fprintf_filtered (outfile, ", function %s", - SYMBOL_LINKAGE_NAME (BLOCK_FUNCTION (b))); - if (SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b)) != NULL) + BLOCK_FUNCTION (b)->linkage_name ()); + if (BLOCK_FUNCTION (b)->demangled_name () != NULL) { fprintf_filtered (outfile, ", %s", - SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b))); + BLOCK_FUNCTION (b)->demangled_name ()); } } fprintf_filtered (outfile, "\n"); @@ -523,7 +523,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, print_spaces (depth, outfile); if (SYMBOL_DOMAIN (symbol) == LABEL_DOMAIN) { - fprintf_filtered (outfile, "label %s at ", SYMBOL_PRINT_NAME (symbol)); + fprintf_filtered (outfile, "label %s at ", symbol->print_name ()); fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)), outfile); if (section) @@ -548,7 +548,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, ? "enum" : (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_STRUCT ? "struct" : "union")), - SYMBOL_LINKAGE_NAME (symbol)); + symbol->linkage_name ()); LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth, &type_print_raw_options); } @@ -561,7 +561,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, if (SYMBOL_TYPE (symbol)) { /* Print details of types, except for enums where it's clutter. */ - LA_PRINT_TYPE (SYMBOL_TYPE (symbol), SYMBOL_PRINT_NAME (symbol), + LA_PRINT_TYPE (SYMBOL_TYPE (symbol), symbol->print_name (), outfile, TYPE_CODE (SYMBOL_TYPE (symbol)) != TYPE_CODE_ENUM, depth, @@ -569,7 +569,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, fprintf_filtered (outfile, "; "); } else - fprintf_filtered (outfile, "%s ", SYMBOL_PRINT_NAME (symbol)); + fprintf_filtered (outfile, "%s ", symbol->print_name ()); switch (SYMBOL_CLASS (symbol)) { diff --git a/gdb/symtab.c b/gdb/symtab.c index 92e8dcdf50c..2e8ae2383ed 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1151,7 +1151,7 @@ eq_symbol_entry (const struct symbol_cache_slot *slot, } else { - slot_name = SYMBOL_SEARCH_NAME (slot->value.found.symbol); + slot_name = slot->value.found.symbol->search_name (); slot_domain = SYMBOL_DOMAIN (slot->value.found.symbol); } @@ -1168,7 +1168,7 @@ eq_symbol_entry (const struct symbol_cache_slot *slot, /* It's important that we use the same comparison that was done the first time through. If the slot records a found symbol, then this means using the symbol name comparison function of - the symbol's language with SYMBOL_SEARCH_NAME. See + the symbol's language with symbol->search_name (). See dictionary.c. It also means using symbol_matches_domain for found symbols. See block.c. @@ -1517,7 +1517,7 @@ symbol_cache_dump (const struct symbol_cache *cache) printf_filtered (" [%4u] = %s, %s %s\n", i, host_address_to_string (context), - SYMBOL_PRINT_NAME (found), + found->print_name (), domain_name (SYMBOL_DOMAIN (found))); break; } @@ -1950,7 +1950,7 @@ lookup_language_this (const struct language_defn *lang, if (symbol_lookup_debug > 1) { fprintf_unfiltered (gdb_stdlog, " = %s (%s, block %s)\n", - SYMBOL_PRINT_NAME (sym), + sym->print_name (), host_address_to_string (sym), host_address_to_string (block)); } @@ -3136,7 +3136,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) * but the "break" still works, and the warning is annoying. * So I commented out the warning. RT */ /* warning ("In stub for %s; unable to find real function/line info", - SYMBOL_LINKAGE_NAME (msymbol)); */ + msymbol->linkage_name ()); */ ; /* fall through */ else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) @@ -3144,7 +3144,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) /* Avoid infinite recursion */ /* See above comment about why warning is commented out. */ /* warning ("In stub for %s; unable to find real function/line info", - SYMBOL_LINKAGE_NAME (msymbol)); */ + msymbol->linkage_name ()); */ ; /* fall through */ else @@ -3715,7 +3715,7 @@ skip_prologue_sal (struct symtab_and_line *sal) objfile = symbol_objfile (sym); pc = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)); section = SYMBOL_OBJ_SECTION (objfile, sym); - name = SYMBOL_LINKAGE_NAME (sym); + name = sym->linkage_name (); } else { @@ -4384,8 +4384,7 @@ symbol_search::compare_search_syms (const symbol_search &sym_a, if (sym_a.block != sym_b.block) return sym_a.block - sym_b.block; - return strcmp (SYMBOL_PRINT_NAME (sym_a.symbol), - SYMBOL_PRINT_NAME (sym_b.symbol)); + return strcmp (sym_a.symbol->print_name (), sym_b.symbol->print_name ()); } /* Returns true if the type_name of symbol_type of SYM matches TREG. @@ -4402,7 +4401,7 @@ treg_matches_sym_type_name (const compiled_regex &treg, { fprintf_unfiltered (gdb_stdlog, "treg_matches_sym_type_name\n sym %s\n", - SYMBOL_NATURAL_NAME (sym)); + sym->natural_name ()); } sym_type = SYMBOL_TYPE (sym); @@ -4639,7 +4638,7 @@ search_symbols (const char *regexp, enum search_domain kind, && file_matches (symtab_to_fullname (real_symtab), files, nfiles, 0))) && ((!preg.has_value () - || preg->exec (SYMBOL_NATURAL_NAME (sym), 0, + || preg->exec (sym->natural_name (), 0, NULL, 0) == 0) && ((kind == VARIABLES_DOMAIN && SYMBOL_CLASS (sym) != LOC_TYPEDEF @@ -4787,7 +4786,7 @@ print_symbol_info (enum search_domain kind, { type_print (SYMBOL_TYPE (sym), (SYMBOL_CLASS (sym) == LOC_TYPEDEF - ? "" : SYMBOL_PRINT_NAME (sym)), + ? "" : sym->print_name ()), gdb_stdout, 0); printf_filtered (";\n"); @@ -4796,7 +4795,7 @@ print_symbol_info (enum search_domain kind, point we might want a language specific method to print the module symbol so that we can customise the output more. */ else if (kind == MODULES_DOMAIN) - printf_filtered ("%s\n", SYMBOL_PRINT_NAME (sym)); + printf_filtered ("%s\n", sym->print_name ()); } /* This help function for symtab_symbol_info() prints information @@ -5128,7 +5127,7 @@ rbreak_command (const char *regexp, int from_tty) const char *fullname = symtab_to_fullname (symtab); string = string_printf ("%s:'%s'", fullname, - SYMBOL_LINKAGE_NAME (p.symbol)); + p.symbol->linkage_name ()); break_command (&string[0], from_tty); print_symbol_info (FUNCTIONS_DOMAIN, p.symbol, p.block, NULL); } @@ -5209,7 +5208,7 @@ completion_list_add_symbol (completion_tracker &tracker, const char *text, const char *word) { completion_list_add_name (tracker, SYMBOL_LANGUAGE (sym), - SYMBOL_NATURAL_NAME (sym), + sym->natural_name (), lookup_name, text, word); } @@ -5401,7 +5400,7 @@ find_gnu_ifunc (const symbol *sym) if (SYMBOL_CLASS (sym) != LOC_BLOCK) return {}; - lookup_name_info lookup_name (SYMBOL_SEARCH_NAME (sym), + lookup_name_info lookup_name (sym->search_name (), symbol_name_match_type::SEARCH_NAME); struct objfile *objfile = symbol_objfile (sym); @@ -6291,7 +6290,7 @@ get_symbol_address (const struct symbol *sym) gdb_assert (sym->maybe_copied); gdb_assert (SYMBOL_CLASS (sym) == LOC_STATIC); - const char *linkage_name = SYMBOL_LINKAGE_NAME (sym); + const char *linkage_name = sym->linkage_name (); for (objfile *objfile : current_program_space->objfiles ()) { @@ -6372,7 +6371,7 @@ search_module_symbols (const char *module_regexp, const char *regexp, /* This is a module. */ gdb_assert (p.symbol != nullptr); - std::string prefix = SYMBOL_PRINT_NAME (p.symbol); + std::string prefix = p.symbol->print_name (); prefix += "::"; for (const symbol_search &q : symbols) @@ -6380,7 +6379,7 @@ search_module_symbols (const char *module_regexp, const char *regexp, if (q.symbol == nullptr) continue; - if (strncmp (SYMBOL_PRINT_NAME (q.symbol), prefix.c_str (), + if (strncmp (q.symbol->print_name (), prefix.c_str (), prefix.size ()) != 0) continue; @@ -6523,8 +6522,7 @@ info_module_subcommand (bool quiet, const char *module_regexp, if (last_module_symbol != p.symbol) { printf_filtered ("\n"); - printf_filtered (_("Module \"%s\":\n"), - SYMBOL_PRINT_NAME (p.symbol)); + printf_filtered (_("Module \"%s\":\n"), p.symbol->print_name ()); last_module_symbol = p.symbol; last_filename = ""; } diff --git a/gdb/symtab.h b/gdb/symtab.h index 3eb9c0e1d27..897ffda76e2 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -67,7 +67,7 @@ enum class symbol_name_match_type /* Search name matching. This is like FULL, but the search name did not come from the user; instead it is already a search name - retrieved from a SYMBOL_SEARCH_NAME/search_name () call. + retrieved from a search_name () call. For Ada, this avoids re-encoding an already-encoded search name (which would potentially incorrectly lowercase letters in the linkage/search name that should remain uppercase). For C++, it @@ -546,43 +546,6 @@ extern void symbol_set_names (struct general_symbol_info *symbol, gdb::string_view linkage_name, bool copy_name, struct objfile_per_bfd_storage *per_bfd); -/* Now come lots of name accessor macros. Short version as to when to - use which: Use SYMBOL_NATURAL_NAME to refer to the name of the - symbol in the original source code. Use SYMBOL_LINKAGE_NAME if you - want to know what the linker thinks the symbol's name is. Use - SYMBOL_PRINT_NAME for output. Use SYMBOL_DEMANGLED_NAME if you - specifically need to know whether SYMBOL_NATURAL_NAME and - SYMBOL_LINKAGE_NAME are different. */ - -#define SYMBOL_NATURAL_NAME(symbol) \ - ((symbol)->natural_name ()) - -/* Return SYMBOL's name from the point of view of the linker. In - languages like C++ where symbols may be mangled for ease of - manipulation by the linker, this is the mangled name; otherwise, - it's the same as SYMBOL_NATURAL_NAME. */ - -#define SYMBOL_LINKAGE_NAME(symbol) (symbol)->name - -#define SYMBOL_DEMANGLED_NAME(symbol) \ - ((symbol)->demangled_name ()) - -/* Macro that returns a version of the name of a symbol that is - suitable for output. In C++ this is the "demangled" form of the - name if demangle is on and the "mangled" form of the name if - demangle is off. In other languages this is just the symbol name. - The result should never be NULL. Don't use this for internal - purposes (e.g. storing in a hashtable): it's only suitable for output. - - N.B. symbol may be anything inheriting from general_symbol_info, - e.g., struct symbol or struct minimal_symbol. */ - -#define SYMBOL_PRINT_NAME(symbol) \ - (demangle ? SYMBOL_NATURAL_NAME (symbol) : SYMBOL_LINKAGE_NAME (symbol)) - -#define SYMBOL_SEARCH_NAME(symbol) \ - ((symbol)->search_name ()) - /* Return true if NAME matches the "search" name of SYMBOL, according to the symbol's language. */ #define SYMBOL_MATCHES_SEARCH_NAME(symbol, name) \ @@ -1640,8 +1603,7 @@ extern struct block_symbol lookup_symbol (const char *, DOMAIN, visible from lexical block BLOCK if non-NULL or from global/static blocks if BLOCK is NULL. The passed-in search name should not come from the user; instead it should already be a - search name as retrieved from a - SYMBOL_SEARCH_NAME/search_name () call. See definition of + search name as retrieved from a search_name () call. See definition of symbol_name_match_type::SEARCH_NAME. Returns the struct symbol pointer, or NULL if no symbol is found. The symbol's section is fixed up if necessary. */ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index d62783932b3..8e04cad504e 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -236,11 +236,11 @@ set_traceframe_context (struct frame_info *trace_frame) /* Save func name as "$trace_func", a debugger variable visible to users. */ if (traceframe_fun == NULL - || SYMBOL_LINKAGE_NAME (traceframe_fun) == NULL) + || traceframe_fun->linkage_name () == NULL) clear_internalvar (lookup_internalvar ("trace_func")); else set_internalvar_string (lookup_internalvar ("trace_func"), - SYMBOL_LINKAGE_NAME (traceframe_fun)); + traceframe_fun->linkage_name ()); /* Save file name as "$trace_file", a debugger variable visible to users. */ @@ -693,7 +693,7 @@ validate_actionline (const char *line, struct breakpoint *b) { error (_("constant `%s' (value %s) " "will not be collected."), - SYMBOL_PRINT_NAME (exp->elts[2].symbol), + exp->elts[2].symbol->print_name (), plongest (SYMBOL_VALUE (exp->elts[2].symbol))); } else if (SYMBOL_CLASS (exp->elts[2].symbol) @@ -701,7 +701,7 @@ validate_actionline (const char *line, struct breakpoint *b) { error (_("`%s' is optimized away " "and cannot be collected."), - SYMBOL_PRINT_NAME (exp->elts[2].symbol)); + exp->elts[2].symbol->print_name ()); } } @@ -926,19 +926,18 @@ collection_list::collect_symbol (struct symbol *sym, { default: printf_filtered ("%s: don't know symbol class %d\n", - SYMBOL_PRINT_NAME (sym), - SYMBOL_CLASS (sym)); + sym->print_name (), SYMBOL_CLASS (sym)); break; case LOC_CONST: printf_filtered ("constant %s (value %s) will not be collected.\n", - SYMBOL_PRINT_NAME (sym), plongest (SYMBOL_VALUE (sym))); + sym->print_name (), plongest (SYMBOL_VALUE (sym))); break; case LOC_STATIC: offset = SYMBOL_VALUE_ADDRESS (sym); if (info_verbose) { printf_filtered ("LOC_STATIC %s: collect %ld bytes at %s.\n", - SYMBOL_PRINT_NAME (sym), len, + sym->print_name (), len, paddress (gdbarch, offset)); } /* A struct may be a C++ class with static fields, go to general @@ -951,8 +950,7 @@ collection_list::collect_symbol (struct symbol *sym, case LOC_REGISTER: reg = SYMBOL_REGISTER_OPS (sym)->register_number (sym, gdbarch); if (info_verbose) - printf_filtered ("LOC_REG[parm] %s: ", - SYMBOL_PRINT_NAME (sym)); + printf_filtered ("LOC_REG[parm] %s: ", sym->print_name ()); add_local_register (gdbarch, reg, scope); /* Check for doubles stored in two registers. */ /* FIXME: how about larger types stored in 3 or more regs? */ @@ -962,8 +960,7 @@ collection_list::collect_symbol (struct symbol *sym, break; case LOC_REF_ARG: printf_filtered ("Sorry, don't know how to do LOC_REF_ARG yet.\n"); - printf_filtered (" (will not collect %s)\n", - SYMBOL_PRINT_NAME (sym)); + printf_filtered (" (will not collect %s)\n", sym->print_name ()); break; case LOC_ARG: reg = frame_regno; @@ -971,8 +968,7 @@ collection_list::collect_symbol (struct symbol *sym, if (info_verbose) { printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset %s" - " from frame ptr reg %d\n", - SYMBOL_PRINT_NAME (sym), len, + " from frame ptr reg %d\n", sym->print_name (), len, paddress (gdbarch, offset), reg); } add_memrange (gdbarch, reg, offset, len, scope); @@ -983,8 +979,7 @@ collection_list::collect_symbol (struct symbol *sym, if (info_verbose) { printf_filtered ("LOC_REGPARM_ADDR %s: Collect %ld bytes at offset %s" - " from reg %d\n", - SYMBOL_PRINT_NAME (sym), len, + " from reg %d\n", sym->print_name (), len, paddress (gdbarch, offset), reg); } add_memrange (gdbarch, reg, offset, len, scope); @@ -995,8 +990,7 @@ collection_list::collect_symbol (struct symbol *sym, if (info_verbose) { printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset %s" - " from frame ptr reg %d\n", - SYMBOL_PRINT_NAME (sym), len, + " from frame ptr reg %d\n", sym->print_name (), len, paddress (gdbarch, offset), reg); } add_memrange (gdbarch, reg, offset, len, scope); @@ -1008,7 +1002,7 @@ collection_list::collect_symbol (struct symbol *sym, case LOC_OPTIMIZED_OUT: printf_filtered ("%s has been optimized out of existence.\n", - SYMBOL_PRINT_NAME (sym)); + sym->print_name ()); break; case LOC_COMPUTED: @@ -1028,7 +1022,7 @@ collection_list::collect_symbol (struct symbol *sym, if (!aexpr) { printf_filtered ("%s has been optimized out of existence.\n", - SYMBOL_PRINT_NAME (sym)); + sym->print_name ()); return; } @@ -1424,7 +1418,7 @@ encode_actions_1 (struct command_line *action, case OP_VAR_VALUE: { struct symbol *sym = exp->elts[2].symbol; - const char *name = SYMBOL_NATURAL_NAME (sym); + const char *name = sym->natural_name (); collect->collect_symbol (exp->elts[2].symbol, target_gdbarch (), @@ -2526,7 +2520,7 @@ info_scope_command (const char *args_in, int from_tty) printf_filtered ("Scope for %s:\n", save_args); count++; - symname = SYMBOL_PRINT_NAME (sym); + symname = sym->print_name (); if (symname == NULL || *symname == '\0') continue; /* Probably botched, certainly useless. */ @@ -2616,7 +2610,7 @@ info_scope_command (const char *args_in, int from_tty) paddress (gdbarch, BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)))); break; case LOC_UNRESOLVED: - msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), + msym = lookup_minimal_symbol (sym->linkage_name (), NULL, NULL); if (msym.minsym == NULL) printf_filtered ("Unresolved Static"); @@ -3689,7 +3683,7 @@ print_one_static_tracepoint_marker (int count, if (sym) { uiout->text ("in "); - uiout->field_string ("func", SYMBOL_PRINT_NAME (sym), + uiout->field_string ("func", sym->print_name (), function_name_style.style ()); uiout->wrap_hint (wrap_indent); uiout->text (" at "); diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 357b88db531..ded8096c630 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -239,7 +239,7 @@ typedef_hash_table::add_template_parameters (struct type *t) continue; tf = XOBNEW (&m_storage, struct decl_field); - tf->name = SYMBOL_LINKAGE_NAME (TYPE_TEMPLATE_ARGUMENT (t, i)); + tf->name = TYPE_TEMPLATE_ARGUMENT (t, i)->linkage_name (); tf->type = SYMBOL_TYPE (TYPE_TEMPLATE_ARGUMENT (t, i)); slot = htab_find_slot (m_table, tf, INSERT); diff --git a/gdb/valops.c b/gdb/valops.c index 4597e99a069..cbb1f30e71b 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1330,13 +1330,13 @@ address_of_variable (struct symbol *var, const struct block *b) error (_("Address requested for identifier " "\"%s\" which is in register $%s"), - SYMBOL_PRINT_NAME (var), regname); + var->print_name (), regname); break; } default: error (_("Can't take address of \"%s\" which isn't an lvalue."), - SYMBOL_PRINT_NAME (var)); + var->print_name ()); break; } @@ -2644,7 +2644,7 @@ find_overload_match (gdb::array_view args, if (fsym) { - qualified_name = SYMBOL_NATURAL_NAME (fsym); + qualified_name = fsym->natural_name (); /* If we have a function with a C++ name, try to extract just the function part. Do not try this for non-functions (e.g. @@ -3061,7 +3061,7 @@ find_oload_champ (gdb::array_view args, fprintf_filtered (gdb_stderr, "Overloaded function instance " "%s # of parms %d\n", - SYMBOL_DEMANGLED_NAME (functions[ix]), + functions[ix]->demangled_name (), (int) parm_types.size ()); for (jj = 0; jj < args.size () - static_offset; jj++) fprintf_filtered (gdb_stderr, -- 2.30.2