[2/7] gdb: make lookup_minimal_symbol objf and sfile parameters optional

Message ID 20240717035307.2299961-3-simon.marchi@polymtl.ca
State New
Headers
Series Some more passing down program space |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Simon Marchi July 17, 2024, 3:52 a.m. UTC
  Most calls to lookup_minimal_symbol don't pass a value for sfile and
objf.  Make these parameters optional (have a default value of
nullptr).  And since passing a value to `objf` is much more common than
passing a value to `sfile`, swap the order so `objf` comes first, to
avoid having to pass a nullptr value to `sfile` when wanting to pass a
value to `objf`.

Change-Id: I8e9cc6b942e593bec640f9dfd30f62786b0f5a27
---
 gdb/ada-lang.c                    |  6 +++---
 gdb/ada-tasks.c                   |  5 ++---
 gdb/aix-thread.c                  |  4 ++--
 gdb/arc-linux-tdep.c              |  3 +--
 gdb/arm-tdep.c                    |  5 ++---
 gdb/auxv.c                        |  2 +-
 gdb/avr-tdep.c                    |  2 +-
 gdb/ax-gdb.c                      |  2 +-
 gdb/breakpoint.c                  |  2 +-
 gdb/bsd-uthread.c                 |  2 +-
 gdb/c-exp.y                       |  2 +-
 gdb/coffread.c                    |  2 +-
 gdb/compile/compile-c-symbols.c   |  3 +--
 gdb/compile/compile-object-load.c |  3 +--
 gdb/ctfread.c                     |  2 +-
 gdb/d-lang.c                      |  2 +-
 gdb/dbxread.c                     | 12 ++++++------
 gdb/dwarf2/loc.c                  |  3 +--
 gdb/elfread.c                     |  4 ++--
 gdb/eval.c                        |  2 +-
 gdb/fbsd-tdep.c                   |  2 +-
 gdb/findvar.c                     |  3 +--
 gdb/frame.c                       |  3 +--
 gdb/frv-tdep.c                    |  3 +--
 gdb/ft32-tdep.c                   |  3 +--
 gdb/gcore.c                       |  4 ++--
 gdb/glibc-tdep.c                  |  6 +++---
 gdb/gnu-v3-abi.c                  |  5 ++---
 gdb/go-lang.c                     |  2 +-
 gdb/hppa-tdep.c                   |  2 +-
 gdb/linux-fork.c                  |  9 ++++-----
 gdb/linux-thread-db.c             |  7 ++-----
 gdb/m32c-tdep.c                   | 11 ++++-------
 gdb/m32r-tdep.c                   |  3 +--
 gdb/m68hc11-tdep.c                |  2 +-
 gdb/machoread.c                   |  2 +-
 gdb/minsyms.c                     |  7 +++----
 gdb/minsyms.h                     |  5 +++--
 gdb/mips-linux-tdep.c             |  2 +-
 gdb/netbsd-tdep.c                 |  3 +--
 gdb/objc-lang.c                   | 17 +++++++++--------
 gdb/obsd-tdep.c                   |  2 +-
 gdb/p-lang.c                      |  7 +++----
 gdb/ppc-sysv-tdep.c               |  2 +-
 gdb/proc-service.c                |  2 +-
 gdb/ravenscar-thread.c            | 11 +++++------
 gdb/remote.c                      |  3 +--
 gdb/sol-thread.c                  |  2 +-
 gdb/sol2-tdep.c                   |  2 +-
 gdb/solib-dsbt.c                  |  2 +-
 gdb/solib-frv.c                   |  4 ++--
 gdb/solib-svr4.c                  |  7 +++----
 gdb/symfile.c                     |  6 ++----
 gdb/tracepoint.c                  |  3 +--
 gdb/tui/tui-disasm.c              |  2 +-
 gdb/value.c                       |  3 +--
 gdb/z80-tdep.c                    | 10 ++++------
 57 files changed, 104 insertions(+), 133 deletions(-)
  

Patch

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 4042b2993610..8fddb17b89e5 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -806,7 +806,7 @@  ada_main_name ()
      that string, then most probably the main procedure is not written
      in Ada.  */
   bound_minimal_symbol msym
-    = lookup_minimal_symbol (ADA_MAIN_PROGRAM_SYMBOL_NAME, NULL, NULL);
+    = lookup_minimal_symbol (ADA_MAIN_PROGRAM_SYMBOL_NAME);
 
   if (msym.minsym != NULL)
     {
@@ -11703,7 +11703,7 @@  ada_has_this_exception_support (const struct exception_support_info *einfo)
 	 the catchpoint message, and is also used when trying to catch
 	 a specific exception).  We do not handle this case for now.  */
       bound_minimal_symbol msym
-	= lookup_minimal_symbol (einfo->catch_exception_sym, NULL, NULL);
+	= lookup_minimal_symbol (einfo->catch_exception_sym);
 
       if (msym.minsym && msym.minsym->type () != mst_solib_trampoline)
 	error (_("Your Ada runtime appears to be missing some debugging "
@@ -11723,7 +11723,7 @@  ada_has_this_exception_support (const struct exception_support_info *einfo)
   if (sym == NULL)
     {
       bound_minimal_symbol msym
-	= lookup_minimal_symbol (einfo->catch_handlers_sym, NULL, NULL);
+	= lookup_minimal_symbol (einfo->catch_handlers_sym);
 
       if (msym.minsym && msym.minsym->type () != mst_solib_trampoline)
 	error (_("Your Ada runtime appears to be missing some debugging "
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 745e2afe3716..72a1399369ea 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -920,8 +920,7 @@  ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
 
   /* Try array.  */
 
-  bound_minimal_symbol msym
-    = lookup_minimal_symbol (KNOWN_TASKS_NAME, NULL, NULL);
+  bound_minimal_symbol msym = lookup_minimal_symbol (KNOWN_TASKS_NAME);
   if (msym.minsym != NULL)
     {
       data->known_tasks_kind = ADA_TASKS_ARRAY;
@@ -968,7 +967,7 @@  ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
 
   /* Try list.  */
 
-  msym = lookup_minimal_symbol (KNOWN_TASKS_LIST, NULL, NULL);
+  msym = lookup_minimal_symbol (KNOWN_TASKS_LIST);
   if (msym.minsym != NULL)
     {
       data->known_tasks_kind = ADA_TASKS_LIST;
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 4c3df9c06fa5..847c9006616f 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -395,7 +395,7 @@  pdc_symbol_addrs (pthdb_user_t user_current_pid, pthdb_symbol_t *symbols, int co
 	symbols[i].addr = 0;
       else
 	{
-	  bound_minimal_symbol ms = lookup_minimal_symbol (name, NULL, NULL);
+	  bound_minimal_symbol ms = lookup_minimal_symbol (name);
 	  if (ms.minsym == NULL)
 	    {
 	      if (debug_aix_thread)
@@ -978,7 +978,7 @@  pd_enable (inferior *inf)
     return;
 
   /* Set a breakpoint on the returned stub function.  */
-  bound_minimal_symbol ms = lookup_minimal_symbol (stub_name, NULL, NULL);
+  bound_minimal_symbol ms = lookup_minimal_symbol (stub_name);
   if (ms.minsym == NULL)
     return;
   data->pd_brk_addr = ms.value_address ();
diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c
index bbb8c0706f0c..d71c5bf0185d 100644
--- a/gdb/arc-linux-tdep.c
+++ b/gdb/arc-linux-tdep.c
@@ -506,8 +506,7 @@  arc_linux_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
 
      So we look for the symbol `_dl_linux_resolver', and if we are there,
      gdb sets a breakpoint at the return address, and continues.  */
-  bound_minimal_symbol resolver
-    = lookup_minimal_symbol ("_dl_linux_resolver", NULL, NULL);
+  bound_minimal_symbol resolver = lookup_minimal_symbol ("_dl_linux_resolver");
 
   if (arc_debug)
     {
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 6278113fc82d..f3db28925059 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9388,8 +9388,7 @@  arm_skip_cmse_entry (CORE_ADDR pc, const char *name, struct objfile *objfile)
   char *target_name = (char *) alloca (target_len);
   xsnprintf (target_name, target_len, "%s%s", "__acle_se_", name);
 
-  bound_minimal_symbol minsym
-    = lookup_minimal_symbol (target_name, NULL, objfile);
+  bound_minimal_symbol minsym = lookup_minimal_symbol (target_name, objfile);
   if (minsym.minsym != nullptr)
     return minsym.value_address ();
 
@@ -9478,7 +9477,7 @@  arm_skip_stub (const frame_info_ptr &frame, CORE_ADDR pc)
       sec = find_pc_section (pc);
       objfile = (sec == NULL) ? NULL : sec->objfile;
       bound_minimal_symbol minsym
-	= lookup_minimal_symbol (target_name, NULL, objfile);
+	= lookup_minimal_symbol (target_name, objfile);
       if (minsym.minsym != NULL)
 	return minsym.value_address ();
       else
diff --git a/gdb/auxv.c b/gdb/auxv.c
index b47dcdf88d78..8d259696ea3e 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -90,7 +90,7 @@  ld_so_xfer_auxv (gdb_byte *readbuf,
   LONGEST retval;
   size_t block;
 
-  bound_minimal_symbol msym = lookup_minimal_symbol ("_dl_auxv", NULL, NULL);
+  bound_minimal_symbol msym = lookup_minimal_symbol ("_dl_auxv");
   if (msym.minsym == NULL)
     return TARGET_XFER_E_IO;
 
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 690ecae161f9..dc1eb61be1c5 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -623,7 +623,7 @@  avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
       pc_offset += 2;
 
       bound_minimal_symbol msymbol
-	= lookup_minimal_symbol ("__prologue_saves__", NULL, NULL);
+	= lookup_minimal_symbol ("__prologue_saves__");
       if (!msymbol.minsym)
 	break;
 
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 899abb9743ce..db4dcc2e1d12 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -599,7 +599,7 @@  gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
     case LOC_UNRESOLVED:
       {
 	bound_minimal_symbol msym
-	  = lookup_minimal_symbol (var->linkage_name (), NULL, NULL);
+	  = lookup_minimal_symbol (var->linkage_name ());
 	if (!msym.minsym)
 	  error (_("Couldn't resolve symbol `%s'."), var->print_name ());
 
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index afdf6a950b9e..e5d54d78b9ef 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3754,7 +3754,7 @@  create_std_terminate_master_breakpoint (void)
 	  if (bp_objfile_data->terminate_msym.minsym == NULL)
 	    {
 	      bound_minimal_symbol m
-		= lookup_minimal_symbol (func_name, NULL, objfile);
+		= lookup_minimal_symbol (func_name, objfile);
 	      if (m.minsym == NULL || (m.minsym->type () != mst_text
 				       && m.minsym->type () != mst_file_text))
 		{
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index ecb12ad82fd9..d5beba2e8114 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -157,7 +157,7 @@  static int bsd_uthread_active;
 static CORE_ADDR
 bsd_uthread_lookup_address (const char *name, struct objfile *objfile)
 {
-  bound_minimal_symbol sym = lookup_minimal_symbol (name, NULL, objfile);
+  bound_minimal_symbol sym = lookup_minimal_symbol (name, objfile);
   if (sym.minsym)
     return sym.value_address ();
 
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index a1a74a985a6f..9240552db939 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -3150,7 +3150,7 @@  classify_name (struct parser_state *par_state, const struct block *block,
   if (bsym.symbol == NULL
       && par_state->language ()->la_language == language_cplus
       && is_a_field_of_this.type == NULL
-      && lookup_minimal_symbol (copy.c_str (), NULL, NULL).minsym == NULL)
+      && lookup_minimal_symbol (copy.c_str ()).minsym == nullptr)
     return UNKNOWN_CPP_NAME;
 
   return NAME;
diff --git a/gdb/coffread.c b/gdb/coffread.c
index d4bc7d69e70e..be1e21e8364e 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -579,7 +579,7 @@  coff_read_minsyms (file_ptr symtab_offset, unsigned int nsyms,
 		    name1 += 1;
 
 		  bound_minimal_symbol found
-		    = lookup_minimal_symbol (name1, NULL, objfile);
+		    = lookup_minimal_symbol (name1, objfile);
 
 		  /* If found, there are symbols named "_imp_foo" and "foo"
 		     respectively in OBJFILE.  Set the type of symbol "foo"
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 5e602b9be686..1dffa6be6ad1 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -355,8 +355,7 @@  gcc_convert_symbol (void *datum,
 	}
       else if (request == GCC_C_ORACLE_SYMBOL)
 	{
-	  bound_minimal_symbol bmsym
-	    = lookup_minimal_symbol (identifier, NULL, NULL);
+	  bound_minimal_symbol bmsym = lookup_minimal_symbol (identifier);
 	  if (bmsym.minsym != NULL)
 	    {
 	      convert_symbol_bmsym (context, bmsym);
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 648563217053..cb690863107a 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -764,8 +764,7 @@  compile_object_load (const compile_file_names &file_names,
 	  continue;
 	}
 
-      bound_minimal_symbol bmsym
-	= lookup_minimal_symbol (sym->name, NULL, NULL);
+      bound_minimal_symbol bmsym = lookup_minimal_symbol (sym->name);
       switch (bmsym.minsym == NULL
 	      ? mst_unknown : bmsym.minsym->type ())
 	{
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 42009dcb3bfe..eb7cf3110e0d 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -323,7 +323,7 @@  get_bitsize (ctf_dict_t *fp, ctf_id_t tid, uint32_t kind)
 static void
 set_symbol_address (struct objfile *of, struct symbol *sym, const char *name)
 {
-  bound_minimal_symbol msym = lookup_minimal_symbol (name, nullptr, of);
+  bound_minimal_symbol msym = lookup_minimal_symbol (name, of);
   if (msym.minsym != NULL)
     {
       sym->set_value_address (msym.value_address ());
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 0a9e9b0cb0c5..11c5c03a3cdf 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -38,7 +38,7 @@  static const char D_MAIN[] = "D main";
 const char *
 d_main_name (void)
 {
-  bound_minimal_symbol msym = lookup_minimal_symbol (D_MAIN, NULL, NULL);
+  bound_minimal_symbol msym = lookup_minimal_symbol (D_MAIN);
   if (msym.minsym != NULL)
     return D_MAIN;
 
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 47e56d4d451f..4b2a7d229ff1 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -907,7 +907,7 @@  find_stab_function (const char *namestring, const char *filename,
   strncpy (p, namestring, n);
   p[n] = 0;
 
-  bound_minimal_symbol msym = lookup_minimal_symbol (p, filename, objfile);
+  bound_minimal_symbol msym = lookup_minimal_symbol (p, objfile, filename);
   if (msym.minsym == NULL)
     {
       /* Sun Fortran appends an underscore to the minimal symbol name,
@@ -915,21 +915,21 @@  find_stab_function (const char *namestring, const char *filename,
 	 was not found.  */
       p[n] = '_';
       p[n + 1] = 0;
-      msym = lookup_minimal_symbol (p, filename, objfile);
+      msym = lookup_minimal_symbol (p, objfile, filename);
     }
 
   if (msym.minsym == NULL && filename != NULL)
     {
       /* Try again without the filename.  */
       p[n] = 0;
-      msym = lookup_minimal_symbol (p, NULL, objfile);
+      msym = lookup_minimal_symbol (p, objfile);
     }
   if (msym.minsym == NULL && filename != NULL)
     {
       /* And try again for Sun Fortran, but without the filename.  */
       p[n] = '_';
       p[n + 1] = 0;
-      msym = lookup_minimal_symbol (p, NULL, objfile);
+      msym = lookup_minimal_symbol (p, objfile);
     }
 
   return msym;
@@ -2044,7 +2044,7 @@  dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
       p[n] = 0;
 
       bound_minimal_symbol minsym
-	= lookup_minimal_symbol (p, pst->filename, objfile);
+	= lookup_minimal_symbol (p, objfile, pst->filename);
       if (minsym.minsym == NULL)
 	{
 	  /* Sun Fortran appends an underscore to the minimal symbol name,
@@ -2052,7 +2052,7 @@  dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
 	     was not found.  */
 	  p[n] = '_';
 	  p[n + 1] = 0;
-	  minsym = lookup_minimal_symbol (p, pst->filename, objfile);
+	  minsym = lookup_minimal_symbol (p, objfile, pst->filename);
 	}
 
       if (minsym.minsym)
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 57a4706d2921..06e57be891b0 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -710,8 +710,7 @@  call_site_target::iterate_over_addresses (gdbarch *call_site_gdbarch,
 	physname = m_loc.physname;
 
 	/* Handle both the mangled and demangled PHYSNAME.  */
-	bound_minimal_symbol msym
-	  = lookup_minimal_symbol (physname, NULL, NULL);
+	bound_minimal_symbol msym = lookup_minimal_symbol (physname);
 	if (msym.minsym == NULL)
 	  {
 	    msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1);
diff --git a/gdb/elfread.c b/gdb/elfread.c
index c82e1506fd3f..68b45efb2935 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -842,9 +842,9 @@  elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
 	 CORE_ADDR pointer_address, addr;
 	 asection *plt;
 	 gdb_byte *buf = (gdb_byte *) alloca (ptr_size);
-	 bound_minimal_symbol msym;
 
-	 msym = lookup_minimal_symbol (name_got_plt, NULL, objfile);
+	 bound_minimal_symbol msym
+	   = lookup_minimal_symbol (name_got_plt, objfile);
 	 if (msym.minsym == NULL)
 	   return 0;
 	 if (msym.minsym->type () != mst_slot_got_plt)
diff --git a/gdb/eval.c b/gdb/eval.c
index 40640ae97be7..6e985c2a2a28 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1957,7 +1957,7 @@  eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
   if (value_as_long (target) == 0)
     return value_from_longest (long_type, 0);
 
-  if (lookup_minimal_symbol ("objc_msg_lookup", 0, 0).minsym)
+  if (lookup_minimal_symbol ("objc_msg_lookup").minsym != nullptr)
     gnu_runtime = 1;
 
   /* Find the method dispatch (Apple runtime) or method lookup
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index ad64ecbfb73f..0288e0a17add 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -1943,7 +1943,7 @@  fbsd_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
 static LONGEST
 fbsd_read_integer_by_name (struct gdbarch *gdbarch, const char *name)
 {
-  bound_minimal_symbol ms = lookup_minimal_symbol (name, NULL, NULL);
+  bound_minimal_symbol ms = lookup_minimal_symbol (name);
   if (ms.minsym == NULL)
     error (_("Unable to resolve symbol '%s'"), name);
 
diff --git a/gdb/findvar.c b/gdb/findvar.c
index df4ab1a28b9d..c67315fb6849 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -449,8 +449,7 @@  language_defn::read_var_value (struct symbol *var,
 	  (var->arch (),
 	   [var, &bmsym] (objfile *objfile)
 	     {
-		bmsym = lookup_minimal_symbol (var->linkage_name (), nullptr,
-					       objfile);
+		bmsym = lookup_minimal_symbol (var->linkage_name (), objfile);
 
 		/* Stop if a match is found.  */
 		return bmsym.minsym != nullptr;
diff --git a/gdb/frame.c b/gdb/frame.c
index e6ab54797a8e..8c30979bb2f1 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2584,8 +2584,7 @@  inside_main_func (const frame_info_ptr &this_frame)
   CORE_ADDR sym_addr = 0;
   const char *name = main_name ();
   bound_minimal_symbol msymbol
-    = lookup_minimal_symbol (name, NULL,
-			     current_program_space->symfile_object_file);
+    = lookup_minimal_symbol (name, current_program_space->symfile_object_file);
 
   if (msymbol.minsym != nullptr)
     sym_addr = msymbol.value_address ();
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index b1f79f30cf05..80cc546cea78 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1379,8 +1379,7 @@  frv_frame_this_id (const frame_info_ptr &this_frame,
   func = get_frame_func (this_frame);
 
   /* Check if the stack is empty.  */
-  bound_minimal_symbol msym_stack
-    = lookup_minimal_symbol ("_stack", NULL, NULL);
+  bound_minimal_symbol msym_stack = lookup_minimal_symbol ("_stack");
   if (msym_stack.minsym && info->base == msym_stack.value_address ())
     return;
 
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index e34a619b1390..00dd76353890 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -195,8 +195,7 @@  ft32_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
 
       snprintf (prolog_symbol, sizeof (prolog_symbol), "__prolog_$r%02d",
 		regnum);
-      bound_minimal_symbol msymbol
-	= lookup_minimal_symbol (prolog_symbol, NULL, NULL);
+      bound_minimal_symbol msymbol = lookup_minimal_symbol (prolog_symbol);
       if (msymbol.minsym)
 	prologs[regnum] = msymbol.value_address ();
       else
diff --git a/gdb/gcore.c b/gdb/gcore.c
index 2ab00a0ec352..0f04679a6bbc 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -269,13 +269,13 @@  call_target_sbrk (int sbrk_arg)
   struct value *sbrk_fn, *ret;
   bfd_vma tmp;
 
-  if (lookup_minimal_symbol ("sbrk", NULL, NULL).minsym != NULL)
+  if (lookup_minimal_symbol ("sbrk").minsym != nullptr)
     {
       sbrk_fn = find_function_in_inferior ("sbrk", &sbrk_objf);
       if (sbrk_fn == NULL)
 	return (bfd_vma) 0;
     }
-  else if (lookup_minimal_symbol ("_sbrk", NULL, NULL).minsym != NULL)
+  else if (lookup_minimal_symbol ("_sbrk").minsym != nullptr)
     {
       sbrk_fn = find_function_in_inferior ("_sbrk", &sbrk_objf);
       if (sbrk_fn == NULL)
diff --git a/gdb/glibc-tdep.c b/gdb/glibc-tdep.c
index 0ade1df6b349..493645d9a3b9 100644
--- a/gdb/glibc-tdep.c
+++ b/gdb/glibc-tdep.c
@@ -59,11 +59,11 @@  glibc_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
     {
       /* The dynamic linker began using this name in early 2005.  */
       bound_minimal_symbol fixup
-	= lookup_minimal_symbol ("_dl_fixup", NULL, resolver.objfile);
-      
+	= lookup_minimal_symbol ("_dl_fixup", resolver.objfile);
+
       /* This is the name used in older versions.  */
       if (! fixup.minsym)
-	fixup = lookup_minimal_symbol ("fixup", NULL, resolver.objfile);
+	fixup = lookup_minimal_symbol ("fixup", resolver.objfile);
 
       if (fixup.minsym && fixup.value_address () == pc)
 	return frame_unwind_caller_pc (get_current_frame ());
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 92735b9d6177..70cdde3d2752 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -1160,8 +1160,7 @@  gnuv3_get_typeid (struct value *value)
   else
     {
       std::string sym_name = std::string ("typeinfo for ") + name;
-      bound_minimal_symbol minsym
-	= lookup_minimal_symbol (sym_name.c_str (), NULL, NULL);
+      bound_minimal_symbol minsym = lookup_minimal_symbol (sym_name.c_str ());
 
       if (minsym.minsym == NULL)
 	error (_("could not find typeinfo symbol for '%s'"), name);
@@ -1250,7 +1249,7 @@  gnuv3_skip_trampoline (const frame_info_ptr &frame, CORE_ADDR stop_pc)
 
   fn_name = strstr (thunk_name, " thunk to ") + strlen (" thunk to ");
   bound_minimal_symbol fn_sym
-    = lookup_minimal_symbol (fn_name, NULL, section->objfile);
+    = lookup_minimal_symbol (fn_name, section->objfile);
   if (fn_sym.minsym == NULL)
     return 0;
 
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index bbf4479a6d29..cf1f5a907a62 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -54,7 +54,7 @@  static const char GO_MAIN_MAIN[] = "main.main";
 const char *
 go_main_name (void)
 {
-  bound_minimal_symbol msym = lookup_minimal_symbol (GO_MAIN_MAIN, NULL, NULL);
+  bound_minimal_symbol msym = lookup_minimal_symbol (GO_MAIN_MAIN);
   if (msym.minsym != NULL)
     return GO_MAIN_MAIN;
 
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 43cf46b3c162..0ce754a6ed66 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -194,7 +194,7 @@  hppa_extract_17 (unsigned word)
 CORE_ADDR 
 hppa_symbol_address(const char *sym)
 {
-  bound_minimal_symbol minsym = lookup_minimal_symbol (sym, NULL, NULL);
+  bound_minimal_symbol minsym = lookup_minimal_symbol (sym);
   if (minsym.minsym)
     return minsym.value_address ();
   else
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index e34c5e0b5254..d36511b70fe5 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -484,10 +484,9 @@  inferior_call_waitpid (ptid_t pptid, int pid)
   scoped_switch_fork_info switch_fork_info (pptid);
 
   /* Get the waitpid_fn.  */
-  if (lookup_minimal_symbol ("waitpid", NULL, NULL).minsym != NULL)
+  if (lookup_minimal_symbol ("waitpid").minsym != nullptr)
     waitpid_fn = find_function_in_inferior ("waitpid", &waitpid_objf);
-  if (!waitpid_fn
-      && lookup_minimal_symbol ("_waitpid", NULL, NULL).minsym != NULL)
+  if (!waitpid_fn && lookup_minimal_symbol ("_waitpid").minsym != nullptr)
     waitpid_fn = find_function_in_inferior ("_waitpid", &waitpid_objf);
   if (waitpid_fn != nullptr)
     {
@@ -701,10 +700,10 @@  checkpoint_command (const char *args, int from_tty)
   
   /* Make the inferior fork, record its (and gdb's) state.  */
 
-  if (lookup_minimal_symbol ("fork", NULL, NULL).minsym != NULL)
+  if (lookup_minimal_symbol ("fork").minsym != nullptr)
     fork_fn = find_function_in_inferior ("fork", &fork_objf);
   if (!fork_fn)
-    if (lookup_minimal_symbol ("_fork", NULL, NULL).minsym != NULL)
+    if (lookup_minimal_symbol ("_fork").minsym != nullptr)
       fork_fn = find_function_in_inferior ("fork", &fork_objf);
   if (!fork_fn)
     error (_("checkpoint: can't find fork function in inferior."));
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 0a63957a0161..6abaa20c594e 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -470,8 +470,7 @@  inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min)
   CORE_ADDR version_addr;
   int got, retval = 0;
 
-  bound_minimal_symbol version_msym
-    = lookup_minimal_symbol (ver_symbol, NULL, NULL);
+  bound_minimal_symbol version_msym = lookup_minimal_symbol (ver_symbol);
   if (version_msym.minsym == NULL)
     return 0;
 
@@ -810,9 +809,7 @@  static bool
 libpthread_objfile_p (objfile *obj)
 {
   return (libpthread_name_p (objfile_name (obj))
-	  && lookup_minimal_symbol ("pthread_create",
-				    NULL,
-				    obj).minsym != NULL);
+	  && lookup_minimal_symbol ("pthread_create", obj).minsym != nullptr);
 }
 
 /* Attempt to initialize dlopen()ed libthread_db, described by INFO.
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index db859bc93d7e..3531fbb899ba 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -2212,8 +2212,7 @@  m32c_return_value (struct gdbarch *gdbarch,
 	  /* Everything else is passed in mem0, using as many bytes as
 	     needed.  This is not what the Renesas tools do, but it's
 	     what GCC does at the moment.  */
-	  bound_minimal_symbol mem0
-	    = lookup_minimal_symbol ("mem0", NULL, NULL);
+	  bound_minimal_symbol mem0 = lookup_minimal_symbol ("mem0");
 
 	  if (! mem0.minsym)
 	    error (_("The return value is stored in memory at 'mem0', "
@@ -2244,8 +2243,7 @@  m32c_return_value (struct gdbarch *gdbarch,
 	  /* Everything else is passed in mem0, using as many bytes as
 	     needed.  This is not what the Renesas tools do, but it's
 	     what GCC does at the moment.  */
-	  bound_minimal_symbol mem0
-	    = lookup_minimal_symbol ("mem0", NULL, NULL);
+	  bound_minimal_symbol mem0 = lookup_minimal_symbol ("mem0");
 
 	  if (! mem0.minsym)
 	    error (_("The return value is stored in memory at 'mem0', "
@@ -2436,8 +2434,7 @@  m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
       strcat (tramp_name, ".plt");
 
       /* Try to find a linker symbol for the trampoline.  */
-      bound_minimal_symbol tramp_msym
-	= lookup_minimal_symbol (tramp_name, NULL, NULL);
+      bound_minimal_symbol tramp_msym = lookup_minimal_symbol (tramp_name);
 
       /* We've either got another copy of the name now, or don't need
 	 the name any more.  */
@@ -2521,7 +2518,7 @@  m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
 	      memcpy (func_name, ptr_msym_name, len - 4);
 	      func_name[len - 4] = '\0';
 	      bound_minimal_symbol func_msym
-		= lookup_minimal_symbol (func_name, NULL, NULL);
+		= lookup_minimal_symbol (func_name);
 
 	      /* If we do have such a symbol, return its value as the
 		 function's true address.  */
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index b41d8a5a1f28..4899c1556669 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -806,8 +806,7 @@  m32r_frame_this_id (const frame_info_ptr &this_frame,
   func = get_frame_func (this_frame);
 
   /* Check if the stack is empty.  */
-  bound_minimal_symbol msym_stack
-    = lookup_minimal_symbol ("_stack", NULL, NULL);
+  bound_minimal_symbol msym_stack = lookup_minimal_symbol ("_stack");
   if (msym_stack.minsym && info->base == msym_stack.value_address ())
     return;
 
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 4093d2b6ee6e..8075dbb0508a 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -210,7 +210,7 @@  static int soft_reg_initialized = 0;
 static void
 m68hc11_get_register_info (struct m68hc11_soft_reg *reg, const char *name)
 {
-  bound_minimal_symbol msymbol = lookup_minimal_symbol (name, NULL, NULL);
+  bound_minimal_symbol msymbol = lookup_minimal_symbol (name);
   if (msymbol.minsym)
     {
       reg->addr = msymbol.value_address ();
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 2f2874a7ab2d..5840b663bbeb 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -396,7 +396,7 @@  macho_resolve_oso_sym_with_minsym (struct objfile *main_objfile, asymbol *sym)
       && *name == bfd_get_symbol_leading_char (main_objfile->obfd.get ()))
     ++name;
 
-  bound_minimal_symbol msym = lookup_minimal_symbol (name, NULL, main_objfile);
+  bound_minimal_symbol msym = lookup_minimal_symbol (name, main_objfile);
   if (msym.minsym == NULL)
     {
       warning (_("can't find symbol '%s' in minsymtab"), name);
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 49381dd84f7c..bc6ab516a614 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -359,8 +359,7 @@  lookup_minimal_symbol_demangled (const lookup_name_info &lookup_name,
    but the demangled names are all the same: S::S or S::~S.  */
 
 bound_minimal_symbol
-lookup_minimal_symbol (const char *name, const char *sfile,
-		       struct objfile *objf)
+lookup_minimal_symbol (const char *name, objfile *objf, const char *sfile)
 {
   found_minimal_symbols found;
 
@@ -479,7 +478,7 @@  lookup_minimal_symbol (const char *name, const char *sfile,
 bound_minimal_symbol
 lookup_bound_minimal_symbol (const char *name)
 {
-  return lookup_minimal_symbol (name, NULL, NULL);
+  return lookup_minimal_symbol (name);
 }
 
 /* See gdbsupport/symbol.h.  */
@@ -488,7 +487,7 @@  int
 find_minimal_symbol_address (const char *name, CORE_ADDR *addr,
 			     struct objfile *objfile)
 {
-  bound_minimal_symbol sym = lookup_minimal_symbol (name, NULL, objfile);
+  bound_minimal_symbol sym = lookup_minimal_symbol (name, objfile);
   if (sym.minsym != NULL)
     *addr = sym.value_address ();
 
diff --git a/gdb/minsyms.h b/gdb/minsyms.h
index ab80c293362f..f8d4117f7b9d 100644
--- a/gdb/minsyms.h
+++ b/gdb/minsyms.h
@@ -205,8 +205,9 @@  unsigned int msymbol_hash_iw (const char *);
    symbols are still preferred).  Returns a bound minimal symbol that
    matches, or an empty bound minimal symbol if no match is found.  */
 
-bound_minimal_symbol lookup_minimal_symbol (const char *, const char *,
-					    struct objfile *);
+bound_minimal_symbol lookup_minimal_symbol (const char *name,
+					    objfile *obj = nullptr,
+					    const char *sfile = nullptr);
 
 /* Like lookup_minimal_symbol, but searches all files and
    objfiles.  */
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 5050702c0d66..4b3754c314a2 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -699,7 +699,7 @@  static CORE_ADDR
 mips_linux_skip_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
   bound_minimal_symbol resolver
-    = lookup_minimal_symbol ("__dl_runtime_resolve", NULL, NULL);
+    = lookup_minimal_symbol ("__dl_runtime_resolve");
 
   if (resolver.minsym && resolver.value_address () == pc)
     return frame_unwind_caller_pc (get_current_frame ());
diff --git a/gdb/netbsd-tdep.c b/gdb/netbsd-tdep.c
index 18155a25a51c..4d2c41294464 100644
--- a/gdb/netbsd-tdep.c
+++ b/gdb/netbsd-tdep.c
@@ -348,8 +348,7 @@  nbsd_gdb_signal_to_target (struct gdbarch *gdbarch,
 static CORE_ADDR
 nbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  bound_minimal_symbol msym
-    = lookup_minimal_symbol ("_rtld_bind_start", NULL, NULL);
+  bound_minimal_symbol msym = lookup_minimal_symbol ("_rtld_bind_start");
   if (msym.minsym && msym.value_address () == pc)
     return frame_unwind_caller_pc (get_current_frame ());
   else
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index fc1d81c01d2b..1054297c70f0 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -120,9 +120,9 @@  lookup_objc_class (struct gdbarch *gdbarch, const char *classname)
       return 0;
     }
 
-  if (lookup_minimal_symbol("objc_lookUpClass", 0, 0).minsym)
+  if (lookup_minimal_symbol ("objc_lookUpClass").minsym != nullptr)
     function = find_function_in_inferior("objc_lookUpClass", NULL);
-  else if (lookup_minimal_symbol ("objc_lookup_class", 0, 0).minsym)
+  else if (lookup_minimal_symbol ("objc_lookup_class").minsym != nullptr)
     function = find_function_in_inferior("objc_lookup_class", NULL);
   else
     {
@@ -149,9 +149,9 @@  lookup_child_selector (struct gdbarch *gdbarch, const char *selname)
       return 0;
     }
 
-  if (lookup_minimal_symbol("sel_getUid", 0, 0).minsym)
+  if (lookup_minimal_symbol ("sel_getUid").minsym != nullptr)
     function = find_function_in_inferior("sel_getUid", NULL);
-  else if (lookup_minimal_symbol ("sel_get_any_uid", 0, 0).minsym)
+  else if (lookup_minimal_symbol ("sel_get_any_uid").minsym != nullptr)
     function = find_function_in_inferior("sel_get_any_uid", NULL);
   else
     {
@@ -180,17 +180,18 @@  value_nsstring (struct gdbarch *gdbarch, const char *ptr, int len)
   stringValue[2] = value_string(ptr, len, char_type);
   stringValue[2] = value_coerce_array(stringValue[2]);
   /* _NSNewStringFromCString replaces "istr" after Lantern2A.  */
-  if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0).minsym)
+  if (lookup_minimal_symbol ("_NSNewStringFromCString").minsym != nullptr)
     {
       function = find_function_in_inferior("_NSNewStringFromCString", NULL);
       nsstringValue = call_function_by_hand(function, NULL, stringValue[2]);
     }
-  else if (lookup_minimal_symbol("istr", 0, 0).minsym)
+  else if (lookup_minimal_symbol ("istr").minsym != nullptr)
     {
       function = find_function_in_inferior("istr", NULL);
       nsstringValue = call_function_by_hand(function, NULL, stringValue[2]);
     }
-  else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0).minsym)
+  else if (lookup_minimal_symbol ("+[NSString stringWithCString:]").minsym
+	   != nullptr)
     {
       function
 	= find_function_in_inferior("+[NSString stringWithCString:]", NULL);
@@ -1137,7 +1138,7 @@  find_imps (const char *method, std::vector<const char *> *symbol_names)
 	symbol_names->push_back (sym->natural_name ());
       else
 	{
-	  bound_minimal_symbol msym = lookup_minimal_symbol (selector, 0, 0);
+	  bound_minimal_symbol msym = lookup_minimal_symbol (selector);
 
 	  if (msym.minsym != NULL) 
 	    symbol_names->push_back (msym.minsym->natural_name ());
diff --git a/gdb/obsd-tdep.c b/gdb/obsd-tdep.c
index fab05b751edf..755e612823e7 100644
--- a/gdb/obsd-tdep.c
+++ b/gdb/obsd-tdep.c
@@ -27,7 +27,7 @@ 
 CORE_ADDR
 obsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  bound_minimal_symbol msym = lookup_minimal_symbol ("_dl_bind", NULL, NULL);
+  bound_minimal_symbol msym = lookup_minimal_symbol ("_dl_bind");
   if (msym.minsym && msym.value_address () == pc)
     return frame_unwind_caller_pc (get_current_frame ());
   else
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 9a8a35d01485..70f28c980d94 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -59,21 +59,20 @@  static const char GPC_MAIN_PROGRAM_NAME_2[] = "pascal_main_program";
 const char *
 pascal_main_name (void)
 {
-  bound_minimal_symbol msym
-    = lookup_minimal_symbol (GPC_P_INITIALIZE, NULL, NULL);
+  bound_minimal_symbol msym = lookup_minimal_symbol (GPC_P_INITIALIZE);
 
   /*  If '_p_initialize' was not found, the main program is likely not
      written in Pascal.  */
   if (msym.minsym == NULL)
     return NULL;
 
-  msym = lookup_minimal_symbol (GPC_MAIN_PROGRAM_NAME_1, NULL, NULL);
+  msym = lookup_minimal_symbol (GPC_MAIN_PROGRAM_NAME_1);
   if (msym.minsym != NULL)
     {
       return GPC_MAIN_PROGRAM_NAME_1;
     }
 
-  msym = lookup_minimal_symbol (GPC_MAIN_PROGRAM_NAME_2, NULL, NULL);
+  msym = lookup_minimal_symbol (GPC_MAIN_PROGRAM_NAME_2);
   if (msym.minsym != NULL)
     {
       return GPC_MAIN_PROGRAM_NAME_2;
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 041f83dbfbd6..cdba46c2a88a 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1060,7 +1060,7 @@  convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr)
      - avoids problems when two object files (i.e., shared libraries)
      contain a minimal symbol with the same name.  */
   bound_minimal_symbol fn
-    = lookup_minimal_symbol (dot_fn.minsym->linkage_name () + 1, NULL,
+    = lookup_minimal_symbol (dot_fn.minsym->linkage_name () + 1,
 			     dot_fn_section->objfile);
   if (fn.minsym == NULL)
     return 0;
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index 1889a001a1dd..bf57efd6c1fa 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -99,7 +99,7 @@  ps_pglobal_lookup (struct ps_prochandle *ph, const char *obj,
   set_current_program_space (inf->pspace);
 
   /* FIXME: kettenis/2000-09-03: What should we do with OBJ?  */
-  bound_minimal_symbol ms = lookup_minimal_symbol (name, NULL, NULL);
+  bound_minimal_symbol ms = lookup_minimal_symbol (name);
   if (ms.minsym == NULL)
     return PS_NOSYM;
 
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 9100a2c68be5..68c2978a92ed 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -329,14 +329,13 @@  ravenscar_thread_target::add_active_thread ()
 static bound_minimal_symbol
 get_running_thread_msymbol ()
 {
-  bound_minimal_symbol msym
-    = lookup_minimal_symbol (running_thread_name, NULL, NULL);
+  bound_minimal_symbol msym = lookup_minimal_symbol (running_thread_name);
   if (!msym.minsym)
     /* Older versions of the GNAT runtime were using a different
        (less ideal) name for the symbol where the active thread ID
        is stored.  If we couldn't find the symbol using the latest
        name, then try the old one.  */
-    msym = lookup_minimal_symbol ("running_thread", NULL, NULL);
+    msym = lookup_minimal_symbol ("running_thread");
 
   return msym;
 }
@@ -348,11 +347,11 @@  static bool
 has_ravenscar_runtime ()
 {
   bound_minimal_symbol msym_ravenscar_runtime_initializer
-    = lookup_minimal_symbol (ravenscar_runtime_initializer, NULL, NULL);
+    = lookup_minimal_symbol (ravenscar_runtime_initializer);
   bound_minimal_symbol msym_known_tasks
-    = lookup_minimal_symbol (known_tasks_name, NULL, NULL);
+    = lookup_minimal_symbol (known_tasks_name);
   bound_minimal_symbol msym_first_task
-    = lookup_minimal_symbol (first_task_name, NULL, NULL);
+    = lookup_minimal_symbol (first_task_name);
   bound_minimal_symbol msym_running_thread = get_running_thread_msymbol ();
 
   return (msym_ravenscar_runtime_initializer.minsym
diff --git a/gdb/remote.c b/gdb/remote.c
index a3f36f66e12a..aba609d9eb6c 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -5518,8 +5518,7 @@  remote_target::remote_check_symbols ()
       end = hex2bin (tmp, reinterpret_cast <gdb_byte *> (msg.data ()),
 		     strlen (tmp) / 2);
       msg[end] = '\0';
-      bound_minimal_symbol sym
-	= lookup_minimal_symbol (msg.data (), NULL, NULL);
+      bound_minimal_symbol sym = lookup_minimal_symbol (msg.data ());
       if (sym.minsym == NULL)
 	xsnprintf (msg.data (), get_remote_packet_size (), "qSymbol::%s",
 		   &reply[8]);
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index e09973e90dd0..25b6aa37ec0e 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -759,7 +759,7 @@  ps_err_e
 ps_pglobal_lookup (struct ps_prochandle *ph, const char *ld_object_name,
 		   const char *ld_symbol_name, psaddr_t *ld_symbol_addr)
 {
-  bound_minimal_symbol ms = lookup_minimal_symbol (ld_symbol_name, NULL, NULL);
+  bound_minimal_symbol ms = lookup_minimal_symbol (ld_symbol_name);
   if (!ms.minsym)
     return PS_NOSYM;
 
diff --git a/gdb/sol2-tdep.c b/gdb/sol2-tdep.c
index b3eb8280f14d..3081726a5e10 100644
--- a/gdb/sol2-tdep.c
+++ b/gdb/sol2-tdep.c
@@ -63,7 +63,7 @@  sol2_sigtramp_p (const frame_info_ptr &this_frame)
 static CORE_ADDR
 sol2_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  bound_minimal_symbol msym = lookup_minimal_symbol ("elf_bndr", NULL, NULL);
+  bound_minimal_symbol msym = lookup_minimal_symbol ("elf_bndr");
   if (msym.minsym && msym.value_address () == pc)
     return frame_unwind_caller_pc (get_current_frame ());
 
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 9840255895bd..6ea9a1326db6 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -451,7 +451,7 @@  lm_base (void)
     return info->lm_base_cache;
 
   bound_minimal_symbol got_sym
-    = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL,
+    = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_",
 			     current_program_space->symfile_object_file);
 
   if (got_sym.minsym != 0)
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index f51bc9a73417..c979135fafa8 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -280,7 +280,7 @@  lm_base (void)
     return lm_base_cache;
 
   bound_minimal_symbol got_sym
-    = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL,
+    = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_",
 			     current_program_space->symfile_object_file);
   if (got_sym.minsym == 0)
     {
@@ -840,7 +840,7 @@  main_got (void)
 {
   objfile *objf = current_program_space->symfile_object_file;
   bound_minimal_symbol got_sym
-    = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, objf);
+    = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", objf);
   if (got_sym.minsym == 0)
     return 0;
 
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 491388786885..13a6ac0f83d1 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -751,7 +751,7 @@  elf_locate_base (void)
   /* This may be a static executable.  Look for the symbol
      conventionally named _r_debug, as a last resort.  */
   bound_minimal_symbol msymbol
-    = lookup_minimal_symbol ("_r_debug", NULL,
+    = lookup_minimal_symbol ("_r_debug",
 			     current_program_space->symfile_object_file);
   if (msymbol.minsym != NULL)
     return msymbol.value_address ();
@@ -2481,8 +2481,7 @@  enable_break (struct svr4_info *info, int from_tty)
   objfile *objf = current_program_space->symfile_object_file;
   for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
     {
-      bound_minimal_symbol msymbol
-	= lookup_minimal_symbol (*bkpt_namep, NULL, objf);
+      bound_minimal_symbol msymbol = lookup_minimal_symbol (*bkpt_namep, objf);
       if ((msymbol.minsym != NULL)
 	  && (msymbol.value_address () != 0))
 	{
@@ -2502,7 +2501,7 @@  enable_break (struct svr4_info *info, int from_tty)
       for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
 	{
 	  bound_minimal_symbol msymbol
-	    = lookup_minimal_symbol (*bkpt_namep, NULL, objf);
+	    = lookup_minimal_symbol (*bkpt_namep, objf);
 	  if ((msymbol.minsym != NULL)
 	      && (msymbol.value_address () != 0))
 	    {
diff --git a/gdb/symfile.c b/gdb/symfile.c
index b2d0b0f50b36..76433293fa39 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3433,8 +3433,7 @@  simple_read_overlay_table (void)
   enum bfd_endian byte_order;
 
   simple_free_overlay_table ();
-  bound_minimal_symbol novlys_msym
-    = lookup_minimal_symbol ("_novlys", NULL, NULL);
+  bound_minimal_symbol novlys_msym = lookup_minimal_symbol ("_novlys");
   if (! novlys_msym.minsym)
     {
       error (_("Error reading inferior's overlay table: "
@@ -3523,8 +3522,7 @@  simple_overlay_update (struct obj_section *osect)
       {
 	/* Does its cached location match what's currently in the
 	   symtab?  */
-	bound_minimal_symbol minsym
-	  = lookup_minimal_symbol ("_ovly_table", NULL, NULL);
+	bound_minimal_symbol minsym = lookup_minimal_symbol ("_ovly_table");
 
 	if (minsym.minsym == NULL)
 	  error (_("Error reading inferior's overlay table: couldn't "
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index f95555769e12..2f2366bd83a6 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2580,8 +2580,7 @@  info_scope_command (const char *args_in, int from_tty)
 		case LOC_UNRESOLVED:
 		  {
 		    bound_minimal_symbol msym
-		      = lookup_minimal_symbol (sym->linkage_name (), NULL,
-					       NULL);
+		      = lookup_minimal_symbol (sym->linkage_name ());
 		    if (msym.minsym == NULL)
 		      gdb_printf ("Unresolved Static");
 		    else
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 6ec8216114d2..c37c20e90bda 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -403,7 +403,7 @@  tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
       if (addr == 0)
 	{
 	  bound_minimal_symbol main_symbol
-	    = lookup_minimal_symbol (main_name (), nullptr, nullptr);
+	    = lookup_minimal_symbol (main_name ());
 	  if (main_symbol.minsym != nullptr)
 	    addr = main_symbol.value_address ();
 	}
diff --git a/gdb/value.c b/gdb/value.c
index 366c66ba2b23..0cf6e2a0ffc5 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2933,8 +2933,7 @@  value_static_field (struct type *type, int fieldno)
 	{
 	  /* With some compilers, e.g. HP aCC, static data members are
 	     reported as non-debuggable symbols.  */
-	  bound_minimal_symbol msym
-	    = lookup_minimal_symbol (phys_name, NULL, NULL);
+	  bound_minimal_symbol msym = lookup_minimal_symbol (phys_name);
 	  struct type *field_type = type->field (fieldno).type ();
 
 	  if (!msym.minsym)
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index e290b65343f9..f04724f18bad 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -356,8 +356,7 @@  z80_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
   /* stage2: check for FP saving scheme */
   if (prologue[pos] == 0xcd) /* call nn */
     {
-      bound_minimal_symbol msymbol
-	= lookup_minimal_symbol ("__sdcc_enter_ix", NULL, NULL);
+      bound_minimal_symbol msymbol = lookup_minimal_symbol ("__sdcc_enter_ix");
       if (msymbol.minsym)
 	{
 	  value = msymbol.value_address ();
@@ -622,7 +621,7 @@  z80_frame_unwind_cache (const frame_info_ptr &this_frame,
 	      for (i = sizeof(names)/sizeof(*names)-1; i >= 0; --i)
 		{
 		  bound_minimal_symbol msymbol
-		    = lookup_minimal_symbol (names[i], NULL, NULL);
+		    = lookup_minimal_symbol (names[i]);
 		  if (!msymbol.minsym)
 		    continue;
 		  if (addr == msymbol.value_address ())
@@ -719,8 +718,7 @@  z80_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
   static int addr = -1;
   if (addr == -1)
     {
-      bound_minimal_symbol bh
-	= lookup_minimal_symbol ("_break_handler", NULL, NULL);
+      bound_minimal_symbol bh = lookup_minimal_symbol ("_break_handler");
       if (bh.minsym)
 	addr = bh.value_address ();
       else
@@ -900,7 +898,7 @@  z80_read_overlay_region_table ()
 
   z80_free_overlay_region_table ();
   bound_minimal_symbol novly_regions_msym
-    = lookup_minimal_symbol ("_novly_regions", NULL, NULL);
+    = lookup_minimal_symbol ("_novly_regions");
   if (! novly_regions_msym.minsym)
     {
       error (_("Error reading inferior's overlay table: "