From 5f99f39a396476c122a04f8eb7c0c40c76c101db Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 31 Dec 2024 13:15:17 -0700 Subject: [PATCH] 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 --- gdb/linespec.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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); } } } -- 2.47.3