]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove objfile::expand_symtabs_for_function
authorTom Tromey <tom@tromey.com>
Tue, 31 Dec 2024 20:11:50 +0000 (13:11 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 10 Sep 2025 22:07:57 +0000 (16:07 -0600)
objfile::expand_symtabs_for_function only has a single caller now, so
it can be removed.  This also allows us to merge the expansion and
searching phases, as done in other patches in this series.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998
Acked-By: Simon Marchi <simon.marchi@efficios.com>
gdb/cp-support.c
gdb/objfiles.h
gdb/symfile-debug.c

index 415217fb7d1d2106eeaa530ebd08f5982e738afa..4585f0012f779752679ade686c8f55e3bd6f976b 100644 (file)
@@ -1473,16 +1473,14 @@ add_symbol_overload_list_qualified (const char *func_name,
                                     ? selected_block->objfile ()
                                     : nullptr);
 
+  lookup_name_info base_lookup (func_name, symbol_name_match_type::FULL);
+  lookup_name_info lookup_name = base_lookup.make_ignore_params ();
+
   current_program_space->iterate_over_objfiles_in_search_order
-    ([func_name, surrounding_static_block, &overload_list]
+    ([func_name, surrounding_static_block, &overload_list, lookup_name]
      (struct objfile *obj)
        {
-        /* Look through the partial symtabs for all symbols which
-           begin by matching FUNC_NAME.  Make sure we read that
-           symbol table in.  */
-        obj->expand_symtabs_for_function (func_name);
-
-        for (compunit_symtab *cust : obj->compunits ())
+        auto callback = [&] (compunit_symtab *cust)
           {
             QUIT;
             const struct block *b = cust->blockvector ()->global_block ();
@@ -1490,11 +1488,19 @@ add_symbol_overload_list_qualified (const char *func_name,
 
             b = cust->blockvector ()->static_block ();
             /* Don't do this block twice.  */
-            if (b == surrounding_static_block)
-              continue;
+            if (b != surrounding_static_block)
+              add_symbol_overload_list_block (func_name, b, overload_list);
+            return true;
+          };
 
-            add_symbol_overload_list_block (func_name, b, overload_list);
-          }
+        /* Look through the partial symtabs for all symbols which
+           begin by matching FUNC_NAME.  Make sure we read that
+           symbol table in.  */
+        obj->expand_symtabs_matching (nullptr, &lookup_name,
+                                      nullptr, callback,
+                                      (SEARCH_GLOBAL_BLOCK
+                                       | SEARCH_STATIC_BLOCK),
+                                      SEARCH_FUNCTION_DOMAIN);
 
         return 0;
        }, current_objfile);
index 2711d4dcb06f300a53c3d044a162e2403d750082..21263ba2028c8881b0b4b3d6c562147ec4b0a389 100644 (file)
@@ -585,10 +585,6 @@ public:
   /* See quick_symbol_functions.  */
   void dump ();
 
-  /* Find all the symbols in OBJFILE named FUNC_NAME, and ensure that
-     the corresponding symbol tables are loaded.  */
-  void expand_symtabs_for_function (const char *func_name);
-
   /* See quick_symbol_functions.  */
   void expand_all_symtabs ();
 
index a5ff21e5db164c5b44bc4362a891a5beb50f6cb7..0f807a5b58e83ae889b68fd7581ee9766115b9b3 100644 (file)
@@ -310,28 +310,6 @@ objfile::dump ()
     iter->dump (this);
 }
 
-void
-objfile::expand_symtabs_for_function (const char *func_name)
-{
-  if (debug_symfile)
-    gdb_printf (gdb_stdlog,
-               "qf->expand_symtabs_for_function (%s, \"%s\")\n",
-               objfile_debug_name (this), func_name);
-
-  lookup_name_info base_lookup (func_name, symbol_name_match_type::FULL);
-  lookup_name_info lookup_name = base_lookup.make_ignore_params ();
-
-  for (const auto &iter : qf)
-    iter->expand_symtabs_matching (this,
-                                  nullptr,
-                                  &lookup_name,
-                                  nullptr,
-                                  nullptr,
-                                  (SEARCH_GLOBAL_BLOCK
-                                   | SEARCH_STATIC_BLOCK),
-                                  SEARCH_FUNCTION_DOMAIN);
-}
-
 void
 objfile::expand_all_symtabs ()
 {