From df35e6262da99acc80bb88d669975f0b52e33876 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 17 Apr 2021 09:35:04 -0600 Subject: Let expand_symtabs_matching short-circuit This changes expand_symtabs_exp_notify_ftype to return bool, and updates all the uses. Now, if the notification function returns false, the call is short-circuited and stops examining symtabs. This is a step toward replacing map_symtabs_matching_filename with expand_symtabs_matching. gdb/ChangeLog 2021-04-17 Tom Tromey * symtab.c (default_collect_symbol_completion_matches_break_on): Update. * symfile.h (expand_symtabs_matching): Return bool. * symfile.c (expand_symtabs_matching): Return bool. * symfile-debug.c (objfile::expand_symtabs_matching): Return bool. * quick-symbol.h (expand_symtabs_exp_notify_ftype): Return bool. (struct quick_symbol_functions) : Return bool. * psymtab.c (psymbol_functions::expand_symtabs_matching): Return bool. * psympriv.h (struct psymbol_functions) : Return bool. * objfiles.h (struct objfile) : Return bool. * dwarf2/read.c (struct dwarf2_gdb_index) : Return bool. (struct dwarf2_debug_names_index) : Return bool. (dw2_expand_symtabs_matching_symbol): Return bool. (dw2_expand_symtabs_matching_one, dw2_expand_marked_cus) (dw2_expand_symtabs_matching) (dwarf2_gdb_index::expand_symtabs_matching) (dwarf2_debug_names_index::expand_symtabs_matching) (dwarf2_debug_names_index::expand_symtabs_matching): Return bool. --- gdb/psymtab.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gdb/psymtab.c') diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 6f3d8562151..6e7bf240a39 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1293,7 +1293,7 @@ recursively_search_psymtabs /* Psymtab version of expand_symtabs_matching. See its definition in the definition of quick_symbol_functions in symfile.h. */ -void +bool psymbol_functions::expand_symtabs_matching (struct objfile *objfile, gdb::function_view file_matcher, @@ -1346,9 +1346,12 @@ psymbol_functions::expand_symtabs_matching psymtab_to_symtab (objfile, ps); if (expansion_notify != NULL) - expansion_notify (symtab); + if (!expansion_notify (symtab)) + return false; } } + + return true; } /* Psymtab version of has_symbols. See its definition in -- cgit v1.2.1