aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-03-10 15:37:20 -0600
committerTom Tromey <tom@tromey.com>2019-04-10 08:05:17 -0600
commite9ad22ee5f0a40dfa1182ee68e3349dd72a42afe (patch)
tree5500e93752b2711677dbcd2524e1d91f067bd680 /gdb/symtab.c
parentee3711344b6e0cffeb237fa6889aab04853f9004 (diff)
downloadgdb-e9ad22ee5f0a40dfa1182ee68e3349dd72a42afe.zip
gdb-e9ad22ee5f0a40dfa1182ee68e3349dd72a42afe.tar.gz
gdb-e9ad22ee5f0a40dfa1182ee68e3349dd72a42afe.tar.bz2
Introduce a separate debug objfile iterator
This introduces a new iterator and range adapter for iteration over the separate debug files of a given objfile. As in the current approach, the requested objfile is returned first, followed by the separate debug objfiles. gdb/ChangeLog 2019-04-10 Tom Tromey <tom@tromey.com> * symtab.c (lookup_global_symbol_from_objfile) (lookup_symbol_in_objfile_from_linkage_name): Use the iterator. * objfiles.h (class separate_debug_iterator): New. (class separate_debug_range): New. (struct objfile) <separate_debug_objfiles>: New method. (objfile_separate_debug_iterate): Don't declare. * objfiles.c (separate_debug_iterator::operator++): Rename from objfile_separate_debug_iterate. (objfile_relocate, objfile_rebase, objfile_has_symbols): Use the iterator. * minsyms.c (lookup_minimal_symbol_by_pc_section): Use the iterator.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d25f560..16e641a 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2246,11 +2246,7 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
const char *name,
const domain_enum domain)
{
- struct objfile *objfile;
-
- for (objfile = main_objfile;
- objfile;
- objfile = objfile_separate_debug_iterate (main_objfile, objfile))
+ for (struct objfile *objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result
= lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK, name, domain);
@@ -2327,7 +2323,7 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
domain_enum domain)
{
enum language lang = current_language->la_language;
- struct objfile *main_objfile, *cur_objfile;
+ struct objfile *main_objfile;
demangle_result_storage storage;
const char *modified_name = demangle_for_lookup (linkage_name, lang, storage);
@@ -2337,9 +2333,7 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
else
main_objfile = objfile;
- for (cur_objfile = main_objfile;
- cur_objfile;
- cur_objfile = objfile_separate_debug_iterate (main_objfile, cur_objfile))
+ for (struct objfile *cur_objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result;