Patchwork [pushed] Replace the MSYMBOL_*_NAME macros with member functions

login
register
mail settings
Submitter Simon Marchi (Code Review)
Date Nov. 22, 2019, 6:07 p.m.
Message ID <20191122180710.3139B2816F@gnutoolchain-gerrit.osci.io>
Download mbox | patch
Permalink /patch/36130/
State New
Headers show

Comments

Simon Marchi (Code Review) - Nov. 22, 2019, 6:07 p.m.
The original change was created by Christian Biesinger.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/688
......................................................................

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  <cbiesinger@google.com>

	* 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
---
M gdb/ChangeLog
M gdb/ada-lang.c
M gdb/ada-tasks.c
M gdb/amd64-windows-tdep.c
M gdb/arm-tdep.c
M gdb/arm-wince-tdep.c
M gdb/ax-gdb.c
M gdb/block.c
M gdb/blockframe.c
M gdb/breakpoint.c
M gdb/btrace.c
M gdb/c-valprint.c
M gdb/coffread.c
M gdb/compile/compile-c-symbols.c
M gdb/compile/compile-cplus-symbols.c
M gdb/dwarf-index-write.c
M gdb/dwarf2loc.c
M gdb/elfread.c
M gdb/eval.c
M gdb/expprint.c
M gdb/frame.c
M gdb/frv-tdep.c
M gdb/gnu-v2-abi.c
M gdb/gnu-v3-abi.c
M gdb/hppa-tdep.c
M gdb/i386-tdep.c
M gdb/ia64-tdep.c
M gdb/infcall.c
M gdb/linespec.c
M gdb/linux-fork.c
M gdb/m32c-tdep.c
M gdb/maint.c
M gdb/minsyms.c
M gdb/mips-tdep.c
M gdb/msp430-tdep.c
M gdb/objc-lang.c
M gdb/p-valprint.c
M gdb/ppc-linux-tdep.c
M gdb/ppc-sysv-tdep.c
M gdb/printcmd.c
M gdb/psymtab.c
M gdb/python/py-framefilter.c
M gdb/python/python.c
M gdb/record-btrace.c
M gdb/rs6000-tdep.c
M gdb/sol-thread.c
M gdb/stabsread.c
M gdb/stack.c
M gdb/symmisc.c
M gdb/symtab.c
M gdb/symtab.h
M gdb/x86-tdep.c
52 files changed, 320 insertions(+), 201 deletions(-)

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 838262e..f487844 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,126 @@ 
 2019-11-22  Christian Biesinger  <cbiesinger@google.com>
 
+	* 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.
+
+2019-11-22  Christian Biesinger  <cbiesinger@google.com>
+
 	* symtab.c (create_demangled_names_hash): Use per_bfd->
 	minimal_symbol_count for computing the initial size, if greater
 	than our default size.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 36001ef..723ac36 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4946,7 +4946,7 @@ 
     {
       for (minimal_symbol *msymbol : objfile->msymbols ())
 	{
-	  if (match_name (MSYMBOL_LINKAGE_NAME (msymbol), lookup_name, NULL)
+	  if (match_name (msymbol->linkage_name (), lookup_name, NULL)
 	      && MSYMBOL_TYPE (msymbol) != mst_solib_trampoline)
 	    {
 	      result.minsym = msymbol;
@@ -6449,7 +6449,7 @@ 
 
 	  completion_list_add_name (tracker,
 				    symbol_language,
-				    MSYMBOL_LINKAGE_NAME (msymbol),
+				    msymbol->linkage_name (),
 				    lookup_name, text, word);
 	}
     }
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index e5504e9..110a710 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -669,7 +669,7 @@ 
 	  msym = lookup_minimal_symbol_by_pc (task_id);
 	  if (msym.minsym)
 	    {
-	      const char *full_name = MSYMBOL_LINKAGE_NAME (msym.minsym);
+	      const char *full_name = msym.minsym->linkage_name ();
 	      const char *task_name = full_name;
 	      const char *p;
 
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index 61ac2a5..71a5e57 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -358,8 +358,8 @@ 
 	  call_dest = pc + 5 + extract_signed_integer (buf, 4, byte_order);
  	  s = lookup_minimal_symbol_by_pc (call_dest);
  	  if (s.minsym != NULL
- 	      && MSYMBOL_LINKAGE_NAME (s.minsym) != NULL
- 	      && strcmp (MSYMBOL_LINKAGE_NAME (s.minsym), "__main") == 0)
+ 	      && s.minsym->linkage_name () != NULL
+ 	      && strcmp (s.minsym->linkage_name (), "__main") == 0)
  	    pc += 5;
  	}
     }
@@ -1187,7 +1187,7 @@ 
 	= (indirect_addr
 	   ? lookup_minimal_symbol_by_pc (indirect_addr).minsym
 	   : NULL);
-      const char *symname = indsym ? MSYMBOL_LINKAGE_NAME (indsym) : NULL;
+      const char *symname = indsym ? indsym->linkage_name () : NULL;
 
       if (symname)
 	{
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 3cf3abb..69c87c5 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -550,9 +550,9 @@ 
   msym = lookup_minimal_symbol_by_pc (pc);
   if (msym.minsym != NULL
       && BMSYMBOL_VALUE_ADDRESS (msym) == pc
-      && MSYMBOL_LINKAGE_NAME (msym.minsym) != NULL)
+      && msym.minsym->linkage_name () != NULL)
     {
-      const char *name = MSYMBOL_LINKAGE_NAME (msym.minsym);
+      const char *name = msym.minsym->linkage_name ();
 
       /* The GNU linker's Thumb call stub to foo is named
 	 __foo_from_thumb.  */
@@ -1254,7 +1254,7 @@ 
   /* ADDR must correspond to a symbol whose name is __stack_chk_guard.
      Otherwise, this sequence cannot be for stack protector.  */
   if (stack_chk_guard.minsym == NULL
-      || !startswith (MSYMBOL_LINKAGE_NAME (stack_chk_guard.minsym), "__stack_chk_guard"))
+      || !startswith (stack_chk_guard.minsym->linkage_name (), "__stack_chk_guard"))
    return pc;
 
   if (is_thumb)
diff --git a/gdb/arm-wince-tdep.c b/gdb/arm-wince-tdep.c
index 584eef9..916c56d 100644
--- a/gdb/arm-wince-tdep.c
+++ b/gdb/arm-wince-tdep.c
@@ -66,7 +66,7 @@ 
   if (indsym.minsym == NULL)
     return 0;
 
-  symname = MSYMBOL_LINKAGE_NAME (indsym.minsym);
+  symname = indsym.minsym->linkage_name ();
   if (symname == NULL || !startswith (symname, "__imp_"))
     return 0;
 
@@ -104,8 +104,8 @@ 
       struct bound_minimal_symbol s = lookup_minimal_symbol_by_pc (call_dest);
 
       if (s.minsym != NULL
-	  && MSYMBOL_LINKAGE_NAME (s.minsym) != NULL
-	  && strcmp (MSYMBOL_LINKAGE_NAME (s.minsym), "__gccmain") == 0)
+	  && s.minsym->linkage_name () != NULL
+	  && strcmp (s.minsym->linkage_name (), "__gccmain") == 0)
 	pc += 4;
     }
 
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index ecbb2fe..23a4120 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2020,7 +2020,7 @@ 
       gen_msym_var_ref (ax, value, (*pc)[2].msymbol, (*pc)[1].objfile);
 
       if (TYPE_CODE (value->type) == TYPE_CODE_ERROR)
-	error_unknown_type (MSYMBOL_PRINT_NAME ((*pc)[2].msymbol));
+	error_unknown_type ((*pc)[2].msymbol->linkage_name ());
 
       (*pc) += 4;
       break;
diff --git a/gdb/block.c b/gdb/block.c
index 40cd3f4..a4592e3 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -242,7 +242,7 @@ 
 		     "DW_TAG_call_site %s in %s"),
 		   paddress (gdbarch, pc),
 		   (msym.minsym == NULL ? "???"
-		    : MSYMBOL_PRINT_NAME (msym.minsym)));
+		    : msym.minsym->print_name ()));
     }
 
   return (struct call_site *) *slot;
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 4306b54..fd83517 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -337,7 +337,7 @@ 
     }
 
   cache_pc_function_low = BMSYMBOL_VALUE_ADDRESS (msymbol);
-  cache_pc_function_name = MSYMBOL_LINKAGE_NAME (msymbol.minsym);
+  cache_pc_function_name = msymbol.minsym->linkage_name ();
   cache_pc_function_section = section;
   cache_pc_function_high = minimal_symbol_upper_bound (msymbol);
   cache_pc_function_block = nullptr;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index c9587ff..e90a1c0 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7085,7 +7085,7 @@ 
 	{
 	  struct breakpoint *b = loc->owner;
 
-	  function_name = MSYMBOL_LINKAGE_NAME (loc->msymbol);
+	  function_name = loc->msymbol->linkage_name ();
 
 	  if (b->type == bp_breakpoint && b->loc == loc
 	      && loc->next == NULL && b->related_breakpoint == b)
diff --git a/gdb/btrace.c b/gdb/btrace.c
index cf0a4e7..9422c2b 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -85,7 +85,7 @@ 
     return SYMBOL_PRINT_NAME (sym);
 
   if (msym != NULL)
-    return MSYMBOL_PRINT_NAME (msym);
+    return msym->print_name ();
 
   return "<unknown>";
 }
@@ -197,7 +197,7 @@ 
 
   /* If the minimal symbol changed, we certainly switched functions.  */
   if (mfun != NULL && msym != NULL
-      && strcmp (MSYMBOL_LINKAGE_NAME (mfun), MSYMBOL_LINKAGE_NAME (msym)) != 0)
+      && strcmp (mfun->linkage_name (), msym->linkage_name ()) != 0)
     return 1;
 
   /* If the symbol changed, we certainly switched functions.  */
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 58675f6..607fb80 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -187,7 +187,7 @@ 
 	  if (want_space)
 	    fputs_filtered (" ", stream);
 	  fputs_filtered (" <", stream);
-	  fputs_filtered (MSYMBOL_PRINT_NAME (msymbol.minsym), stream);
+	  fputs_filtered (msymbol.minsym->print_name (), stream);
 	  fputs_filtered (">", stream);
 	  want_space = 1;
 	}
@@ -203,8 +203,7 @@ 
 
 	  if (msymbol.minsym != NULL)
 	    {
-	      const char *search_name
-		= MSYMBOL_SEARCH_NAME (msymbol.minsym);
+	      const char *search_name = msymbol.minsym->search_name ();
 	      wsym = lookup_symbol_search_name (search_name, NULL,
 						VAR_DOMAIN).symbol;
 	    }
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 2ec48d6..8564be1 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -640,7 +640,7 @@ 
     {
       for (minimal_symbol *msym : objfile->msymbols ())
 	{
-	  const char *name = MSYMBOL_LINKAGE_NAME (msym);
+	  const char *name = msym->linkage_name ();
 
 	  /* If the minimal symbols whose name are prefixed by "__imp_"
 	     or "_imp_", get rid of the prefix, and search the minimal
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 9545caa..abd0aea 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -308,7 +308,7 @@ 
     }
 
   sym_type = context->convert_type (type);
-  decl = context->plugin ().build_decl (MSYMBOL_NATURAL_NAME (msym),
+  decl = context->plugin ().build_decl (msym->natural_name (),
 					kind, sym_type, NULL, addr,
 					NULL, 0);
   context->plugin ().bind (decl, 1 /* is_global */);
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index 10ee856..1acd07d 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -323,7 +323,7 @@ 
   sym_type = instance->convert_type (type);
   instance->plugin ().push_namespace ("");
   instance->plugin ().build_decl
-    ("minsym", MSYMBOL_NATURAL_NAME (msym), kind, sym_type, nullptr, addr,
+    ("minsym", msym->natural_name (), kind, sym_type, nullptr, addr,
      nullptr, 0);
   instance->plugin ().pop_binding_level ("");
 }
diff --git a/gdb/dwarf-index-write.c b/gdb/dwarf-index-write.c
index 48f385e..7e89de4 100644
--- a/gdb/dwarf-index-write.c
+++ b/gdb/dwarf-index-write.c
@@ -550,7 +550,7 @@ 
 	{
 	  gdb_index_symbol_kind kind = symbol_kind (psym);
 
-	  add_index_entry (symtab, symbol_search_name (&psym->ginfo),
+	  add_index_entry (symtab, psym->ginfo.search_name (),
 			   is_static, kind, cu_index);
 	}
     }
@@ -686,7 +686,7 @@ 
     const int dwarf_tag = psymbol_tag (psym);
     if (dwarf_tag == 0)
       return;
-    const char *name = symbol_search_name (&psym->ginfo);
+    const char *name = psym->ginfo.search_name ();
 
     if (psym->ginfo.language == language_ada)
       {
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index e25ee66..1ac56b2 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -800,7 +800,7 @@ 
 			 _("DW_AT_call_target is not specified at %s in %s"),
 			 paddress (call_site_gdbarch, call_site->pc),
 			 (msym.minsym == NULL ? "???"
-			  : MSYMBOL_PRINT_NAME (msym.minsym)));
+			  : msym.minsym->print_name ()));
 			
 	  }
 	if (caller_frame == NULL)
@@ -814,7 +814,7 @@ 
 			   "available at %s in %s"),
 			 paddress (call_site_gdbarch, call_site->pc),
 			 (msym.minsym == NULL ? "???"
-			  : MSYMBOL_PRINT_NAME (msym.minsym)));
+			  : msym.minsym->print_name ()));
 			
 	  }
 	caller_arch = get_frame_arch (caller_frame);
@@ -846,7 +846,7 @@ 
 			   "at %s in %s"),
 			 physname, paddress (call_site_gdbarch, call_site->pc),
 			 (msym.minsym == NULL ? "???"
-			  : MSYMBOL_PRINT_NAME (msym.minsym)));
+			  : msym.minsym->print_name ()));
 			
 	  }
 	return BMSYMBOL_VALUE_ADDRESS (msym);
@@ -934,7 +934,7 @@ 
 			     "function \"%s\" at %s can call itself via tail "
 			     "calls"),
 			   (msym.minsym == NULL ? "???"
-			    : MSYMBOL_PRINT_NAME (msym.minsym)),
+			    : msym.minsym->print_name ()),
 			   paddress (gdbarch, verify_addr));
 	    }
 
@@ -955,7 +955,7 @@ 
 
   fprintf_unfiltered (gdb_stdlog, " %s(%s)", paddress (gdbarch, addr),
 		      (msym.minsym == NULL ? "???"
-		       : MSYMBOL_PRINT_NAME (msym.minsym)));
+		       : msym.minsym->print_name ()));
 
 }
 
@@ -1173,10 +1173,10 @@ 
 		     "callers or callees between caller function \"%s\" at %s "
 		     "and callee function \"%s\" at %s"),
 		   (msym_caller.minsym == NULL
-		    ? "???" : MSYMBOL_PRINT_NAME (msym_caller.minsym)),
+		    ? "???" : msym_caller.minsym->print_name ()),
 		   paddress (gdbarch, caller_pc),
 		   (msym_callee.minsym == NULL
-		    ? "???" : MSYMBOL_PRINT_NAME (msym_callee.minsym)),
+		    ? "???" : msym_callee.minsym->print_name ()),
 		   paddress (gdbarch, callee_pc));
     }
 
@@ -1276,7 +1276,7 @@ 
 		   gdbarch_bfd_arch_info (gdbarch)->printable_name,
 		   paddress (gdbarch, func_addr),
 		   (msym.minsym == NULL ? "???"
-		    : MSYMBOL_PRINT_NAME (msym.minsym)),
+		    : msym.minsym->print_name ()),
 		   gdbarch_bfd_arch_info (caller_gdbarch)->printable_name);
     }
 
@@ -1289,7 +1289,7 @@ 
 					   "requires caller of %s (%s)"),
 		   paddress (gdbarch, func_addr),
 		   (msym.minsym == NULL ? "???"
-		    : MSYMBOL_PRINT_NAME (msym.minsym)));
+		    : msym.minsym->print_name ()));
     }
   caller_pc = get_frame_pc (caller_frame);
   call_site = call_site_for_pc (gdbarch, caller_pc);
@@ -1305,9 +1305,9 @@ 
 		   _("DW_OP_entry_value resolving expects callee %s at %s "
 		     "but the called frame is for %s at %s"),
 		   (target_msym == NULL ? "???"
-					: MSYMBOL_PRINT_NAME (target_msym)),
+					: target_msym->print_name ()),
 		   paddress (gdbarch, target_addr),
-		   func_msym == NULL ? "???" : MSYMBOL_PRINT_NAME (func_msym),
+		   func_msym == NULL ? "???" : func_msym->print_name (),
 		   paddress (gdbarch, func_addr));
     }
 
@@ -1331,7 +1331,7 @@ 
       throw_error (NO_ENTRY_VALUE_ERROR, _("Cannot find matching parameter "
 					   "at DW_TAG_call_site %s at %s"),
 		   paddress (gdbarch, caller_pc),
-		   msym == NULL ? "???" : MSYMBOL_PRINT_NAME (msym)); 
+		   msym == NULL ? "???" : msym->print_name ()); 
     }
 
   *per_cu_return = call_site->per_cu;
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 226e3f0..44b793d 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -714,7 +714,7 @@ 
 
   /* If .plt jumps back to .plt the symbol is still deferred for later
      resolution and it has no use for GDB.  */
-  const char *target_name = MSYMBOL_LINKAGE_NAME (msym.minsym);
+  const char *target_name = msym.minsym->linkage_name ();
   size_t len = strlen (target_name);
 
   /* Note we check the symbol's name instead of checking whether the
diff --git a/gdb/eval.c b/gdb/eval.c
index 71e79d6..6dca8be 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1044,7 +1044,7 @@ 
 	  if (op == OP_VAR_MSYM_VALUE)
 	    {
 	      minimal_symbol *msym = exp->elts[*pos + 2].msymbol;
-	      var_func_name = MSYMBOL_PRINT_NAME (msym);
+	      var_func_name = msym->print_name ();
 	    }
 	  else if (op == OP_VAR_VALUE)
 	    {
@@ -1323,7 +1323,7 @@ 
 	type = value_type (val);
 	if (TYPE_CODE (type) == TYPE_CODE_ERROR
 	    && (noside != EVAL_AVOID_SIDE_EFFECTS || pc != 0))
-	  error_unknown_type (MSYMBOL_PRINT_NAME (msymbol));
+	  error_unknown_type (msymbol->print_name ());
 	return val;
       }
 
@@ -3218,7 +3218,7 @@ 
 
 	type = value_type (mval);
 	if (TYPE_CODE (type) == TYPE_CODE_ERROR)
-	  error_unknown_type (MSYMBOL_PRINT_NAME (msymbol));
+	  error_unknown_type (msymbol->print_name ());
 
 	return value_from_longest (size_type, TYPE_LENGTH (type));
       }
diff --git a/gdb/expprint.c b/gdb/expprint.c
index c98638a..70b9eb5 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -138,7 +138,7 @@ 
     case OP_VAR_MSYM_VALUE:
       {
 	(*pos) += 3;
-	fputs_filtered (MSYMBOL_PRINT_NAME (exp->elts[pc + 2].msymbol), stream);
+	fputs_filtered (exp->elts[pc + 2].msymbol->print_name (), stream);
       }
       return;
 
@@ -908,7 +908,7 @@ 
       fprintf_filtered (stream, ", msymbol @");
       gdb_print_host_address (exp->elts[elt + 1].msymbol, stream);
       fprintf_filtered (stream, " (%s)",
-			MSYMBOL_PRINT_NAME (exp->elts[elt + 1].msymbol));
+			exp->elts[elt + 1].msymbol->print_name ());
       elt += 3;
       break;
     case OP_VAR_ENTRY_VALUE:
diff --git a/gdb/frame.c b/gdb/frame.c
index 3ebdc99..660f8cf 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2043,7 +2043,7 @@ 
       this_pc_in_block = get_frame_address_in_block (this_frame);
       morestack_msym = lookup_minimal_symbol_by_pc (this_pc_in_block).minsym;
       if (morestack_msym)
-	morestack_name = MSYMBOL_LINKAGE_NAME (morestack_msym);
+	morestack_name = morestack_msym->linkage_name ();
       if (!morestack_name || strcmp (morestack_name, "__morestack") != 0)
 	{
 	  if (frame_debug)
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 7635404..a80c043 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1074,8 +1074,8 @@ 
       s = lookup_minimal_symbol_by_pc (call_dest);
 
       if (s.minsym != NULL
-          && MSYMBOL_LINKAGE_NAME (s.minsym) != NULL
-	  && strcmp (MSYMBOL_LINKAGE_NAME (s.minsym), "__main") == 0)
+          && s.minsym->linkage_name () != NULL
+	  && strcmp (s.minsym->linkage_name (), "__main") == 0)
 	{
 	  pc += 4;
 	  return pc;
diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c
index 3040568..000f825 100644
--- a/gdb/gnu-v2-abi.c
+++ b/gdb/gnu-v2-abi.c
@@ -243,7 +243,7 @@ 
   /* Try to find a symbol that is the vtable.  */
   minsym=lookup_minimal_symbol_by_pc(vtbl);
   if (minsym.minsym==NULL
-      || (linkage_name=MSYMBOL_LINKAGE_NAME (minsym.minsym))==NULL
+      || (linkage_name=minsym.minsym->linkage_name ())==NULL
       || !is_vtable_name (linkage_name))
     return NULL;
 
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 2a5486c..d630ec0 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -328,7 +328,7 @@ 
      If we didn't like this approach, we could instead look in the
      type_info object itself to get the class name.  But this way
      should work just as well, and doesn't read target memory.  */
-  vtable_symbol_name = MSYMBOL_DEMANGLED_NAME (vtable_symbol);
+  vtable_symbol_name = vtable_symbol->demangled_name ();
   if (vtable_symbol_name == NULL
       || !startswith (vtable_symbol_name, "vtable for "))
     {
@@ -1148,11 +1148,11 @@ 
 
 #define TYPEINFO_PREFIX "typeinfo for "
 #define TYPEINFO_PREFIX_LEN (sizeof (TYPEINFO_PREFIX) - 1)
-  symname = MSYMBOL_DEMANGLED_NAME (typeinfo_sym.minsym);
+  symname = typeinfo_sym.minsym->demangled_name ();
   if (symname == NULL || strncmp (symname, TYPEINFO_PREFIX,
 				  TYPEINFO_PREFIX_LEN))
     error (_("typeinfo symbol '%s' has unexpected name"),
-	   MSYMBOL_LINKAGE_NAME (typeinfo_sym.minsym));
+	   typeinfo_sym.minsym->linkage_name ());
   class_name = symname + TYPEINFO_PREFIX_LEN;
 
   /* Strip off @plt and version suffixes.  */
@@ -1202,7 +1202,7 @@ 
   /* The symbol's demangled name should be something like "virtual
      thunk to FUNCTION", where FUNCTION is the name of the function
      being thunked to.  */
-  thunk_name = MSYMBOL_DEMANGLED_NAME (thunk_sym.minsym);
+  thunk_name = thunk_sym.minsym->demangled_name ();
   if (thunk_name == NULL || strstr (thunk_name, " thunk to ") == NULL)
     return 0;
 
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index ae1554a..8e4168d 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2537,7 +2537,7 @@ 
     {
       for (minimal_symbol *msym : objfile->msymbols ())
 	{
-	  if (strcmp (MSYMBOL_LINKAGE_NAME (msym), name) == 0)
+	  if (strcmp (msym->linkage_name (), name) == 0)
 	    {
 	      struct unwind_table_entry *u;
 
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 52d286a..5445dd1 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1948,8 +1948,8 @@ 
 	  call_dest = call_dest & 0xffffffffU;
  	  s = lookup_minimal_symbol_by_pc (call_dest);
  	  if (s.minsym != NULL
- 	      && MSYMBOL_LINKAGE_NAME (s.minsym) != NULL
- 	      && strcmp (MSYMBOL_LINKAGE_NAME (s.minsym), "__main") == 0)
+ 	      && s.minsym->linkage_name () != NULL
+ 	      && strcmp (s.minsym->linkage_name (), "__main") == 0)
  	    pc += 5;
  	}
     }
@@ -3933,7 +3933,7 @@ 
 	read_memory_unsigned_integer (pc + 2, 4, byte_order);
       struct minimal_symbol *indsym =
 	indirect ? lookup_minimal_symbol_by_pc (indirect).minsym : 0;
-      const char *symname = indsym ? MSYMBOL_LINKAGE_NAME (indsym) : 0;
+      const char *symname = indsym ? indsym->linkage_name () : 0;
 
       if (symname)
 	{
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index ceaf69e..f8b75bf 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -3615,7 +3615,7 @@ 
       minsym = lookup_minimal_symbol_by_pc (addr);
 
       if (minsym.minsym
-	  && is_vtable_name (MSYMBOL_LINKAGE_NAME (minsym.minsym)))
+	  && is_vtable_name (minsym.minsym->linkage_name ()))
 	return read_memory_unsigned_integer (addr, 8, byte_order);
     }
 
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 9fc30ac..7ea2e2e 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -395,7 +395,7 @@ 
     struct bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (funaddr);
 
     if (msymbol.minsym)
-      return MSYMBOL_PRINT_NAME (msymbol.minsym);
+      return msymbol.minsym->print_name ();
   }
 
   {
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 9b7a8c9..817d1a4 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -4221,7 +4221,7 @@ 
 
   if (is_function)
     {
-      const char *msym_name = MSYMBOL_LINKAGE_NAME (msymbol);
+      const char *msym_name = msymbol->linkage_name ();
 
       if (MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
 	  || MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc)
@@ -4250,7 +4250,7 @@ 
   sal.section = MSYMBOL_OBJ_SECTION (objfile, msymbol);
 
   if (maybe_add_address (self->addr_set, objfile->pspace, sal.pc))
-    add_sal_to_sals (self, result, &sal, MSYMBOL_NATURAL_NAME (msymbol), 0);
+    add_sal_to_sals (self, result, &sal, msymbol->natural_name (), 0);
 }
 
 /* A helper function to classify a minimal_symbol_type according to
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 87cfacc..8373093 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -597,7 +597,7 @@ 
 
 	  msym = lookup_minimal_symbol_by_pc (pc);
 	  if (msym.minsym)
-	    printf_filtered (", <%s>", MSYMBOL_LINKAGE_NAME (msym.minsym));
+	    printf_filtered (", <%s>", msym.minsym->linkage_name ());
 	}
 
       putchar_filtered ('\n');
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 657c6b7..4e4e7c3 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -2418,7 +2418,7 @@ 
                "couldn't find a symbol at that address, to find trampoline."),
                paddress (gdbarch, addr));
 
-      func_name = MSYMBOL_LINKAGE_NAME (func_msym.minsym);
+      func_name = func_msym.minsym->linkage_name ();
       tramp_name = (char *) xmalloc (strlen (func_name) + 5);
       strcpy (tramp_name, func_name);
       strcat (tramp_name, ".plt");
@@ -2492,7 +2492,7 @@ 
 
       if (ptr_msym.minsym)
         {
-          const char *ptr_msym_name = MSYMBOL_LINKAGE_NAME (ptr_msym.minsym);
+          const char *ptr_msym_name = ptr_msym.minsym->linkage_name ();
           int len = strlen (ptr_msym_name);
 
           if (len > 4
diff --git a/gdb/maint.c b/gdb/maint.c
index a253584..ce59ef6 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -569,7 +569,7 @@ 
 
   if (sym.minsym)
     {
-      const char *symbol_name = MSYMBOL_PRINT_NAME (sym.minsym);
+      const char *symbol_name = sym.minsym->print_name ();
       const char *symbol_offset
 	= pulongest (address - BMSYMBOL_VALUE_ADDRESS (sym));
 
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 78cb15b..a9ba66b 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -141,7 +141,7 @@ 
   if (sym->hash_next == NULL)
     {
       unsigned int hash
-	= msymbol_hash (MSYMBOL_LINKAGE_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE;
+	= msymbol_hash (sym->linkage_name ()) % MINIMAL_SYMBOL_HASH_SIZE;
 
       sym->hash_next = table[hash];
       table[hash] = sym;
@@ -157,7 +157,7 @@ 
   if (sym->demangled_hash_next == NULL)
     {
       unsigned int hash = search_name_hash (MSYMBOL_LANGUAGE (sym),
-					    MSYMBOL_SEARCH_NAME (sym));
+					    sym->search_name ());
 
       objfile->per_bfd->demangled_hash_languages.set (MSYMBOL_LANGUAGE (sym));
 
@@ -252,7 +252,7 @@ 
        msymbol != NULL;
        msymbol = msymbol->hash_next)
     {
-      const char *symbol_name = MSYMBOL_LINKAGE_NAME (msymbol);
+      const char *symbol_name = msymbol->linkage_name ();
 
       if (namecmp (symbol_name, lookup_name) == 0
 	  && found.maybe_collect (sfile, objfile, msymbol))
@@ -276,7 +276,7 @@ 
        msymbol != NULL;
        msymbol = msymbol->demangled_hash_next)
     {
-      const char *symbol_name = MSYMBOL_SEARCH_NAME (msymbol);
+      const char *symbol_name = msymbol->search_name ();
 
       if (matcher (symbol_name, lookup_name, NULL)
 	  && found.maybe_collect (sfile, objfile, msymbol))
@@ -487,7 +487,7 @@ 
 	   iter != NULL;
 	   iter = iter->hash_next)
 	{
-	  if (mangled_cmp (MSYMBOL_LINKAGE_NAME (iter), name) == 0)
+	  if (mangled_cmp (iter->linkage_name (), name) == 0)
 	    if (callback (iter))
 	      return;
 	}
@@ -511,7 +511,7 @@ 
       for (minimal_symbol *iter = objf->per_bfd->msymbol_demangled_hash[hash];
 	   iter != NULL;
 	   iter = iter->demangled_hash_next)
-	if (name_match (MSYMBOL_SEARCH_NAME (iter), lookup_name, NULL))
+	if (name_match (iter->search_name (), lookup_name, NULL))
 	  if (callback (iter))
 	    return;
     }
@@ -530,7 +530,7 @@ 
 	   msymbol != NULL;
 	   msymbol = msymbol->hash_next)
 	{
-	  if (strcmp (MSYMBOL_LINKAGE_NAME (msymbol), name) == 0
+	  if (strcmp (msymbol->linkage_name (), name) == 0
 	      && (MSYMBOL_TYPE (msymbol) == mst_data
 		  || MSYMBOL_TYPE (msymbol) == mst_bss))
 	    return {msymbol, objfile};
@@ -563,7 +563,7 @@ 
 	       msymbol != NULL && found_symbol.minsym == NULL;
 	       msymbol = msymbol->hash_next)
 	    {
-	      if (strcmp (MSYMBOL_LINKAGE_NAME (msymbol), name) == 0 &&
+	      if (strcmp (msymbol->linkage_name (), name) == 0 &&
 		  (MSYMBOL_TYPE (msymbol) == mst_text
 		   || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
 		   || MSYMBOL_TYPE (msymbol) == mst_file_text))
@@ -611,7 +611,7 @@ 
 	       msymbol = msymbol->hash_next)
 	    {
 	      if (MSYMBOL_VALUE_ADDRESS (objfile, msymbol) == pc
-		  && strcmp (MSYMBOL_LINKAGE_NAME (msymbol), name) == 0)
+		  && strcmp (msymbol->linkage_name (), name) == 0)
 		return msymbol;
 	    }
 	}
@@ -1164,8 +1164,8 @@ 
   else
     /* addrs are equal: sort by name */
     {
-      const char *name1 = MSYMBOL_LINKAGE_NAME (&fn1);
-      const char *name2 = MSYMBOL_LINKAGE_NAME (&fn2);
+      const char *name1 = fn1.linkage_name ();
+      const char *name2 = fn2.linkage_name ();
 
       if (name1 && name2)	/* both have names */
 	return strcmp (name1, name2) < 0;
@@ -1220,8 +1220,8 @@ 
 	  if (MSYMBOL_VALUE_RAW_ADDRESS (copyfrom)
 	      == MSYMBOL_VALUE_RAW_ADDRESS ((copyfrom + 1))
 	      && MSYMBOL_SECTION (copyfrom) == MSYMBOL_SECTION (copyfrom + 1)
-	      && strcmp (MSYMBOL_LINKAGE_NAME (copyfrom),
-			 MSYMBOL_LINKAGE_NAME ((copyfrom + 1))) == 0)
+	      && strcmp (copyfrom->linkage_name (),
+			 (copyfrom + 1)->linkage_name ()) == 0)
 	    {
 	      if (MSYMBOL_TYPE ((copyfrom + 1)) == mst_unknown)
 		{
@@ -1268,7 +1268,7 @@ 
       add_minsym_to_hash_table (msym, objfile->per_bfd->msymbol_hash);
 
       msym->demangled_hash_next = 0;
-      if (MSYMBOL_SEARCH_NAME (msym) != MSYMBOL_LINKAGE_NAME (msym))
+      if (msym->search_name () != msym->linkage_name ())
 	add_minsym_to_demangled_hash_table (msym, objfile);
     }
 }
@@ -1402,8 +1402,8 @@ 
 		   || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
 		   || MSYMBOL_TYPE (msymbol) == mst_data
 		   || MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc)
-		  && strcmp (MSYMBOL_LINKAGE_NAME (msymbol),
-			     MSYMBOL_LINKAGE_NAME (tsymbol)) == 0)
+		  && strcmp (msymbol->linkage_name (),
+			     tsymbol->linkage_name ()) == 0)
 		{
 		  CORE_ADDR func;
 
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 6870db8..0852851 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -3821,8 +3821,8 @@ 
      stub.  The stub for foo is named ".pic.foo".  */
   msym = lookup_minimal_symbol_by_pc (pc);
   if (msym.minsym != NULL
-      && MSYMBOL_LINKAGE_NAME (msym.minsym) != NULL
-      && startswith (MSYMBOL_LINKAGE_NAME (msym.minsym), ".pic."))
+      && msym.minsym->linkage_name () != NULL
+      && startswith (msym.minsym->linkage_name (), ".pic."))
     return 1;
 
   return 0;
@@ -7818,8 +7818,8 @@ 
   msym = lookup_minimal_symbol_by_pc (pc);
   if (msym.minsym == NULL
       || BMSYMBOL_VALUE_ADDRESS (msym) != pc
-      || MSYMBOL_LINKAGE_NAME (msym.minsym) == NULL
-      || !startswith (MSYMBOL_LINKAGE_NAME (msym.minsym), ".pic."))
+      || msym.minsym->linkage_name () == NULL
+      || !startswith (msym.minsym->linkage_name (), ".pic."))
     return 0;
 
   /* A two-instruction header.  */
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 0e55eab..947a669 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -808,7 +808,7 @@ 
   if (!bms.minsym)
     return pc;
 
-  stub_name = MSYMBOL_LINKAGE_NAME (bms.minsym);
+  stub_name = bms.minsym->linkage_name ();
 
   if (gdbarch_tdep (gdbarch)->code_model == MSP_SMALL_CODE_MODEL
       && msp430_in_return_stub (gdbarch, pc, stub_name))
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 946a0a1..bd06264 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -610,7 +610,7 @@ 
       for (minimal_symbol *msymbol : objfile->msymbols ())
 	{
 	  QUIT;
-	  name = MSYMBOL_NATURAL_NAME (msymbol);
+	  name = msymbol->natural_name ();
 	  if (name
 	      && (name[0] == '-' || name[0] == '+')
 	      && name[1] == '[')		/* Got a method name.  */
@@ -623,7 +623,7 @@ 
 	      if (name == NULL)
 		{
 		  complaint (_("Bad method name '%s'"),
-			     MSYMBOL_NATURAL_NAME (msymbol));
+			     msymbol->natural_name ());
 		  continue;
 		}
 	      if (regexp == NULL || re_exec(++name) != 0)
@@ -650,7 +650,7 @@ 
 	  for (minimal_symbol *msymbol : objfile->msymbols ())
 	    {
 	      QUIT;
-	      name = MSYMBOL_NATURAL_NAME (msymbol);
+	      name = msymbol->natural_name ();
 	      if (name &&
 		  (name[0] == '-' || name[0] == '+') &&
 		  name[1] == '[')		/* Got a method name.  */
@@ -764,7 +764,7 @@ 
       for (minimal_symbol *msymbol : objfile->msymbols ())
 	{
 	  QUIT;
-	  name = MSYMBOL_NATURAL_NAME (msymbol);
+	  name = msymbol->natural_name ();
 	  if (name &&
 	      (name[0] == '-' || name[0] == '+') &&
 	      name[1] == '[')			/* Got a method name.  */
@@ -791,7 +791,7 @@ 
 	  for (minimal_symbol *msymbol : objfile->msymbols ())
 	    {
 	      QUIT;
-	      name = MSYMBOL_NATURAL_NAME (msymbol);
+	      name = msymbol->natural_name ();
 	      if (name &&
 		  (name[0] == '-' || name[0] == '+') &&
 		  name[1] == '[') /* Got a method name.  */
@@ -1014,7 +1014,7 @@ 
 
 	  /* Check the symbol name first as this can be done entirely without
 	     sending any query to the target.  */
-	  symname = MSYMBOL_NATURAL_NAME (msymbol);
+	  symname = msymbol->natural_name ();
 	  if (symname == NULL)
 	    continue;
 
@@ -1152,7 +1152,7 @@ 
 	    = lookup_minimal_symbol (selector, 0, 0);
 
 	  if (msym.minsym != NULL) 
-	    symbol_names->push_back (MSYMBOL_NATURAL_NAME (msym.minsym));
+	    symbol_names->push_back (msym.minsym->natural_name ());
 	}
     }
 
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index c465d14..e1e1a00 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -240,7 +240,7 @@ 
 	      if (want_space)
 		fputs_filtered (" ", stream);
 	      fputs_filtered ("<", stream);
-	      fputs_filtered (MSYMBOL_PRINT_NAME (msymbol.minsym), stream);
+	      fputs_filtered (msymbol.minsym->print_name (), stream);
 	      fputs_filtered (">", stream);
 	      want_space = 1;
 	    }
@@ -255,8 +255,7 @@ 
 
 	      if (msymbol.minsym != NULL)
 		{
-		  const char *search_name
-		    = MSYMBOL_SEARCH_NAME (msymbol.minsym);
+		  const char *search_name = msymbol.minsym->search_name ();
 		  wsym = lookup_symbol_search_name (search_name, NULL,
 						    VAR_DOMAIN).symbol;
 		}
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index fd88a89..ecfaee3 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -312,9 +312,8 @@ 
   /* Check if we are in the resolver.  */
   sym = lookup_minimal_symbol_by_pc (pc);
   if (sym.minsym != NULL
-      && (strcmp (MSYMBOL_LINKAGE_NAME (sym.minsym), "__glink") == 0
-	  || strcmp (MSYMBOL_LINKAGE_NAME (sym.minsym),
-		     "__glink_PLTresolve") == 0))
+      && (strcmp (sym.minsym->linkage_name (), "__glink") == 0
+	  || strcmp (sym.minsym->linkage_name (), "__glink_PLTresolve") == 0))
     return 1;
 
   return 0;
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 2a732d0..fb8c9e2 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1043,7 +1043,7 @@ 
   /* Find the minimal symbol that corresponds to CODE_ADDR (should
      have a name of the form ".FN").  */
   dot_fn = lookup_minimal_symbol_by_pc (code_addr);
-  if (dot_fn.minsym == NULL || MSYMBOL_LINKAGE_NAME (dot_fn.minsym)[0] != '.')
+  if (dot_fn.minsym == NULL || dot_fn.minsym->linkage_name ()[0] != '.')
     return 0;
   /* Get the section that contains CODE_ADDR.  Need this for the
      "objfile" that it contains.  */
@@ -1054,7 +1054,7 @@ 
      address.  Only look for the minimal symbol in ".FN"'s object file
      - avoids problems when two object files (i.e., shared libraries)
      contain a minimal symbol with the same name.  */
-  fn = lookup_minimal_symbol (MSYMBOL_LINKAGE_NAME (dot_fn.minsym) + 1, NULL,
+  fn = lookup_minimal_symbol (dot_fn.minsym->linkage_name () + 1, NULL,
 			      dot_fn_section->objfile);
   if (fn.minsym == NULL)
     return 0;
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 0251d46..bf61d59 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -671,9 +671,9 @@ 
 	  symbol = 0;
 	  name_location = BMSYMBOL_VALUE_ADDRESS (msymbol);
 	  if (do_demangle || asm_demangle)
-	    name_temp = MSYMBOL_PRINT_NAME (msymbol.minsym);
+	    name_temp = msymbol.minsym->print_name ();
 	  else
-	    name_temp = MSYMBOL_LINKAGE_NAME (msymbol.minsym);
+	    name_temp = msymbol.minsym->linkage_name ();
 	}
     }
   if (symbol == NULL && msymbol.minsym == NULL)
@@ -1349,7 +1349,7 @@ 
 	    offset = sect_addr - MSYMBOL_VALUE_ADDRESS (objfile, msymbol);
 	    mapped = section_is_mapped (osect) ? _("mapped") : _("unmapped");
 	    sec_name = osect->the_bfd_section->name;
-	    msym_name = MSYMBOL_PRINT_NAME (msymbol);
+	    msym_name = msymbol->print_name ();
 
 	    /* Don't print the offset if it is zero.
 	       We assume there's no need to handle i18n of "sym + offset".  */
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 @@ 
   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 @@ 
 	  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 @@ 
 	  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 @@ 
     {
       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 @@ 
 		   && (*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 @@ 
 
   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 @@ 
 	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 @@ 
 	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)
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 4dd6243..3ef5b6a 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -934,7 +934,7 @@ 
 
 	      msymbol = lookup_minimal_symbol_by_pc (addr);
 	      if (msymbol.minsym != NULL)
-		function = MSYMBOL_PRINT_NAME (msymbol.minsym);
+		function = msymbol.minsym->print_name ();
 	    }
 	  else if (py_func != Py_None)
 	    {
diff --git a/gdb/python/python.c b/gdb/python/python.c
index f94214e..609e1fb 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -794,7 +794,7 @@ 
 	  symbol_name  += SYMBOL_LINKAGE_NAME (p.symbol);
 	}
       else
-	symbol_name = MSYMBOL_LINKAGE_NAME (p.msymbol.minsym);
+	symbol_name = p.msymbol.minsym->linkage_name ();
 
       gdbpy_ref<> argList (Py_BuildValue("(s)", symbol_name.c_str ()));
       gdbpy_ref<> obj (PyObject_CallObject ((PyObject *)
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 3fd4007..04bd09a 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1117,7 +1117,7 @@ 
   if (sym != NULL)
     return SYMBOL_PRINT_NAME (sym);
   else if (msym != NULL)
-    return MSYMBOL_PRINT_NAME (msym);
+    return msym->print_name ();
   else
     return "??";
 }
@@ -1178,7 +1178,7 @@ 
 	uiout->field_string ("function", SYMBOL_PRINT_NAME (sym),
 			     function_name_style.style ());
       else if (msym != NULL)
-	uiout->field_string ("function", MSYMBOL_PRINT_NAME (msym),
+	uiout->field_string ("function", msym->print_name (),
 			     function_name_style.style ());
       else if (!uiout->is_mi_like_p ())
 	uiout->field_string ("function", "??",
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 9c4df4a..07a1860 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2119,9 +2119,9 @@ 
          to __eabi in case the GCC option "-fleading-underscore" was
 	 used to compile the program.  */
       if (s.minsym != NULL
-          && MSYMBOL_LINKAGE_NAME (s.minsym) != NULL
-	  && (strcmp (MSYMBOL_LINKAGE_NAME (s.minsym), "__eabi") == 0
-	      || strcmp (MSYMBOL_LINKAGE_NAME (s.minsym), "___eabi") == 0))
+          && s.minsym->linkage_name () != NULL
+	  && (strcmp (s.minsym->linkage_name (), "__eabi") == 0
+	      || strcmp (s.minsym->linkage_name (), "___eabi") == 0))
 	pc += 4;
     }
   return pc;
@@ -2205,7 +2205,7 @@ 
   msymbol = lookup_minimal_symbol_by_pc (pc);
   if (msymbol.minsym
       && rs6000_in_solib_return_trampoline (gdbarch, pc,
-					    MSYMBOL_LINKAGE_NAME (msymbol.minsym)))
+					    msymbol.minsym->linkage_name ()))
     {
       /* Double-check that the third instruction from PC is relative "b".  */
       op = read_memory_integer (pc + 8, 4, byte_order);
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 6b4cf20..e9ca1c5 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -1109,7 +1109,7 @@ 
 
 	  printf_filtered ("   startfunc=%s",
 			   msym.minsym
-			   ? MSYMBOL_PRINT_NAME (msym.minsym)
+			   ? msym.minsym->print_name ()
 			   : paddress (target_gdbarch (), ti.ti_startfunc));
 	}
 
@@ -1121,7 +1121,7 @@ 
 
 	  printf_filtered ("   sleepfunc=%s",
 			   msym.minsym
-			   ? MSYMBOL_PRINT_NAME (msym.minsym)
+			   ? msym.minsym->print_name ()
 			   : paddress (target_gdbarch (), ti.ti_pc));
 	}
 
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index ef4aa47..0fde120 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -4610,11 +4610,11 @@ 
 	  /* Get the hash index and check all the symbols
 	     under that hash index.  */
 
-	  hash = hashname (MSYMBOL_LINKAGE_NAME (msymbol));
+	  hash = hashname (msymbol->linkage_name ());
 
 	  for (sym = global_sym_chain[hash]; sym;)
 	    {
-	      if (strcmp (MSYMBOL_LINKAGE_NAME (msymbol),
+	      if (strcmp (msymbol->linkage_name (),
 			  SYMBOL_LINKAGE_NAME (sym)) == 0)
 		{
 		  /* Splice this symbol out of the hash chain and
diff --git a/gdb/stack.c b/gdb/stack.c
index b02f177..0568e70 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1290,7 +1290,7 @@ 
       msymbol = lookup_minimal_symbol_by_pc (pc);
       if (msymbol.minsym != NULL)
 	{
-	  funname.reset (xstrdup (MSYMBOL_PRINT_NAME (msymbol.minsym)));
+	  funname.reset (xstrdup (msymbol.minsym->print_name ()));
 	  *funlang = MSYMBOL_LANGUAGE (msymbol.minsym);
 	}
     }
@@ -1516,7 +1516,7 @@ 
       msymbol = lookup_minimal_symbol_by_pc (frame_pc);
       if (msymbol.minsym != NULL)
 	{
-	  funname = MSYMBOL_PRINT_NAME (msymbol.minsym);
+	  funname = msymbol.minsym->print_name ();
 	  funlang = MSYMBOL_LANGUAGE (msymbol.minsym);
 	}
     }
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 24ee255..bf48435 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -243,7 +243,7 @@ 
 			+ ANOFFSET (objfile->section_offsets,
 				    msymbol->section));
       fputs_filtered (paddress (gdbarch, addr), outfile);
-      fprintf_filtered (outfile, " %s", MSYMBOL_LINKAGE_NAME (msymbol));
+      fprintf_filtered (outfile, " %s", msymbol->linkage_name ());
       if (section)
 	{
 	  if (section->the_bfd_section != NULL)
@@ -253,9 +253,9 @@ 
 	    fprintf_filtered (outfile, " spurious section %ld",
 			      (long) (section - objfile->sections));
 	}
-      if (MSYMBOL_DEMANGLED_NAME (msymbol) != NULL)
+      if (msymbol->demangled_name () != NULL)
 	{
-	  fprintf_filtered (outfile, "  %s", MSYMBOL_DEMANGLED_NAME (msymbol));
+	  fprintf_filtered (outfile, "  %s", msymbol->demangled_name ());
 	}
       if (msymbol->filename)
 	fprintf_filtered (outfile, "  %s", msymbol->filename);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 6affdef..92e8dcd 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -944,49 +944,47 @@ 
     symbol_set_demangled_name (gsymbol, NULL, &per_bfd->storage_obstack);
 }
 
-/* Return the source code name of a symbol.  In languages where
-   demangling is necessary, this is the demangled name.  */
+/* See symtab.h.  */
 
 const char *
-symbol_natural_name (const struct general_symbol_info *gsymbol)
+general_symbol_info::natural_name () const
 {
-  switch (gsymbol->language)
+  switch (language)
     {
     case language_cplus:
     case language_d:
     case language_go:
     case language_objc:
     case language_fortran:
-      if (symbol_get_demangled_name (gsymbol) != NULL)
-	return symbol_get_demangled_name (gsymbol);
+      if (symbol_get_demangled_name (this) != NULL)
+	return symbol_get_demangled_name (this);
       break;
     case language_ada:
-      return ada_decode_symbol (gsymbol);
+      return ada_decode_symbol (this);
     default:
       break;
     }
-  return gsymbol->name;
+  return name;
 }
 
-/* Return the demangled name for a symbol based on the language for
-   that symbol.  If no demangled name exists, return NULL.  */
+/* See symtab.h.  */
 
 const char *
-symbol_demangled_name (const struct general_symbol_info *gsymbol)
+general_symbol_info::demangled_name () const
 {
   const char *dem_name = NULL;
 
-  switch (gsymbol->language)
+  switch (language)
     {
     case language_cplus:
     case language_d:
     case language_go:
     case language_objc:
     case language_fortran:
-      dem_name = symbol_get_demangled_name (gsymbol);
+      dem_name = symbol_get_demangled_name (this);
       break;
     case language_ada:
-      dem_name = ada_decode_symbol (gsymbol);
+      dem_name = ada_decode_symbol (this);
       break;
     default:
       break;
@@ -994,18 +992,15 @@ 
   return dem_name;
 }
 
-/* Return the search name of a symbol---generally the demangled or
-   linkage name of the symbol, depending on how it will be searched for.
-   If there is no distinct demangled name, then returns the same value
-   (same pointer) as SYMBOL_LINKAGE_NAME.  */
+/* See symtab.h.  */
 
 const char *
-symbol_search_name (const struct general_symbol_info *gsymbol)
+general_symbol_info::search_name () const
 {
-  if (gsymbol->language == language_ada)
-    return gsymbol->name;
+  if (language == language_ada)
+    return name;
   else
-    return symbol_natural_name (gsymbol);
+    return natural_name ();
 }
 
 /* See symtab.h.  */
@@ -1016,7 +1011,7 @@ 
 {
   symbol_name_matcher_ftype *name_match
     = get_symbol_name_matcher (language_def (gsymbol->language), name);
-  return name_match (symbol_search_name (gsymbol), name, NULL);
+  return name_match (gsymbol->search_name (), name, NULL);
 }
 
 
@@ -3127,7 +3122,7 @@ 
     if (MSYMBOL_TYPE (msymbol.minsym) == mst_solib_trampoline)
       {
 	struct bound_minimal_symbol mfunsym
-	  = lookup_minimal_symbol_text (MSYMBOL_LINKAGE_NAME (msymbol.minsym),
+	  = lookup_minimal_symbol_text (msymbol.minsym->linkage_name (),
 					NULL);
 
 	if (mfunsym.minsym == NULL)
@@ -3733,7 +3728,7 @@ 
       objfile = msymbol.objfile;
       pc = BMSYMBOL_VALUE_ADDRESS (msymbol);
       section = MSYMBOL_OBJ_SECTION (objfile, msymbol.minsym);
-      name = MSYMBOL_LINKAGE_NAME (msymbol.minsym);
+      name = msymbol.minsym->linkage_name ();
     }
 
   gdbarch = get_objfile_arch (objfile);
@@ -4599,7 +4594,7 @@ 
 		  || MSYMBOL_TYPE (msymbol) == ourtype4)
 		{
 		  if (!preg.has_value ()
-		      || preg->exec (MSYMBOL_NATURAL_NAME (msymbol), 0,
+		      || preg->exec (msymbol->natural_name (), 0,
 				     NULL, 0) == 0)
 		    {
 		      /* Note: An important side-effect of these
@@ -4611,8 +4606,7 @@ 
 			     (MSYMBOL_VALUE_ADDRESS (objfile, msymbol))
 			     == NULL)
 			  : (lookup_symbol_in_objfile_from_linkage_name
-			     (objfile, MSYMBOL_LINKAGE_NAME (msymbol),
-			      VAR_DOMAIN)
+			     (objfile, msymbol->linkage_name (), VAR_DOMAIN)
 			     .symbol == NULL))
 			found_misc = 1;
 		    }
@@ -4707,7 +4701,7 @@ 
 		  || MSYMBOL_TYPE (msymbol) == ourtype4)
 		{
 		  if (!preg.has_value ()
-		      || preg->exec (MSYMBOL_NATURAL_NAME (msymbol), 0,
+		      || preg->exec (msymbol->natural_name (), 0,
 				     NULL, 0) == 0)
 		    {
 		      /* For functions we can do a quick check of whether the
@@ -4718,8 +4712,7 @@ 
 			      == NULL))
 			{
 			  if (lookup_symbol_in_objfile_from_linkage_name
-			      (objfile, MSYMBOL_LINKAGE_NAME (msymbol),
-			       VAR_DOMAIN)
+			      (objfile, msymbol->linkage_name (), VAR_DOMAIN)
 			      .symbol == NULL)
 			    {
 			      /* match */
@@ -4829,8 +4822,7 @@ 
 
   printf_filtered (_("%ps  %ps\n"),
 		   styled_string (address_style.style (), tmp),
-		   styled_string (sym_style,
-				  MSYMBOL_PRINT_NAME (msymbol.minsym)));
+		   styled_string (sym_style, msymbol.minsym->print_name ()));
 }
 
 /* This is the guts of the commands "info functions", "info types", and
@@ -5143,11 +5135,11 @@ 
       else
 	{
 	  string = string_printf ("'%s'",
-				  MSYMBOL_LINKAGE_NAME (p.msymbol.minsym));
+				  p.msymbol.minsym->linkage_name ());
 
 	  break_command (&string[0], from_tty);
 	  printf_filtered ("<function, no debug info> %s;\n",
-			   MSYMBOL_PRINT_NAME (p.msymbol.minsym));
+			   p.msymbol.minsym->print_name ());
 	}
     }
 }
@@ -5230,7 +5222,7 @@ 
 			     const char *text, const char *word)
 {
   completion_list_add_name (tracker, MSYMBOL_LANGUAGE (sym),
-			    MSYMBOL_NATURAL_NAME (sym),
+			    sym->natural_name (),
 			    lookup_name, text, word);
 }
 
@@ -5250,7 +5242,7 @@ 
   const char *method, *category, *selector;
   char *tmp2 = NULL;
 
-  method = MSYMBOL_NATURAL_NAME (msymbol);
+  method = msymbol->natural_name ();
 
   /* Is it a method?  */
   if ((method[0] != '-') && (method[0] != '+'))
@@ -6319,7 +6311,7 @@ 
   gdb_assert (minsym->maybe_copied);
   gdb_assert ((objf->flags & OBJF_MAINLINE) == 0);
 
-  const char *linkage_name = MSYMBOL_LINKAGE_NAME (minsym);
+  const char *linkage_name = minsym->linkage_name ();
 
   for (objfile *objfile : current_program_space->objfiles ())
     {
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 8f95a3a..3eb9c0e 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -67,7 +67,7 @@ 
 
   /* 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/MSYMBOL_SEARCH_NAME call.
+     retrieved from a SYMBOL_SEARCH_NAME/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
@@ -380,6 +380,42 @@ 
 
 struct general_symbol_info
 {
+  /* Short version as to when to use which name accessor:
+     Use natural_name () to refer to the name of the symbol in the original
+     source code.  Use linkage_name () if you want to know what the linker
+     thinks the symbol's name is.  Use print_name () for output.  Use
+     demangled_name () if you specifically need to know whether natural_name ()
+     and linkage_name () are different.  */
+
+  const char *linkage_name () const
+  { return name; }
+
+  /* Return SYMBOL's "natural" name, i.e. the name that it was called in
+     the original source code.  In languages like C++ where symbols may
+     be mangled for ease of manipulation by the linker, this is the
+     demangled name.  */
+  const char *natural_name () const;
+
+  /* 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.  */
+  const char *print_name () const
+  { return demangle ? natural_name () : linkage_name (); }
+
+  /* Return the demangled name for a symbol based on the language for
+     that symbol.  If no demangled name exists, return NULL.  */
+  const char *demangled_name () const;
+
+  /* Returns the name to be used when sorting and searching symbols.
+     In C++, we search for the demangled form of a name,
+     and so sort symbols accordingly.  In Ada, however, we search by mangled
+     name.  If there is no distinct demangled name, then this
+     returns the same value (same pointer) as linkage_name ().  */
+  const char *search_name () const;
+
   /* Name of the symbol.  This is a required field.  Storage for the
      name is allocated on the objfile_obstack for the associated
      objfile.  For languages like C++ that make a distinction between
@@ -518,15 +554,8 @@ 
    specifically need to know whether SYMBOL_NATURAL_NAME and
    SYMBOL_LINKAGE_NAME are different.  */
 
-/* Return SYMBOL's "natural" name, i.e. the name that it was called in
-   the original source code.  In languages like C++ where symbols may
-   be mangled for ease of manipulation by the linker, this is the
-   demangled name.  */
-
 #define SYMBOL_NATURAL_NAME(symbol) \
-  (symbol_natural_name ((symbol)))
-extern const char *symbol_natural_name
-  (const struct general_symbol_info *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
@@ -535,12 +564,8 @@ 
 
 #define SYMBOL_LINKAGE_NAME(symbol)	(symbol)->name
 
-/* Return the demangled name for a symbol based on the language for
-   that symbol.  If no demangled name exists, return NULL.  */
 #define SYMBOL_DEMANGLED_NAME(symbol) \
-  (symbol_demangled_name ((symbol)))
-extern const char *symbol_demangled_name
-  (const struct general_symbol_info *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
@@ -555,14 +580,8 @@ 
 #define SYMBOL_PRINT_NAME(symbol)					\
   (demangle ? SYMBOL_NATURAL_NAME (symbol) : SYMBOL_LINKAGE_NAME (symbol))
 
-/* Macro that returns the name to be used when sorting and searching symbols.
-   In C++, we search for the demangled form of a name,
-   and so sort symbols accordingly.  In Ada, however, we search by mangled
-   name.  If there is no distinct demangled name, then SYMBOL_SEARCH_NAME
-   returns the same value (same pointer) as SYMBOL_LINKAGE_NAME.  */
 #define SYMBOL_SEARCH_NAME(symbol)					 \
-   (symbol_search_name (symbol))
-extern const char *symbol_search_name (const struct general_symbol_info *ginfo);
+   ((symbol)->search_name ())
 
 /* Return true if NAME matches the "search" name of SYMBOL, according
    to the symbol's language.  */
@@ -750,16 +769,6 @@ 
    ? (&(((objfile)->sections)[(symbol)->section]))	\
    : NULL)
 
-#define MSYMBOL_NATURAL_NAME(symbol) \
-  (symbol_natural_name (symbol))
-#define MSYMBOL_LINKAGE_NAME(symbol)	(symbol)->name
-#define MSYMBOL_PRINT_NAME(symbol)					\
-  (demangle ? MSYMBOL_NATURAL_NAME (symbol) : MSYMBOL_LINKAGE_NAME (symbol))
-#define MSYMBOL_DEMANGLED_NAME(symbol) \
-  (symbol_demangled_name (symbol))
-#define MSYMBOL_SEARCH_NAME(symbol)					 \
-   (symbol_search_name (symbol))
-
 #include "minsyms.h"
 
 
@@ -1632,7 +1641,7 @@ 
    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/MSYMBOL_SEARCH_NAME call.  See definition of
+   SYMBOL_SEARCH_NAME/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/x86-tdep.c b/gdb/x86-tdep.c
index 41b209e..fdd9d19 100644
--- a/gdb/x86-tdep.c
+++ b/gdb/x86-tdep.c
@@ -47,7 +47,7 @@ 
   if (bmfun.minsym == nullptr)
     return false;
 
-  const char *name = MSYMBOL_LINKAGE_NAME (bmfun.minsym);
+  const char *name = bmfun.minsym->linkage_name ();
   if (name == nullptr)
     return false;