]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Convert linespec.c:iterate_over_all_matching_symtabs
authorTom Tromey <tom@tromey.com>
Tue, 31 Dec 2024 20:15:17 +0000 (13:15 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 10 Sep 2025 22:07:57 +0000 (16:07 -0600)
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 <simon.marchi@efficios.com>
gdb/linespec.c

index 70e2af9441995af40b21d8edf87fc4caff17bc7e..2fd32a9ac5cd138d18c81ccf361d0453df390b3f 100644 (file)
@@ -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);
        }
     }
 }