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  <tom@tromey.com>

	* 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) <expand_symtabs_matching>: Return
	bool.
	* psymtab.c (psymbol_functions::expand_symtabs_matching): Return
	bool.
	* psympriv.h (struct psymbol_functions)
	<expand_symtabs_matching>: Return bool.
	* objfiles.h (struct objfile) <expand_symtabs_matching>: Return
	bool.
	* dwarf2/read.c (struct dwarf2_gdb_index)
	<expand_symtabs_matching>: Return bool.
	(struct dwarf2_debug_names_index) <expand_symtabs_matching>:
	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.
This commit is contained in:
Tom Tromey 2021-04-17 09:35:04 -06:00
parent e357e9904c
commit df35e6262d
10 changed files with 114 additions and 48 deletions

View file

@ -3716,7 +3716,7 @@ symfile_free_objfile (struct objfile *objfile)
Expand all symtabs that match the specified criteria.
See quick_symbol_functions.expand_symtabs_matching for details. */
void
bool
expand_symtabs_matching
(gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
const lookup_name_info &lookup_name,
@ -3725,10 +3725,12 @@ expand_symtabs_matching
enum search_domain kind)
{
for (objfile *objfile : current_program_space->objfiles ())
objfile->expand_symtabs_matching (file_matcher,
&lookup_name,
symbol_matcher,
expansion_notify, kind);
if (!objfile->expand_symtabs_matching (file_matcher,
&lookup_name,
symbol_matcher,
expansion_notify, kind))
return false;
return true;
}
/* Wrapper around the quick_symbol_functions map_symbol_filenames "method".