diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2022-04-26 15:11:09 +0200 |
---|---|---|
committer | Markus Metzger <markus.t.metzger@intel.com> | 2022-10-18 14:16:10 +0200 |
commit | 2aab2438702dfb22d6fa0c5d8bef267f3d24638b (patch) | |
tree | 4282a9aee251a071b06204251f81386a2a6b1d0c /gdb/cp-support.c | |
parent | 5f0277edf24612029c5ff513342adcb01db56e7a (diff) | |
download | binutils-2aab2438702dfb22d6fa0c5d8bef267f3d24638b.zip binutils-2aab2438702dfb22d6fa0c5d8bef267f3d24638b.tar.gz binutils-2aab2438702dfb22d6fa0c5d8bef267f3d24638b.tar.bz2 |
gdb, cp: update add_symbol_overload_list_qualified
Iterate over objfiles in search order using the objfile of the selected
block as current_objfile so the iteration can stay inside the block's
linker namespace.
Diffstat (limited to 'gdb/cp-support.c')
-rw-r--r-- | gdb/cp-support.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 1891bac..77895a8 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1460,30 +1460,30 @@ add_symbol_overload_list_qualified (const char *func_name, /* Go through the symtabs and check the externs and statics for symbols which match. */ - for (objfile *objfile : current_program_space->objfiles ()) - { - for (compunit_symtab *cust : objfile->compunits ()) - { - QUIT; - const block *b = cust->blockvector ()->global_block (); - add_symbol_overload_list_block (func_name, b, overload_list); - } - } - - for (objfile *objfile : current_program_space->objfiles ()) - { - for (compunit_symtab *cust : objfile->compunits ()) - { - QUIT; - const block *b = cust->blockvector ()->static_block (); - - /* Don't do this block twice. */ - if (b == surrounding_static_block) - continue; - - add_symbol_overload_list_block (func_name, b, overload_list); - } - } + const block *block = get_selected_block (0); + struct objfile *current_objfile = block ? block_objfile (block) : nullptr; + + gdbarch_iterate_over_objfiles_in_search_order + (current_objfile ? current_objfile->arch () : target_gdbarch (), + [func_name, surrounding_static_block, &overload_list] + (struct objfile *obj) + { + for (compunit_symtab *cust : obj->compunits ()) + { + QUIT; + const struct block *b = cust->blockvector ()->global_block (); + add_symbol_overload_list_block (func_name, b, overload_list); + + b = cust->blockvector ()->static_block (); + /* Don't do this block twice. */ + if (b == surrounding_static_block) + continue; + + add_symbol_overload_list_block (func_name, b, overload_list); + } + + return 0; + }, current_objfile); } /* Lookup the rtti type for a class name. */ |