From: Tom Tromey Date: Tue, 31 Dec 2024 20:11:50 +0000 (-0700) Subject: Remove objfile::expand_symtabs_for_function X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4a0b3e62a43567fadadf167390feaf147118fd76;p=thirdparty%2Fbinutils-gdb.git Remove objfile::expand_symtabs_for_function 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 --- diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 415217fb7d1..4585f0012f7 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -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); diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 2711d4dcb06..21263ba2028 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -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 (); diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index a5ff21e5db1..0f807a5b58e 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -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 () {