From: Tom Tromey Date: Tue, 31 Dec 2024 20:15:17 +0000 (-0700) Subject: Convert linespec.c:iterate_over_all_matching_symtabs X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f99f39a396476c122a04f8eb7c0c40c76c101db;p=thirdparty%2Fbinutils-gdb.git Convert linespec.c:iterate_over_all_matching_symtabs This converts linespec.c:iterate_over_all_matching_symtabs to the callback approach, merging the search loop and the call to expand_symtabs_matching. 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/linespec.c b/gdb/linespec.c index 70e2af94419..2fd32a9ac5c 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1139,12 +1139,7 @@ iterate_over_all_matching_symtabs for (objfile *objfile : pspace->objfiles ()) { - objfile->expand_symtabs_matching (NULL, &lookup_name, NULL, NULL, - (SEARCH_GLOBAL_BLOCK - | SEARCH_STATIC_BLOCK), - domain); - - for (compunit_symtab *cu : objfile->compunits ()) + auto expand_callback = [&] (compunit_symtab *cu) { struct symtab *symtab = cu->primary_filetab (); @@ -1171,7 +1166,15 @@ iterate_over_all_matching_symtabs }); } } - } + + return true; + }; + + objfile->expand_symtabs_matching (nullptr, &lookup_name, + nullptr, expand_callback, + (SEARCH_GLOBAL_BLOCK + | SEARCH_STATIC_BLOCK), + domain); } } }