Removing lookup_minimal_symbol_and_objfile
authorWeimin Pan <weimin.pan@oracle.com>
Tue, 29 May 2018 22:01:34 +0000 (22:01 +0000)
committerWeimin Pan <weimin.pan@oracle.com>
Tue, 29 May 2018 22:37:07 +0000 (22:37 +0000)
Function lookup_minimal_symbol_and_objfile iterates on all objfiles and
calls lookup_minimal_symbol for each of them, effectively searching in all
objfiles.  lookup_bound_minimal_symbol calls lookup_minimal_symbol with NULL,
which also effectively searches all objfiles.  AFAIK, they do exactly the same
thing, so we can get rid of one (and lookup_minimal_symbol_and_objfile happens
to be the most inefficient because it ends up n^2 on the number of objfiles).

Tested in both aarch64-linux-gnu and amd64-linux-gnu. No regressions.

gdb/ChangeLog
gdb/coff-pe-read.c
gdb/glibc-tdep.c
gdb/jit.c
gdb/minsyms.c
gdb/minsyms.h
gdb/printcmd.c

index bec4e04e16107d151b311611a9330137a00f4235..ff2f145fb99654dd48311a3a105227322eb4931d 100644 (file)
@@ -1,3 +1,13 @@
+2018-05-29  Weimin Pan  <weimin.pan@oracle.com>
+
+       * minsyms.h (lookup_minimal_symbol_and_objfile): Remove declaration.
+       * minsyms.c (lookup_minimal_symbol_and_objfile): Remove definition.
+       * coff-pe-read.c (add_pe_forwarded_sym): Replace
+       lookup_minimal_symbol_and_objfile with lookup_bound_minimal_symbol.
+       * glibc-tdep.c (glibc_skip_solib_resolver): Likewise.
+       * jit.c (jit_breakpoint_re_set_internal): Likewise.
+       * printcmd.c (info_address_command): Likewise.
+
 2018-05-29  Tom Tromey  <tom@tromey.com>
 
        * windows-nat.c (handle_exception): Update fall-through comment.
index 0e9309e4631565da423bf3e234418c6cffba16b2..97b646a56bdb7a17a09dd0c4662d71b08caeeede 100644 (file)
@@ -220,7 +220,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
             forward_func_name);
 
 
-  msymbol = lookup_minimal_symbol_and_objfile (forward_qualified_name);
+  msymbol = lookup_bound_minimal_symbol (forward_qualified_name);
 
   if (!msymbol.minsym)
     {
@@ -228,7 +228,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
 
       for (i = 0; i < forward_dll_name_len; i++)
        forward_qualified_name[i] = tolower (forward_qualified_name[i]);
-      msymbol = lookup_minimal_symbol_and_objfile (forward_qualified_name);
+      msymbol = lookup_bound_minimal_symbol (forward_qualified_name);
     }
 
   if (!msymbol.minsym)
index 481e4b80f0d4a7c1b70ca477b206457fde4c9ea8..485cd8bbd607280f5317c01fd73e9f86797417de 100644 (file)
@@ -54,7 +54,7 @@ glibc_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
      debugging programs that use shared libraries.  */
 
   struct bound_minimal_symbol resolver 
-    = lookup_minimal_symbol_and_objfile ("_dl_runtime_resolve");
+    = lookup_bound_minimal_symbol ("_dl_runtime_resolve");
 
   if (resolver.minsym)
     {
index 8cd645cb66e9930ac081bf7936edd28ed34916c1..e6b3cc25ca42c0accae6b8ef0adb9d24345ed209 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -1041,7 +1041,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
     {
       /* Lookup the registration symbol.  If it is missing, then we
         assume we are not attached to a JIT.  */
-      reg_symbol = lookup_minimal_symbol_and_objfile (jit_break_name);
+      reg_symbol = lookup_bound_minimal_symbol (jit_break_name);
       if (reg_symbol.minsym == NULL
          || BMSYMBOL_VALUE_ADDRESS (reg_symbol) == 0)
        return 1;
index b98f121d5fd6cea15f3ede949538e00b40691ee9..9b2c80041a493d8ac9acaab83c2e0eeb6b753f31 100644 (file)
@@ -990,24 +990,6 @@ static const struct gnu_ifunc_fns stub_gnu_ifunc_fns =
 
 const struct gnu_ifunc_fns *gnu_ifunc_fns_p = &stub_gnu_ifunc_fns;
 
-/* See minsyms.h.  */
-
-struct bound_minimal_symbol
-lookup_minimal_symbol_and_objfile (const char *name)
-{
-  struct bound_minimal_symbol result;
-  struct objfile *objfile;
-
-  ALL_OBJFILES (objfile)
-    {
-      result = lookup_minimal_symbol (name, NULL, objfile);
-      if (result.minsym != NULL)
-        return result;
-    }
-
-  memset (&result, 0, sizeof (result));
-  return result;
-}
 \f
 
 /* Return leading symbol character for a BFD.  If BFD is NULL,
index 40e69aea87d8d834d44b4f50eb6ce93f70e5c904..f6799ef00ce138c840c1f439bbd56532276a03e4 100644 (file)
@@ -202,11 +202,6 @@ struct bound_minimal_symbol lookup_minimal_symbol (const char *,
 
 struct bound_minimal_symbol lookup_bound_minimal_symbol (const char *);
 
-/* Find the minimal symbol named NAME, and return both the minsym
-   struct and its objfile.  */
-
-struct bound_minimal_symbol lookup_minimal_symbol_and_objfile (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
index 0dfea34753365118a50a4b5200d8f2de89a7f48f..d0037aec001f5a6937b9e52cff40615e2faf61e6 100644 (file)
@@ -1549,7 +1549,7 @@ info_address_command (const char *exp, int from_tty)
       {
        struct bound_minimal_symbol msym;
 
-       msym = lookup_minimal_symbol_and_objfile (SYMBOL_LINKAGE_NAME (sym));
+       msym = lookup_bound_minimal_symbol (SYMBOL_LINKAGE_NAME (sym));
        if (msym.minsym == NULL)
          printf_filtered ("unresolved");
        else
This page took 0.035537 seconds and 4 git commands to generate.