diff options
author | Pedro Alves <palves@redhat.com> | 2016-03-29 15:48:28 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-09-19 15:44:42 +0100 |
commit | 14ca73f748af8e1ee673170bc1541711faea265c (patch) | |
tree | 3b617a62bf34441ed6d0b3c931bc4531fde13bba | |
parent | 069ed2156b723b9f7aaab8d121ca53c2fe3138ac (diff) | |
download | fsf-binutils-gdb-14ca73f748af8e1ee673170bc1541711faea265c.zip fsf-binutils-gdb-14ca73f748af8e1ee673170bc1541711faea265c.tar.gz fsf-binutils-gdb-14ca73f748af8e1ee673170bc1541711faea265c.tar.bz2 |
More O(N) elimination
-rw-r--r-- | gdb/linespec.c | 10 | ||||
-rw-r--r-- | gdb/symtab.c | 12 | ||||
-rw-r--r-- | gdb/symtab.h | 3 |
3 files changed, 11 insertions, 14 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c index 611017e..69d7905 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3266,15 +3266,7 @@ collect_symtabs_from_filename (const char *file, NULL); cleanups = make_cleanup_htab_delete (collector.symtab_table); - /* Find that file's data. */ - ALL_SEARCH_PSPACES (search_scope->pspace, pspace) - { - if (pspace->executing_startup) - continue; - - set_current_program_space (pspace); - iterate_over_symtabs (file, add_symtabs_to_list, &collector); - } + iterate_over_symtabs (search_scope, file, add_symtabs_to_list, &collector); do_cleanups (cleanups); return collector.symtabs; diff --git a/gdb/symtab.c b/gdb/symtab.c index 5dd97cf..9d37dec 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -457,11 +457,13 @@ iterate_over_some_symtabs (const char *name, DATA. If CALLBACK returns true, the search stops. */ void -iterate_over_symtabs (const char *name, +iterate_over_symtabs (struct sym_search_scope *search_scope, + const char *name, int (*callback) (struct symtab *symtab, void *data), void *data) { + struct program_space *pspace; struct objfile *objfile; char *real_path = NULL; struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); @@ -475,7 +477,7 @@ iterate_over_symtabs (const char *name, gdb_assert (IS_ABSOLUTE_PATH (real_path)); } - ALL_OBJFILES (objfile) + ALL_SEARCH_SCOPE_OBJFILES (search_scope, pspace, objfile) { if (iterate_over_some_symtabs (name, real_path, callback, data, objfile->compunit_symtabs, NULL)) @@ -488,7 +490,7 @@ iterate_over_symtabs (const char *name, /* Same search rules as above apply here, but now we look thru the psymtabs. */ - ALL_OBJFILES (objfile) + ALL_SEARCH_SCOPE_OBJFILES (search_scope, pspace, objfile) { if (objfile->sf && objfile->sf->qf->map_symtabs_matching_filename (objfile, @@ -523,8 +525,10 @@ struct symtab * lookup_symtab (const char *name) { struct symtab *result = NULL; + struct sym_search_scope search_scope = null_search_scope (); - iterate_over_symtabs (name, lookup_symtab_callback, &result); + search_scope.pspace = current_program_space; + iterate_over_symtabs (&search_scope, name, lookup_symtab_callback, &result); return result; } diff --git a/gdb/symtab.h b/gdb/symtab.h index 9f75507..20c6b02 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1638,7 +1638,8 @@ int iterate_over_some_symtabs (const char *name, struct compunit_symtab *first, struct compunit_symtab *after_last); -void iterate_over_symtabs (const char *name, +void iterate_over_symtabs (struct sym_search_scope *search_scope, + const char *name, int (*callback) (struct symtab *symtab, void *data), void *data); |