From c9d95fa3d034ae614e33b631e0bc019015c444e9 Mon Sep 17 00:00:00 2001 From: Christian Biesinger Date: Fri, 22 Nov 2019 12:05:14 -0600 Subject: Replace the MSYMBOL_*_NAME macros with member functions Improves readability. In the future, it will also allow making the name private, once the name setter functions become member functions. gdb/ChangeLog: 2019-11-22 Christian Biesinger * ada-lang.c (ada_lookup_simple_minsym): Update. (ada_collect_symbol_completion_matches): Update. * ada-tasks.c (read_atcb): Update. * amd64-windows-tdep.c (amd64_skip_main_prologue): Update. (amd64_windows_skip_trampoline_code): Update. * arm-tdep.c (skip_prologue_function): Update. (arm_skip_stack_protector): Update. * arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update. (arm_wince_skip_main_prologue): Update. * ax-gdb.c (gen_expr): Update. * block.c (call_site_for_pc): Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (set_breakpoint_location_function): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * c-valprint.c (print_unpacked_pointer): Update. * coffread.c (coff_symfile_read): Update. * compile/compile-c-symbols.c (convert_symbol_bmsym): Update. * compile/compile-cplus-symbols.c (convert_symbol_bmsym): Update. * dwarf-index-write.c (write_psymbols): Update. * dwarf2loc.c (call_site_to_target_addr): Update. (func_verify_no_selftailcall): Update. (tailcall_dump): Update. (call_site_find_chain_1): Update. (dwarf_expr_reg_to_entry_parameter): Update. * elfread.c (elf_gnu_ifunc_record_cache): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. (evaluate_subexp_for_sizeof): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * frame.c (get_prev_frame_always_1): Update. * frv-tdep.c (frv_skip_main_prologue): Update. * gnu-v2-abi.c (gnuv2_value_rtti_type): Update. * gnu-v3-abi.c (gnuv3_rtti_type): Update. (gnuv3_get_typename_from_type_info): Update. (gnuv3_skip_trampoline): Update. * hppa-tdep.c (hppa_lookup_stub_minimal_symbol): Update. * i386-tdep.c (i386_skip_main_prologue): Update. (i386_pe_skip_trampoline_code): Update. * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update. * infcall.c (get_function_name): Update. * linespec.c (minsym_found): Update. * linux-fork.c (info_checkpoints_command): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. (m32c_m16c_pointer_to_address): Update. * maint.c (maintenance_translate_address): Update. * minsyms.c (add_minsym_to_hash_table): Update. (add_minsym_to_demangled_hash_table): Update. (lookup_minimal_symbol_mangled): Update. (lookup_minimal_symbol_demangled): Update. (lookup_minimal_symbol_linkage): Update. (lookup_minimal_symbol_text): Update. (lookup_minimal_symbol_by_pc_name): Update. (minimal_symbol_is_less_than): Update. (compact_minimal_symbols): Update. (build_minimal_symbol_hash_tables): Update. (find_solib_trampoline_target): Update. * mips-tdep.c (mips_stub_frame_sniffer): Update. (mips_skip_pic_trampoline_code): Update. * msp430-tdep.c (msp430_skip_trampoline_code): Update. * objc-lang.c (info_selectors_command): Update. (info_classes_command): Update. (find_methods): Update. (find_imps): Update. * p-valprint.c (pascal_val_print): Update. * ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * printcmd.c (build_address_symbolic): Update. (info_symbol_command): Update. * psymtab.c (psymbol_name_matches): Update. (match_partial_symbol): Update. (lookup_partial_symbol): Update. (print_partial_symbols): Update. (sort_pst_symbols): Update. (maintenance_check_psymtabs): Update. * python/py-framefilter.c (py_print_frame): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rs6000-tdep.c (rs6000_skip_main_prologue): Update. (rs6000_skip_trampoline_code): Update. * sol-thread.c (info_cb): Update. * stabsread.c (scan_file_globals): Update. * stack.c (find_frame_funname): Update. (info_frame_command_core): Update. * symmisc.c (dump_msymbols): Update. * symtab.c (symbol_natural_name): Rename to.., (general_symbol_info::natural_name): ...this. (symbol_demangled_name): Rename to... (general_symbol_info::demangled_name): ...this. (symbol_search_name): Rename to... (general_symbol_info::search_name): ...this. (symbol_matches_search_name): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (search_symbols): Update. (print_msymbol_info): Update. (rbreak_command): Update. (completion_list_add_msymbol): Update. (completion_list_objc_symbol): Update. (get_msymbol_address): Update. * symtab.h (struct general_symbol_info): Add member functions natural_name (), linkage_name (), print_name (), demangled_name (), and search_name (). (SYMBOL_NATURAL_NAME): Update. (symbol_natural_name): Move to a member function on general_symbol_info. (SYMBOL_DEMANGLED_NAME): Update. (symbol_demangled_name): Move to a member function on general_symbol_info. (SYMBOL_SEARCH_NAME): Update. (symbol_search_name): Move to a member function on general_symbol_info. (MSYMBOL_NATURAL_NAME): Remove. (MSYMBOL_LINKAGE_NAME): Remove. (MSYMBOL_PRINT_NAME): Remove. (MSYMBOL_DEMANGLED_NAME): Remove. (MSYMBOL_SEARCH_NAME): Remove. * x86-tdep.c (x86_in_indirect_branch_thunk): Update. Change-Id: I65aa529843a9903e174ce799037e41f954a9fcee --- gdb/psymtab.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'gdb/psymtab.c') diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 67e3e36..c315500 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -534,7 +534,7 @@ psymbol_name_matches (partial_symbol *psym, const language_defn *lang = language_def (psym->ginfo.language); symbol_name_matcher_ftype *name_match = get_symbol_name_matcher (lang, lookup_name); - return name_match (symbol_search_name (&psym->ginfo), lookup_name, NULL); + return name_match (psym->ginfo.search_name (), lookup_name, NULL); } /* Look in PST for a symbol in DOMAIN whose name matches NAME. Search @@ -585,7 +585,7 @@ match_partial_symbol (struct objfile *objfile, const char *lang_ln = name.language_lookup_name (lang).c_str (); - if (ordered_compare (symbol_search_name (&(*center)->ginfo), + if (ordered_compare ((*center)->ginfo.search_name (), lang_ln) >= 0) top = center; else @@ -693,7 +693,7 @@ lookup_partial_symbol (struct objfile *objfile, if (!(center < top)) internal_error (__FILE__, __LINE__, _("failed internal consistency check")); - if (strcmp_iw_ordered (symbol_search_name (&(*center)->ginfo), + if (strcmp_iw_ordered ((*center)->ginfo.search_name (), search_name.get ()) >= 0) { top = center; @@ -836,10 +836,10 @@ print_partial_symbols (struct gdbarch *gdbarch, struct objfile *objfile, { QUIT; fprintf_filtered (outfile, " `%s'", (*p)->ginfo.name); - if (symbol_demangled_name (&(*p)->ginfo) != NULL) + if ((*p)->ginfo.demangled_name () != NULL) { fprintf_filtered (outfile, " `%s'", - symbol_demangled_name (&(*p)->ginfo)); + (*p)->ginfo.demangled_name ()); } fputs_filtered (", ", outfile); switch ((*p)->domain) @@ -1283,7 +1283,7 @@ recursively_search_psymtabs && (*psym)->aclass == LOC_TYPEDEF)) && psymbol_name_matches (*psym, lookup_name) && (sym_matcher == NULL - || sym_matcher (symbol_search_name (&(*psym)->ginfo)))) + || sym_matcher ((*psym)->ginfo.search_name ()))) { /* Found a match, so notify our caller. */ result = PST_SEARCHED_AND_FOUND; @@ -1478,8 +1478,8 @@ sort_pst_symbols (struct objfile *objfile, struct partial_symtab *pst) std::sort (begin, end, [] (partial_symbol *s1, partial_symbol *s2) { - return strcmp_iw_ordered (symbol_search_name (&s1->ginfo), - symbol_search_name (&s2->ginfo)) < 0; + return strcmp_iw_ordered (s1->ginfo.search_name (), + s2->ginfo.search_name ()) < 0; }); } @@ -2106,7 +2106,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty) length = ps->n_static_syms; while (length--) { - sym = block_lookup_symbol (b, symbol_search_name (&(*psym)->ginfo), + sym = block_lookup_symbol (b, (*psym)->ginfo.search_name (), symbol_name_match_type::SEARCH_NAME, (*psym)->domain); if (!sym) @@ -2124,7 +2124,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty) length = ps->n_global_syms; while (length--) { - sym = block_lookup_symbol (b, symbol_search_name (&(*psym)->ginfo), + sym = block_lookup_symbol (b, (*psym)->ginfo.search_name (), symbol_name_match_type::SEARCH_NAME, (*psym)->domain); if (!sym) -- cgit v1.1