aboutsummaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-04-17 09:35:04 -0600
committerTom Tromey <tom@tromey.com>2021-04-17 09:35:06 -0600
commit0b7b2c2adff43d39ee3bd39ebd91a6710d9175e4 (patch)
tree319e0422ab99a88c82017e660b06e7b0e0f27c41 /gdb/psymtab.c
parent90160b57032ce8c2d12864a53036bab2c5b86682 (diff)
downloadbinutils-0b7b2c2adff43d39ee3bd39ebd91a6710d9175e4.zip
binutils-0b7b2c2adff43d39ee3bd39ebd91a6710d9175e4.tar.gz
binutils-0b7b2c2adff43d39ee3bd39ebd91a6710d9175e4.tar.bz2
Simplify quick_symbol_functions::map_matching_symbols
quick_symbol_functions::map_matching_symbols is only used by the Ada code. Currently, it both expands certain psymtabs and then walks over the full symtabs -- including any already-expanded ones -- calling a callback. It appears to work lazily as well, in that if the callback returns false, iteration stops. However, only the psymtab implementation does this; the DWARF index implementations are not lazy. It turns out, though, that the only callback that is ever passed here never returns false. This patch simplifies this method by removing the callback. The method is also renamed. In the new scheme, the caller is responsible for walking the full symtabs, which removes some redundancy as well. gdb/ChangeLog 2021-04-17 Tom Tromey <tom@tromey.com> * psymtab.c (psymbol_functions::expand_matching_symbols): Rename from map_matching_symbols. Change parameters. * psympriv.h (struct psymbol_functions) <expand_matching_symbols>: Rename from map_matching_symbols. Change parameters. * dwarf2/read.c (struct dwarf2_gdb_index) <expand_matching_symbols>: Rename from map_matching_symbols. Change parameters. (struct dwarf2_debug_names_index) <expand_matching_symbols>: Rename from map_matching_symbols. Change parameters. (dwarf2_gdb_index::expand_matching_symbols): Rename from dw2_map_matching_symbols. Change parameters. (dwarf2_gdb_index::expand_matching_symbols): Remove old implementation. (dwarf2_debug_names_index::expand_matching_symbols): Rename from map_matching_symbols. Change parameters. * objfiles.h (struct objfile) <expand_matching_symbols>: Rename from map_matching_symbols. Change parameters. * symfile-debug.c (objfile::expand_matching_symbols): Rename from map_matching_symbols. Change parameters. * ada-lang.c (map_matching_symbols): New function. (add_nonlocal_symbols): Update.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r--gdb/psymtab.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 7c73293..75a307c 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -979,36 +979,23 @@ psymtab_to_fullname (struct partial_symtab *ps)
return ps->fullname;
}
-/* Psymtab version of map_matching_symbols. See its definition in
+/* Psymtab version of expand_matching_symbols. See its definition in
the definition of quick_symbol_functions in symfile.h. */
void
-psymbol_functions::map_matching_symbols
+psymbol_functions::expand_matching_symbols
(struct objfile *objfile,
const lookup_name_info &name, domain_enum domain,
int global,
- gdb::function_view<symbol_found_callback_ftype> callback,
symbol_compare_ftype *ordered_compare)
{
- const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
-
for (partial_symtab *ps : require_partial_symbols (objfile))
{
QUIT;
- if (ps->readin_p (objfile)
- || match_partial_symbol (objfile, ps, global, name, domain,
+ if (!ps->readin_p (objfile)
+ && match_partial_symbol (objfile, ps, global, name, domain,
ordered_compare))
- {
- struct compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
- const struct block *block;
-
- if (cust == NULL)
- continue;
- block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_kind);
- if (!iterate_over_symbols_terminated (block, name,
- domain, callback))
- return;
- }
+ psymtab_to_symtab (objfile, ps);
}
}