[3/7] gdb: remove lookup_bound_minimal_symbol

Message ID 20240717035307.2299961-4-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
  From: Simon Marchi <simon.marchi@efficios.com>

Now that lookup_minimal_symbol has default values for sfile and objf,
calling lookup_bound_minimal_symbol is identical to calling
lookup_minimal_symbol without sfile and objf.  Remove
lookup_bound_minimal_symbol, replace call sites with
lookup_minimal_symbol.

Change-Id: I0a420fb56de1de8bee8a7303228c9e4546e3577b
---
 gdb/ada-tasks.c                     | 2 +-
 gdb/c-exp.y                         | 2 +-
 gdb/coff-pe-read.c                  | 4 ++--
 gdb/compile/compile-c-symbols.c     | 2 +-
 gdb/compile/compile-cplus-symbols.c | 2 +-
 gdb/d-exp.y                         | 2 +-
 gdb/fbsd-tdep.c                     | 2 +-
 gdb/glibc-tdep.c                    | 2 +-
 gdb/go-exp.y                        | 2 +-
 gdb/minsyms.c                       | 8 --------
 gdb/minsyms.h                       | 5 -----
 gdb/mips-fbsd-tdep.c                | 2 +-
 gdb/objc-lang.c                     | 5 ++---
 gdb/p-exp.y                         | 2 +-
 gdb/parse.c                         | 4 ++--
 gdb/printcmd.c                      | 4 ++--
 gdb/symfile.c                       | 3 +--
 gdb/valops.c                        | 2 +-
 gdb/value.c                         | 2 +-
 gdb/z80-tdep.c                      | 2 +-
 20 files changed, 22 insertions(+), 37 deletions(-)
  

Patch

diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 72a1399369ea..43a63f863559 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -600,7 +600,7 @@  ada_get_tcb_types_info (void)
 
   /* Check for the CPU offset.  */
   bound_minimal_symbol first_id_sym
-    = lookup_bound_minimal_symbol ("__gnat_gdb_cpu_first_id");
+    = lookup_minimal_symbol ("__gnat_gdb_cpu_first_id");
   unsigned int first_id = 0;
   if (first_id_sym.minsym != nullptr)
     {
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 9240552db939..a06a00007bce 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1210,7 +1210,7 @@  variable:	name_not_typename
 			      std::string arg = copy_name ($1.stoken);
 
 			      bound_minimal_symbol msymbol
-				= lookup_bound_minimal_symbol (arg.c_str ());
+				= lookup_minimal_symbol (arg.c_str ());
 			      if (msymbol.minsym == NULL)
 				{
 				  if (!have_full_symbols (current_program_space)
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index 9d087212b8c1..9cfa1a372976 100644
--- a/gdb/coff-pe-read.c
+++ b/gdb/coff-pe-read.c
@@ -183,14 +183,14 @@  add_pe_forwarded_sym (minimal_symbol_reader &reader,
 						      forward_func_name);
 
   bound_minimal_symbol msymbol
-    = lookup_bound_minimal_symbol (forward_qualified_name.c_str ());
+    = lookup_minimal_symbol (forward_qualified_name.c_str ());
   if (!msymbol.minsym)
     {
       int i;
 
       for (i = 0; i < forward_dll_name_len; i++)
 	forward_qualified_name[i] = tolower (forward_qualified_name[i]);
-      msymbol = lookup_bound_minimal_symbol (forward_qualified_name.c_str ());
+      msymbol = lookup_minimal_symbol (forward_qualified_name.c_str ());
     }
 
   if (!msymbol.minsym)
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 1dffa6be6ad1..e2af722c8170 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -410,7 +410,7 @@  gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
 	}
       else
 	{
-	  bound_minimal_symbol msym = lookup_bound_minimal_symbol (identifier);
+	  bound_minimal_symbol msym = lookup_minimal_symbol (identifier);
 	  if (msym.minsym != NULL)
 	    {
 	      if (compile_debug)
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index 45b965a30fa3..7e251a6ef0a2 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -453,7 +453,7 @@  gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
 	}
       else
 	{
-	  bound_minimal_symbol msym = lookup_bound_minimal_symbol (identifier);
+	  bound_minimal_symbol msym = lookup_minimal_symbol (identifier);
 	  if (msym.minsym != nullptr)
 	    {
 	      if (compile_debug)
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index f4de994ae4d6..9fc63afaa1c1 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -464,7 +464,7 @@  PrimaryExpression:
 		    {
 		      /* Lookup foreign name in global static symbols.  */
 		      bound_minimal_symbol msymbol
-			= lookup_bound_minimal_symbol (copy.c_str ());
+			= lookup_minimal_symbol (copy.c_str ());
 		      if (msymbol.minsym != NULL)
 			pstate->push_new<var_msym_value_operation> (msymbol);
 		      else if (!have_full_symbols (current_program_space)
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 0288e0a17add..e2a7a4045c90 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -2057,7 +2057,7 @@  fbsd_get_thread_local_address (struct gdbarch *gdbarch, CORE_ADDR dtv_addr,
 CORE_ADDR
 fbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  bound_minimal_symbol msym = lookup_bound_minimal_symbol ("_rtld_bind");
+  bound_minimal_symbol msym = lookup_minimal_symbol ("_rtld_bind");
   if (msym.minsym != nullptr && msym.value_address () == pc)
     return frame_unwind_caller_pc (get_current_frame ());
 
diff --git a/gdb/glibc-tdep.c b/gdb/glibc-tdep.c
index 493645d9a3b9..8f27133faea7 100644
--- a/gdb/glibc-tdep.c
+++ b/gdb/glibc-tdep.c
@@ -53,7 +53,7 @@  glibc_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
      debugging programs that use shared libraries.  */
 
   bound_minimal_symbol resolver
-    = lookup_bound_minimal_symbol ("_dl_runtime_resolve");
+    = lookup_minimal_symbol ("_dl_runtime_resolve");
 
   if (resolver.minsym)
     {
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index 345b2315d3af..ce2b7e619671 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -572,7 +572,7 @@  variable:	name_not_typename
 			      std::string arg = copy_name ($1.stoken);
 
 			      bound_minimal_symbol msymbol =
-				lookup_bound_minimal_symbol (arg.c_str ());
+				lookup_minimal_symbol (arg.c_str ());
 			      if (msymbol.minsym != NULL)
 				pstate->push_new<var_msym_value_operation>
 				  (msymbol);
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index bc6ab516a614..31e8e7d2a194 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -473,14 +473,6 @@  lookup_minimal_symbol (const char *name, objfile *objf, const char *sfile)
   return {};
 }
 
-/* See minsyms.h.  */
-
-bound_minimal_symbol
-lookup_bound_minimal_symbol (const char *name)
-{
-  return lookup_minimal_symbol (name);
-}
-
 /* See gdbsupport/symbol.h.  */
 
 int
diff --git a/gdb/minsyms.h b/gdb/minsyms.h
index f8d4117f7b9d..b05ca2bda740 100644
--- a/gdb/minsyms.h
+++ b/gdb/minsyms.h
@@ -209,11 +209,6 @@  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.  */
-
-bound_minimal_symbol lookup_bound_minimal_symbol (const char *);
-
 /* Look through all the current minimal symbol tables and find the
    first minimal symbol that matches NAME and has text type.  If OBJF
    is non-NULL, limit the search to that objfile.  Returns a bound
diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c
index 717c9c5dae47..22881e8a9c10 100644
--- a/gdb/mips-fbsd-tdep.c
+++ b/gdb/mips-fbsd-tdep.c
@@ -468,7 +468,7 @@  static const struct tramp_frame mips64_fbsd_sigframe =
 static CORE_ADDR
 mips_fbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  bound_minimal_symbol msym = lookup_bound_minimal_symbol ("_mips_rtld_bind");
+  bound_minimal_symbol msym = lookup_minimal_symbol ("_mips_rtld_bind");
   if (msym.minsym != nullptr && msym.value_address () == pc)
     return frame_unwind_caller_pc (get_current_frame ());
 
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 1054297c70f0..3d50d1019c82 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -1241,11 +1241,10 @@  find_objc_msgsend (void)
   for (i = 0; i < nmethcalls; i++)
     {
       /* Try both with and without underscore.  */
-      bound_minimal_symbol func
-	= lookup_bound_minimal_symbol (methcalls[i].name);
+      bound_minimal_symbol func = lookup_minimal_symbol (methcalls[i].name);
       if ((func.minsym == NULL) && (methcalls[i].name[0] == '_'))
 	{
-	  func = lookup_bound_minimal_symbol (methcalls[i].name + 1);
+	  func = lookup_minimal_symbol (methcalls[i].name + 1);
 	}
       if (func.minsym == NULL)
 	{ 
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 77f853b5e6be..7476176c9572 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -720,7 +720,7 @@  variable:	name_not_typename
 			      std::string arg = copy_name ($1.stoken);
 
 			      bound_minimal_symbol msymbol
-				= lookup_bound_minimal_symbol (arg.c_str ());
+				= lookup_minimal_symbol (arg.c_str ());
 			      if (msymbol.minsym != NULL)
 				pstate->push_new<var_msym_value_operation>
 				  (msymbol);
diff --git a/gdb/parse.c b/gdb/parse.c
index 1b602a74f5c4..d5bbc4dec58a 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -145,7 +145,7 @@  parser_state::push_symbol (const char *name, block_symbol sym)
     }
   else
     {
-      bound_minimal_symbol msymbol = lookup_bound_minimal_symbol (name);
+      bound_minimal_symbol msymbol = lookup_minimal_symbol (name);
       if (msymbol.minsym != NULL)
 	push_new<expr::var_msym_value_operation> (msymbol);
       else if (!have_full_symbols (current_program_space)
@@ -231,7 +231,7 @@  parser_state::push_dollar (struct stoken str)
       push_new<expr::var_value_operation> (sym);
       return;
     }
-  bound_minimal_symbol msym = lookup_bound_minimal_symbol (copy.c_str ());
+  bound_minimal_symbol msym = lookup_minimal_symbol (copy.c_str ());
   if (msym.minsym)
     {
       push_new<expr::var_msym_value_operation> (msym);
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 8e025839cf4c..d2d5497913c6 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1600,7 +1600,7 @@  info_address_command (const char *exp, int from_tty)
 	  return;
 	}
 
-      bound_minimal_symbol msymbol = lookup_bound_minimal_symbol (exp);
+      bound_minimal_symbol msymbol = lookup_minimal_symbol (exp);
 
       if (msymbol.minsym != NULL)
 	{
@@ -1753,7 +1753,7 @@  info_address_command (const char *exp, int from_tty)
     case LOC_UNRESOLVED:
       {
 	bound_minimal_symbol msym
-	  = lookup_bound_minimal_symbol (sym->linkage_name ());
+	  = lookup_minimal_symbol (sym->linkage_name ());
 	if (msym.minsym == NULL)
 	  gdb_printf ("unresolved");
 	else
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 76433293fa39..c9f5e9dfab1f 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3442,8 +3442,7 @@  simple_read_overlay_table (void)
       return 0;
     }
 
-  bound_minimal_symbol ovly_table_msym
-    = lookup_bound_minimal_symbol ("_ovly_table");
+  bound_minimal_symbol ovly_table_msym = lookup_minimal_symbol ("_ovly_table");
   if (! ovly_table_msym.minsym)
     {
       error (_("Error reading inferior's overlay table: couldn't find "
diff --git a/gdb/valops.c b/gdb/valops.c
index af2b76055bc2..cca610ae28d0 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -129,7 +129,7 @@  find_function_in_inferior (const char *name, struct objfile **objf_p)
     }
   else
     {
-      bound_minimal_symbol msymbol = lookup_bound_minimal_symbol (name);
+      bound_minimal_symbol msymbol = lookup_minimal_symbol (name);
 
       if (msymbol.minsym != NULL)
 	{
diff --git a/gdb/value.c b/gdb/value.c
index 0cf6e2a0ffc5..48bf1540144e 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3121,7 +3121,7 @@  value_fn_field (struct value **arg1p, struct fn_field *f,
 		       nullptr).symbol;
   if (sym == nullptr)
     {
-      msym = lookup_bound_minimal_symbol (physname);
+      msym = lookup_minimal_symbol (physname);
       if (msym.minsym == NULL)
 	return NULL;
     }
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index f04724f18bad..6eea6346199f 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -908,7 +908,7 @@  z80_read_overlay_region_table ()
     }
 
   bound_minimal_symbol ovly_region_table_msym
-    = lookup_bound_minimal_symbol ("_ovly_region_table");
+    = lookup_minimal_symbol ("_ovly_region_table");
   if (! ovly_region_table_msym.minsym)
     {
       error (_("Error reading inferior's overlay table: couldn't find "