From 2030c079717475f5b6fad837bb81758891f3b802 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 15 Jan 2019 16:55:05 -0700 Subject: [PATCH] Change all_objfiles adapter to be a method on program_space This changes the all_objfiles range adapter to be a method on the program space, and fixes up all the users. gdb/ChangeLog 2019-01-17 Tom Tromey * progspace.h (program_space) : New typedef. : New method. : Rename from objfiles. (object_files): Update. * guile/scm-progspace.c (gdbscm_progspace_objfiles): Update. * guile/scm-pretty-print.c (ppscm_find_pretty_printer_from_objfiles): Update. * guile/scm-objfile.c (gdbscm_objfiles): Update. * python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Update. * python/py-progspace.c (pspy_get_objfiles): Update. * python/py-prettyprint.c (find_pretty_printer_from_objfiles): Update. * python/py-objfile.c (objfpy_lookup_objfile_by_name) (objfpy_lookup_objfile_by_build_id): Update. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update. * windows-tdep.c (windows_iterate_over_objfiles_in_search_order): Update. * symtab.c (iterate_over_symtabs, matching_obj_sections) (expand_symtab_containing_pc, lookup_objfile_from_block) (lookup_static_symbol, basic_lookup_transparent_type) (find_pc_sect_compunit_symtab, find_symbol_at_address) (find_line_symtab, info_sources_command) (default_collect_symbol_completion_matches_break_on) (make_source_files_completion_list, find_main_name): Update. * symmisc.c (print_symbol_bcache_statistics) (print_objfile_statistics, maintenance_print_symbols) (maintenance_print_msymbols, maintenance_print_objfiles) (maintenance_info_symtabs, maintenance_check_symtabs) (maintenance_expand_symtabs, maintenance_info_line_tables): Update. * symfile.c (remove_symbol_file_command, overlay_invalidate_all) (find_pc_overlay, find_pc_mapped_section, list_overlays_command) (map_overlay_command, unmap_overlay_command) (simple_overlay_update, expand_symtabs_matching) (map_symbol_filenames): Update. * symfile-debug.c (set_debug_symfile): Update. * spu-tdep.c (spu_overlay_update, spu_objfile_from_frame): Update. * source.c (select_source_symtab, forget_cached_source_info): Update. * solib.c (solib_read_symbols): Update. * solib-spu.c (append_ocl_sos): Update. * psymtab.c (maintenance_print_psymbols) (maintenance_info_psymtabs, maintenance_check_psymtabs): Update. * probe.c (parse_probes_in_pspace, find_probe_by_pc): Update. * printcmd.c (info_symbol_command): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Update. * objfiles.h (class all_objfiles): Remove. * objfiles.c (have_partial_symbols, have_full_symbols) (have_minimal_symbols, qsort_cmp, update_section_map) (shared_objfile_contains_address_p) (default_iterate_over_objfiles_in_search_order): Update. * objc-lang.c (info_selectors_command, info_classes_command) (find_methods): Update. * minsyms.c (find_solib_trampoline_target): Update. * maint.c (maintenance_info_sections) (maintenance_translate_address, count_symtabs_and_blocks): Update. * main.c (captured_main_1): Update. * linux-thread-db.c (try_thread_db_load_from_pdir) (has_libpthread): Update. * linespec.c (iterate_over_all_matching_symtabs) (search_minsyms_for_name): Update. * jit.c (jit_find_objf_with_entry_addr): Update. * hppa-tdep.c (find_unwind_entry) (hppa_lookup_stub_minimal_symbol): Update. * gcore.c (gcore_create_callback, objfile_find_memory_regions): Update. * elfread.c (elf_gnu_ifunc_resolve_by_cache) (elf_gnu_ifunc_resolve_by_got): Update. * dwarf2-frame.c (dwarf2_frame_find_fde): Update. * dwarf-index-write.c (save_gdb_index_command): Update. * cp-support.c (add_symbol_overload_list_qualified): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * blockframe.c (find_pc_partial_function): Update. * ada-lang.c (ada_lookup_simple_minsym, add_nonlocal_symbols) (ada_collect_symbol_completion_matches) (ada_add_global_exceptions): Update. --- gdb/ChangeLog | 86 ++++++++++++++++++++++++++++++++ gdb/ada-lang.c | 14 +++--- gdb/blockframe.c | 2 +- gdb/breakpoint.c | 8 +-- gdb/compile/compile-object-run.c | 2 +- gdb/cp-support.c | 6 +-- gdb/dwarf-index-write.c | 2 +- gdb/dwarf2-frame.c | 2 +- gdb/elfread.c | 4 +- gdb/gcore.c | 4 +- gdb/guile/scm-objfile.c | 2 +- gdb/guile/scm-pretty-print.c | 2 +- gdb/guile/scm-progspace.c | 2 +- gdb/hppa-tdep.c | 4 +- gdb/jit.c | 2 +- gdb/linespec.c | 4 +- gdb/linux-thread-db.c | 4 +- gdb/main.c | 2 +- gdb/maint.c | 6 +-- gdb/mi/mi-cmd-file.c | 2 +- gdb/minsyms.c | 2 +- gdb/objc-lang.c | 10 ++-- gdb/objfiles.c | 18 +++---- gdb/objfiles.h | 19 +------ gdb/ppc-linux-tdep.c | 2 +- gdb/printcmd.c | 2 +- gdb/probe.c | 6 +-- gdb/progspace.h | 15 +++++- gdb/psymtab.c | 6 +-- gdb/python/py-objfile.c | 4 +- gdb/python/py-prettyprint.c | 2 +- gdb/python/py-progspace.c | 2 +- gdb/python/py-xmethods.c | 2 +- gdb/solib-spu.c | 2 +- gdb/solib.c | 2 +- gdb/source.c | 6 +-- gdb/spu-tdep.c | 4 +- gdb/symfile-debug.c | 2 +- gdb/symfile.c | 24 ++++----- gdb/symmisc.c | 18 +++---- gdb/symtab.c | 46 ++++++++--------- gdb/windows-tdep.c | 2 +- 42 files changed, 219 insertions(+), 137 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d05ff7f591..e8178dbf18 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,89 @@ +2019-01-17 Tom Tromey + + * progspace.h (program_space) : New typedef. + : New method. + : Rename from objfiles. + (object_files): Update. + * guile/scm-progspace.c (gdbscm_progspace_objfiles): Update. + * guile/scm-pretty-print.c + (ppscm_find_pretty_printer_from_objfiles): Update. + * guile/scm-objfile.c (gdbscm_objfiles): Update. + * python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): + Update. + * python/py-progspace.c (pspy_get_objfiles): Update. + * python/py-prettyprint.c (find_pretty_printer_from_objfiles): + Update. + * python/py-objfile.c (objfpy_lookup_objfile_by_name) + (objfpy_lookup_objfile_by_build_id): Update. + * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update. + * windows-tdep.c (windows_iterate_over_objfiles_in_search_order): + Update. + * symtab.c (iterate_over_symtabs, matching_obj_sections) + (expand_symtab_containing_pc, lookup_objfile_from_block) + (lookup_static_symbol, basic_lookup_transparent_type) + (find_pc_sect_compunit_symtab, find_symbol_at_address) + (find_line_symtab, info_sources_command) + (default_collect_symbol_completion_matches_break_on) + (make_source_files_completion_list, find_main_name): Update. + * symmisc.c (print_symbol_bcache_statistics) + (print_objfile_statistics, maintenance_print_symbols) + (maintenance_print_msymbols, maintenance_print_objfiles) + (maintenance_info_symtabs, maintenance_check_symtabs) + (maintenance_expand_symtabs, maintenance_info_line_tables): + Update. + * symfile.c (remove_symbol_file_command, overlay_invalidate_all) + (find_pc_overlay, find_pc_mapped_section, list_overlays_command) + (map_overlay_command, unmap_overlay_command) + (simple_overlay_update, expand_symtabs_matching) + (map_symbol_filenames): Update. + * symfile-debug.c (set_debug_symfile): Update. + * spu-tdep.c (spu_overlay_update, spu_objfile_from_frame): + Update. + * source.c (select_source_symtab, forget_cached_source_info): + Update. + * solib.c (solib_read_symbols): Update. + * solib-spu.c (append_ocl_sos): Update. + * psymtab.c (maintenance_print_psymbols) + (maintenance_info_psymtabs, maintenance_check_psymtabs): Update. + * probe.c (parse_probes_in_pspace, find_probe_by_pc): Update. + * printcmd.c (info_symbol_command): Update. + * ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): + Update. + * objfiles.h (class all_objfiles): Remove. + * objfiles.c (have_partial_symbols, have_full_symbols) + (have_minimal_symbols, qsort_cmp, update_section_map) + (shared_objfile_contains_address_p) + (default_iterate_over_objfiles_in_search_order): Update. + * objc-lang.c (info_selectors_command, info_classes_command) + (find_methods): Update. + * minsyms.c (find_solib_trampoline_target): Update. + * maint.c (maintenance_info_sections) + (maintenance_translate_address, count_symtabs_and_blocks): + Update. + * main.c (captured_main_1): Update. + * linux-thread-db.c (try_thread_db_load_from_pdir) + (has_libpthread): Update. + * linespec.c (iterate_over_all_matching_symtabs) + (search_minsyms_for_name): Update. + * jit.c (jit_find_objf_with_entry_addr): Update. + * hppa-tdep.c (find_unwind_entry) + (hppa_lookup_stub_minimal_symbol): Update. + * gcore.c (gcore_create_callback, objfile_find_memory_regions): + Update. + * elfread.c (elf_gnu_ifunc_resolve_by_cache) + (elf_gnu_ifunc_resolve_by_got): Update. + * dwarf2-frame.c (dwarf2_frame_find_fde): Update. + * dwarf-index-write.c (save_gdb_index_command): Update. + * cp-support.c (add_symbol_overload_list_qualified): Update. + * breakpoint.c (create_overlay_event_breakpoint) + (create_longjmp_master_breakpoint) + (create_std_terminate_master_breakpoint) + (create_exception_master_breakpoint): Update. + * blockframe.c (find_pc_partial_function): Update. + * ada-lang.c (ada_lookup_simple_minsym, add_nonlocal_symbols) + (ada_collect_symbol_completion_matches) + (ada_add_global_exceptions): Update. + 2019-01-17 Tom Tromey * solib-target.c (lm_info_target_p): Remove typedef. Don't diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index dbd258a608..df915c594c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4922,7 +4922,7 @@ ada_lookup_simple_minsym (const char *name) symbol_name_matcher_ftype *match_name = ada_get_symbol_name_matcher (lookup_name); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile_msymbols (objfile)) { @@ -5612,7 +5612,7 @@ add_nonlocal_symbols (struct obstack *obstackp, bool is_wild_match = lookup_name.ada ().wild_match_p (); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { data.objfile = objfile; @@ -5645,7 +5645,7 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name = ada_lookup_name (lookup_name); std::string name1 = std::string ("<_ada_") + name + '>'; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { data.objfile = objfile; objfile->sf->qf->map_matching_symbols (objfile, name1.c_str (), @@ -6409,7 +6409,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker, anything that isn't a text symbol (everything else will be handled by the psymtab code above). */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile_msymbols (objfile)) { @@ -6465,7 +6465,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker, /* Go through the symtabs and check the externs and statics for symbols which match. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *s : objfile_compunits (objfile)) { @@ -6484,7 +6484,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker, } } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *s : objfile_compunits (objfile)) { @@ -13566,7 +13566,7 @@ ada_add_global_exceptions (compiled_regex *preg, NULL, VARIABLES_DOMAIN); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *s : objfile_compunits (objfile)) { diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 106f8a49c2..fe7807b87a 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -236,7 +236,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address, goto return_cached_value; msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (objfile->sf) { diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 2ab8a76326..3166fa0129 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3205,7 +3205,7 @@ create_overlay_event_breakpoint (void) { const char *const func_name = "_ovly_debug_event"; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { struct breakpoint *b; struct breakpoint_objfile_data *bp_objfile_data; @@ -3263,7 +3263,7 @@ create_longjmp_master_breakpoint (void) { set_current_program_space (pspace); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { int i; struct gdbarch *gdbarch; @@ -3366,7 +3366,7 @@ create_std_terminate_master_breakpoint (void) set_current_program_space (pspace); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { struct breakpoint *b; struct breakpoint_objfile_data *bp_objfile_data; @@ -3411,7 +3411,7 @@ create_exception_master_breakpoint (void) { const char *const func_name = "_Unwind_DebugHook"; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { struct breakpoint *b; struct gdbarch *gdbarch; diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c index 8abe494218..82b839336b 100644 --- a/gdb/compile/compile-object-run.c +++ b/gdb/compile/compile-object-run.c @@ -82,7 +82,7 @@ do_module_cleanup (void *arg, int registers_valid) } } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) if ((objfile->flags & OBJF_USERLOADED) == 0 && (strcmp (objfile_name (objfile), data->objfile_name_string) == 0)) { diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 16d8176341..4e4d2cbc74 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1378,7 +1378,7 @@ add_symbol_overload_list_qualified (const char *func_name, /* Look through the partial symtabs for all symbols which begin by matching FUNC_NAME. Make sure we read that symbol table in. */ - for (objfile *objf : all_objfiles (current_program_space)) + for (objfile *objf : current_program_space->objfiles ()) { if (objf->sf) objf->sf->qf->expand_symtabs_for_function (objf, func_name); @@ -1395,7 +1395,7 @@ 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 : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *cust : objfile_compunits (objfile)) { @@ -1405,7 +1405,7 @@ add_symbol_overload_list_qualified (const char *func_name, } } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *cust : objfile_compunits (objfile)) { diff --git a/gdb/dwarf-index-write.c b/gdb/dwarf-index-write.c index b11927d360..01c1256bcb 100644 --- a/gdb/dwarf-index-write.c +++ b/gdb/dwarf-index-write.c @@ -1662,7 +1662,7 @@ save_gdb_index_command (const char *arg, int from_tty) if (!*arg) error (_("usage: save gdb-index [-dwarf-5] DIRECTORY")); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { struct stat st; diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index deb8a80029..b3a2e627b0 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -1702,7 +1702,7 @@ bsearch_fde_cmp (const void *key, const void *element) static struct dwarf2_fde * dwarf2_frame_find_fde (CORE_ADDR *pc, CORE_ADDR *out_offset) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { struct dwarf2_fde_table *fde_table; struct dwarf2_fde **p_fde; diff --git a/gdb/elfread.c b/gdb/elfread.c index bc6b5ff69b..8fc6692b11 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -759,7 +759,7 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr) static int elf_gnu_ifunc_resolve_by_cache (const char *name, CORE_ADDR *addr_p) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { htab_t htab; struct elf_gnu_ifunc_cache *entry_p; @@ -804,7 +804,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p) name_got_plt = (char *) alloca (strlen (name) + got_suffix_len + 1); sprintf (name_got_plt, "%s" SYMBOL_GOT_PLT_SUFFIX, name); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { bfd *obfd = objfile->obfd; struct gdbarch *gdbarch = get_objfile_arch (objfile); diff --git a/gdb/gcore.c b/gdb/gcore.c index 1a2ed0cd7e..aca3be9858 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -426,7 +426,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read, If so, we can avoid copying its contents by clearing SEC_LOAD. */ struct obj_section *objsec; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, objsec) { bfd *abfd = objfile->obfd; @@ -493,7 +493,7 @@ objfile_find_memory_regions (struct target_ops *self, bfd_vma temp_bottom, temp_top; /* Call callback function for each objfile section. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, objsec) { bfd *ibfd = objfile->obfd; diff --git a/gdb/guile/scm-objfile.c b/gdb/guile/scm-objfile.c index 79b784aad6..c70de76617 100644 --- a/gdb/guile/scm-objfile.c +++ b/gdb/guile/scm-objfile.c @@ -370,7 +370,7 @@ gdbscm_objfiles (void) result = SCM_EOL; - for (objfile *objf : all_objfiles (current_program_space)) + for (objfile *objf : current_program_space->objfiles ()) { SCM item = ofscm_scm_from_objfile (objf); diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c index d621ed5e91..e5096944b6 100644 --- a/gdb/guile/scm-pretty-print.c +++ b/gdb/guile/scm-pretty-print.c @@ -427,7 +427,7 @@ ppscm_search_pp_list (SCM list, SCM value) static SCM ppscm_find_pretty_printer_from_objfiles (SCM value) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { objfile_smob *o_smob = ofscm_objfile_smob_from_objfile (objfile); SCM pp diff --git a/gdb/guile/scm-progspace.c b/gdb/guile/scm-progspace.c index 9fc650c67c..352d32d147 100644 --- a/gdb/guile/scm-progspace.c +++ b/gdb/guile/scm-progspace.c @@ -289,7 +289,7 @@ gdbscm_progspace_objfiles (SCM self) result = SCM_EOL; - for (objfile *objfile : all_objfiles (p_smob->pspace)) + for (objfile *objfile : p_smob->pspace->objfiles ()) { if (objfile->separate_debug_objfile_backlink == NULL) { diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 16e44252f5..46deeac90c 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -497,7 +497,7 @@ find_unwind_entry (CORE_ADDR pc) return NULL; } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { struct hppa_unwind_info *ui; ui = NULL; @@ -2542,7 +2542,7 @@ hppa_lookup_stub_minimal_symbol (const char *name, { struct bound_minimal_symbol result = { NULL, NULL }; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msym : objfile_msymbols (objfile)) { diff --git a/gdb/jit.c b/gdb/jit.c index 35e44e3426..b1cf2f5bb7 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -984,7 +984,7 @@ jit_unregister_code (struct objfile *objfile) static struct objfile * jit_find_objf_with_entry_addr (CORE_ADDR entry_addr) { - for (objfile *objf : all_objfiles (current_program_space)) + for (objfile *objf : current_program_space->objfiles ()) { struct jit_objfile_data *objf_data; diff --git a/gdb/linespec.c b/gdb/linespec.c index 71346078d7..54f17b7a8b 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1141,7 +1141,7 @@ iterate_over_all_matching_symtabs set_current_program_space (pspace); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (objfile->sf) objfile->sf->qf->expand_symtabs_matching (objfile, @@ -4357,7 +4357,7 @@ search_minsyms_for_name (struct collect_info *info, set_current_program_space (pspace); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { iterate_over_minimal_symbols (objfile, name, [&] (struct minimal_symbol *msym) diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index d6cbc34f33..d2b013e2e3 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -1056,7 +1056,7 @@ try_thread_db_load_from_pdir (const char *subdir) if (!auto_load_thread_db) return 0; - for (objfile *obj : all_objfiles (current_program_space)) + for (objfile *obj : current_program_space->objfiles ()) if (libpthread_name_p (objfile_name (obj))) { if (try_thread_db_load_from_pdir_1 (obj, subdir)) @@ -1165,7 +1165,7 @@ thread_db_load_search (void) static int has_libpthread (void) { - for (objfile *obj : all_objfiles (current_program_space)) + for (objfile *obj : current_program_space->objfiles ()) if (libpthread_name_p (objfile_name (obj))) return 1; diff --git a/gdb/main.c b/gdb/main.c index 7d9492b876..ebfc38329e 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -1123,7 +1123,7 @@ captured_main_1 (struct captured_main_args *context) We wait until now because it is common to add to the source search path in local_gdbinit. */ global_auto_load = save_auto_load; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) load_auto_scripts_for_objfile (objfile); /* Process '-x' and '-ex' options. */ diff --git a/gdb/maint.c b/gdb/maint.c index f286c63430..e653a5d4ac 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -357,7 +357,7 @@ maintenance_info_sections (const char *arg, int from_tty) if (strcmp (arg, "ALLOBJ") == 0) arg = NULL; - for (objfile *ofile : all_objfiles (current_program_space)) + for (objfile *ofile : current_program_space->objfiles ()) { printf_filtered (_(" Object file: %s\n"), bfd_get_filename (ofile->obfd)); @@ -447,7 +447,7 @@ maintenance_translate_address (const char *arg, int from_tty) int arg_len = p - arg; p = skip_spaces (p + 1); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, sect) { if (strncmp (sect->the_bfd_section->name, arg, arg_len) == 0) @@ -771,7 +771,7 @@ count_symtabs_and_blocks (int *nr_symtabs_ptr, int *nr_compunit_symtabs_ptr, current_program_space may be NULL. */ if (current_program_space != NULL) { - for (objfile *o : all_objfiles (current_program_space)) + for (objfile *o : current_program_space->objfiles ()) { for (compunit_symtab *cu : objfile_compunits (o)) { diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c index 2071b9fcb4..0d9770a2f5 100644 --- a/gdb/mi/mi-cmd-file.c +++ b/gdb/mi/mi-cmd-file.c @@ -92,7 +92,7 @@ mi_cmd_file_list_exec_source_files (const char *command, char **argv, int argc) uiout->begin (ui_out_type_list, "files"); /* Look at all of the file symtabs. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *cu : objfile_compunits (objfile)) { diff --git a/gdb/minsyms.c b/gdb/minsyms.c index d09022623d..053c93ece8 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1492,7 +1492,7 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc) if (tsymbol != NULL) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile_msymbols (objfile)) { diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 22c12fff3b..accd378816 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -605,7 +605,7 @@ info_selectors_command (const char *regexp, int from_tty) } /* First time thru is JUST to get max length and count. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile_msymbols (objfile)) { @@ -645,7 +645,7 @@ info_selectors_command (const char *regexp, int from_tty) sym_arr = XALLOCAVEC (struct symbol *, matches); matches = 0; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile_msymbols (objfile)) { @@ -759,7 +759,7 @@ info_classes_command (const char *regexp, int from_tty) } /* First time thru is JUST to get max length and count. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile_msymbols (objfile)) { @@ -786,7 +786,7 @@ info_classes_command (const char *regexp, int from_tty) regexp ? regexp : "*"); sym_arr = XALLOCAVEC (struct symbol *, matches); matches = 0; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile_msymbols (objfile)) { @@ -992,7 +992,7 @@ find_methods (char type, const char *theclass, const char *category, gdb_assert (symbol_names != NULL); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { unsigned int *objc_csym; diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 854e87db21..02b1a9d064 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -1013,7 +1013,7 @@ objfile_has_symbols (struct objfile *objfile) int have_partial_symbols (void) { - for (objfile *ofp : all_objfiles (current_program_space)) + for (objfile *ofp : current_program_space->objfiles ()) { if (objfile_has_partial_symbols (ofp)) return 1; @@ -1028,7 +1028,7 @@ have_partial_symbols (void) int have_full_symbols (void) { - for (objfile *ofp : all_objfiles (current_program_space)) + for (objfile *ofp : current_program_space->objfiles ()) { if (objfile_has_full_symbols (ofp)) return 1; @@ -1062,7 +1062,7 @@ objfile_purge_solibs (void) int have_minimal_symbols (void) { - for (objfile *ofp : all_objfiles (current_program_space)) + for (objfile *ofp : current_program_space->objfiles ()) { if (ofp->per_bfd->minimal_symbol_count > 0) { @@ -1133,7 +1133,7 @@ qsort_cmp (const void *a, const void *b) { /* Sort on sequence number of the objfile in the chain. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) if (objfile == objfile1) return -1; else if (objfile == objfile2) @@ -1317,7 +1317,7 @@ update_section_map (struct program_space *pspace, xfree (map); alloc_size = 0; - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, s) if (insert_section_p (objfile->obfd, s->the_bfd_section)) alloc_size += 1; @@ -1333,7 +1333,7 @@ update_section_map (struct program_space *pspace, map = XNEWVEC (struct obj_section *, alloc_size); i = 0; - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, s) if (insert_section_p (objfile->obfd, s->the_bfd_section)) map[i++] = s; @@ -1477,7 +1477,7 @@ int shared_objfile_contains_address_p (struct program_space *pspace, CORE_ADDR address) { - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) { if ((objfile->flags & OBJF_SHARED) != 0 && is_addr_in_objfile (address, objfile)) @@ -1488,7 +1488,7 @@ shared_objfile_contains_address_p (struct program_space *pspace, } /* The default implementation for the "iterate_over_objfiles_in_search_order" - gdbarch method. It is equivalent to use the all_objfiles iterable, + gdbarch method. It is equivalent to use the objfiles iterable, searching the objfiles in the order they are stored internally, ignoring CURRENT_OBJFILE. @@ -1503,7 +1503,7 @@ default_iterate_over_objfiles_in_search_order { int stop = 0; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { stop = cb (objfile, cb_data); if (stop) diff --git a/gdb/objfiles.h b/gdb/objfiles.h index f7d08c43b3..eca46e59f8 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -416,7 +416,7 @@ struct objfile Although this is a tree structure, GDB only support one level (ie a separate debug for a separate debug is not supported). Note that separate debug object are in the main chain and therefore will be - visited by all_objfiles & co iterators. Separate debug objfile always + visited by objfiles & co iterators. Separate debug objfile always has a non-nul separate_debug_objfile_backlink. */ /* Link to the first separate debug object, if any. */ @@ -553,21 +553,6 @@ extern void default_iterate_over_objfiles_in_search_order void *cb_data, struct objfile *current_objfile); -/* An iterarable object that can be used to iterate over all - objfiles. The basic use is in a foreach, like: - - for (objfile *objf : all_objfiles (pspace)) { ... } */ - -class all_objfiles : public next_adapter -{ -public: - - explicit all_objfiles (struct program_space *pspace) - : next_adapter (pspace->objfiles) - { - } -}; - /* An iterarable object that can be used to iterate over all objfiles. The basic use is in a foreach, like: @@ -585,7 +570,7 @@ public: explicit all_objfiles_safe (struct program_space *pspace) : next_adapter>> - (pspace->objfiles) + (pspace->objfiles_head) { } }; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 48bf56dd2f..df44ad826e 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1789,7 +1789,7 @@ static void ppc_linux_spe_context_inferior_created (struct target_ops *t, int from_tty) { ppc_linux_spe_context_lookup (NULL); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ppc_linux_spe_context_lookup (objfile); } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 9c476e743d..e6fdbcf344 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1282,7 +1282,7 @@ info_symbol_command (const char *arg, int from_tty) error_no_arg (_("address")); addr = parse_and_eval_address (arg); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, osect) { /* Only process each object file once, even if there's a separate diff --git a/gdb/probe.c b/gdb/probe.c index 7450e4cede..b9337a9d19 100644 --- a/gdb/probe.c +++ b/gdb/probe.c @@ -73,7 +73,7 @@ parse_probes_in_pspace (const static_probe_ops *spops, const char *name, std::vector *result) { - for (objfile *objfile : all_objfiles (search_pspace)) + for (objfile *objfile : search_pspace->objfiles ()) { if (!objfile->sf || !objfile->sf->sym_probe_fns) continue; @@ -249,7 +249,7 @@ find_probe_by_pc (CORE_ADDR pc) result.objfile = NULL; result.prob = NULL; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (!objfile->sf || !objfile->sf->sym_probe_fns || objfile->sect_index_text == -1) @@ -294,7 +294,7 @@ collect_probes (const std::string &objname, const std::string &provider, obj_pat.emplace (objname.c_str (), REG_NOSUB, _("Invalid object file regexp")); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (! objfile->sf || ! objfile->sf->sym_probe_fns) continue; diff --git a/gdb/progspace.h b/gdb/progspace.h index 825daff202..abc53973b6 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -137,6 +137,17 @@ struct program_space program_space (address_space *aspace_); ~program_space (); + typedef next_adapter objfiles_range; + + /* Return an iterarable object that can be used to iterate over all + objfiles. The basic use is in a foreach, like: + + for (objfile *objf : pspace->objfiles ()) { ... } */ + objfiles_range objfiles () + { + return objfiles_range (objfiles_head); + } + /* Pointer to next in linked list. */ struct program_space *next = NULL; @@ -189,7 +200,7 @@ struct program_space /* All known objfiles are kept in a linked list. This points to the head of this list. */ - struct objfile *objfiles = NULL; + struct objfile *objfiles_head = NULL; /* The set of target sections matching the sections mapped into this program space. Managed by both exec_ops and solib.c. */ @@ -232,7 +243,7 @@ struct address_space /* All known objfiles are kept in a linked list. This points to the root of this list. */ -#define object_files current_program_space->objfiles +#define object_files current_program_space->objfiles_head /* The set of target sections matching the sections mapped into the current program space. */ diff --git a/gdb/psymtab.c b/gdb/psymtab.c index e034fda340..776f59c3ac 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1942,7 +1942,7 @@ maintenance_print_psymbols (const char *args, int from_tty) } found = 0; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { int printed_objfile_header = 0; int print_for_objfile = 1; @@ -2035,7 +2035,7 @@ maintenance_info_psymtabs (const char *regexp, int from_tty) re_comp (regexp); ALL_PSPACES (pspace) - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) { struct gdbarch *gdbarch = get_objfile_arch (objfile); @@ -2148,7 +2148,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty) struct block *b; int length; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) for (partial_symtab *ps : require_partial_symbols (objfile, 1)) { struct gdbarch *gdbarch = get_objfile_arch (objfile); diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c index d9cf548adb..efad0072c2 100644 --- a/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c @@ -501,7 +501,7 @@ objfpy_build_id_matches (const struct bfd_build_id *build_id, static struct objfile * objfpy_lookup_objfile_by_name (const char *name) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { const char *filename; @@ -527,7 +527,7 @@ objfpy_lookup_objfile_by_name (const char *name) static struct objfile * objfpy_lookup_objfile_by_build_id (const char *build_id) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { const struct bfd_build_id *obfd_build_id; diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index 4092fdb79f..ae3001e616 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -93,7 +93,7 @@ search_pp_list (PyObject *list, PyObject *value) static PyObject * find_pretty_printer_from_objfiles (PyObject *value) { - for (objfile *obj : all_objfiles (current_program_space)) + for (objfile *obj : current_program_space->objfiles ()) { gdbpy_ref<> objf = objfile_to_objfile_object (obj); if (objf == NULL) diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c index a17ef69df7..b80b2c260f 100644 --- a/gdb/python/py-progspace.c +++ b/gdb/python/py-progspace.c @@ -333,7 +333,7 @@ pspy_get_objfiles (PyObject *self_, PyObject *args) if (self->pspace != NULL) { - for (objfile *objf : all_objfiles (self->pspace)) + for (objfile *objf : self->pspace->objfiles ()) { gdbpy_ref<> item = objfile_to_objfile_object (objf); diff --git a/gdb/python/py-xmethods.c b/gdb/python/py-xmethods.c index acf521dfe3..2e0b2bbcc9 100644 --- a/gdb/python/py-xmethods.c +++ b/gdb/python/py-xmethods.c @@ -143,7 +143,7 @@ gdbpy_get_matching_xmethod_workers /* Gather debug method matchers registered with the object files. This could be done differently by iterating over each objfile's matcher list individually, but there's no data yet to show it's needed. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile); diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c index d68150eb3c..4f5e8e0c75 100644 --- a/gdb/solib-spu.c +++ b/gdb/solib-spu.c @@ -102,7 +102,7 @@ append_ocl_sos (struct so_list **link_ptr) { CORE_ADDR *ocl_program_addr_base; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { ocl_program_addr_base = (CORE_ADDR *) objfile_data (objfile, ocl_program_data_key); diff --git a/gdb/solib.c b/gdb/solib.c index 30eac1d3f5..3a6db5e12d 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -678,7 +678,7 @@ solib_read_symbols (struct so_list *so, symfile_add_flags flags) { /* Have we already loaded this shared object? */ so->objfile = nullptr; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (filename_cmp (objfile_name (objfile), so->so_name) == 0 && objfile->addr_low == so->addr_low) diff --git a/gdb/source.c b/gdb/source.c index abe4c6cf1e..196680deaf 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -269,7 +269,7 @@ select_source_symtab (struct symtab *s) current_source_line = 1; - for (objfile *ofp : all_objfiles (current_program_space)) + for (objfile *ofp : current_program_space->objfiles ()) { for (compunit_symtab *cu : objfile_compunits (ofp)) { @@ -291,7 +291,7 @@ select_source_symtab (struct symtab *s) if (current_source_symtab) return; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (objfile->sf) s = objfile->sf->qf->find_last_source_symtab (objfile); @@ -382,7 +382,7 @@ forget_cached_source_info (void) struct program_space *pspace; ALL_PSPACES (pspace) - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) { forget_cached_source_info_for_objfile (objfile); } diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index 33081fb828..a9bab946bd 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -1883,7 +1883,7 @@ spu_overlay_update (struct obj_section *osect) /* All sections. */ else { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, osect) if (section_is_overlay (osect)) spu_overlay_update_osect (osect); @@ -2003,7 +2003,7 @@ spu_objfile_from_frame (struct frame_info *frame) if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) return NULL; - for (objfile *obj : all_objfiles (current_program_space)) + for (objfile *obj : current_program_space->objfiles ()) { if (obj->sections != obj->sections_end && SPUADDR_SPU (obj_section_addr (obj->sections)) == tdep->id) diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index b71fa8b001..9dc1880732 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -662,7 +662,7 @@ set_debug_symfile (const char *args, int from_tty, struct cmd_list_element *c) struct program_space *pspace; ALL_PSPACES (pspace) - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) { if (debug_symfile) { diff --git a/gdb/symfile.c b/gdb/symfile.c index 04197120db..7f800add8c 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2351,7 +2351,7 @@ remove_symbol_file_command (const char *args, int from_tty) addr = parse_and_eval_address (argv[1]); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if ((objfile->flags & OBJF_USERLOADED) != 0 && (objfile->flags & OBJF_SHARED) != 0 @@ -2372,7 +2372,7 @@ remove_symbol_file_command (const char *args, int from_tty) gdb::unique_xmalloc_ptr filename (tilde_expand (argv[0])); - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if ((objfile->flags & OBJF_USERLOADED) != 0 && (objfile->flags & OBJF_SHARED) != 0 @@ -2980,7 +2980,7 @@ overlay_invalidate_all (void) { struct obj_section *sect; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, sect) if (section_is_overlay (sect)) sect->ovly_mapped = -1; @@ -3158,7 +3158,7 @@ find_pc_overlay (CORE_ADDR pc) if (overlay_debugging) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, osect) if (section_is_overlay (osect)) { @@ -3187,7 +3187,7 @@ find_pc_mapped_section (CORE_ADDR pc) if (overlay_debugging) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, osect) if (pc_in_mapped_range (pc, osect) && section_is_mapped (osect)) return osect; @@ -3207,7 +3207,7 @@ list_overlays_command (const char *args, int from_tty) if (overlay_debugging) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, osect) if (section_is_mapped (osect)) { @@ -3255,7 +3255,7 @@ map_overlay_command (const char *args, int from_tty) error (_("Argument required: name of an overlay section")); /* First, find a section matching the user supplied argument. */ - for (objfile *obj_file : all_objfiles (current_program_space)) + for (objfile *obj_file : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (obj_file, sec) if (!strcmp (bfd_section_name (obj_file->obfd, sec->the_bfd_section), args)) @@ -3269,7 +3269,7 @@ map_overlay_command (const char *args, int from_tty) /* Next, make a pass and unmap any sections that are overlapped by this new section: */ - for (objfile *objfile2 : all_objfiles (current_program_space)) + for (objfile *objfile2 : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile2, sec2) if (sec2->ovly_mapped && sec != sec2 && sections_overlap (sec, sec2)) @@ -3303,7 +3303,7 @@ unmap_overlay_command (const char *args, int from_tty) error (_("Argument required: name of an overlay section")); /* First, find a section matching the user supplied argument. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, sec) if (!strcmp (bfd_section_name (objfile->obfd, sec->the_bfd_section), args)) { @@ -3574,7 +3574,7 @@ simple_overlay_update (struct obj_section *osect) return; /* Now may as well update all sections, even if only one was requested. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, osect) if (section_is_overlay (osect)) { @@ -3790,7 +3790,7 @@ expand_symtabs_matching gdb::function_view expansion_notify, enum search_domain kind) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (objfile->sf) objfile->sf->qf->expand_symtabs_matching (objfile, file_matcher, @@ -3808,7 +3808,7 @@ void map_symbol_filenames (symbol_filename_ftype *fun, void *data, int need_fullname) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (objfile->sf) objfile->sf->qf->map_symbol_filenames (objfile, fun, data, diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 92c054cba3..d2feddc39b 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -64,7 +64,7 @@ print_symbol_bcache_statistics (void) struct program_space *pspace; ALL_PSPACES (pspace) - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) { QUIT; printf_filtered (_("Byte cache statistics for '%s':\n"), @@ -86,7 +86,7 @@ print_objfile_statistics (void) int i, linetables, blockvectors; ALL_PSPACES (pspace) - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) { QUIT; printf_filtered (_("Statistics for '%s':\n"), objfile_name (objfile)); @@ -475,7 +475,7 @@ maintenance_print_symbols (const char *args, int from_tty) { int found = 0; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { int print_for_objfile = 1; @@ -736,7 +736,7 @@ maintenance_print_msymbols (const char *args, int from_tty) outfile = &arg_outfile; } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { QUIT; if (objfile_arg == NULL @@ -756,7 +756,7 @@ maintenance_print_objfiles (const char *regexp, int from_tty) re_comp (regexp); ALL_PSPACES (pspace) - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) { QUIT; if (! regexp @@ -778,7 +778,7 @@ maintenance_info_symtabs (const char *regexp, int from_tty) re_comp (regexp); ALL_PSPACES (pspace) - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) { /* We don't want to print anything for this objfile until we actually find a symtab whose name matches. */ @@ -863,7 +863,7 @@ maintenance_check_symtabs (const char *ignore, int from_tty) struct program_space *pspace; ALL_PSPACES (pspace) - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) { /* We don't want to print anything for this objfile until we actually find something worth printing. */ @@ -929,7 +929,7 @@ maintenance_expand_symtabs (const char *args, int from_tty) re_comp (regexp); ALL_PSPACES (pspace) - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) { if (objfile->sf) { @@ -1030,7 +1030,7 @@ maintenance_info_line_tables (const char *regexp, int from_tty) re_comp (regexp); ALL_PSPACES (pspace) - for (objfile *objfile : all_objfiles (pspace)) + for (objfile *objfile : pspace->objfiles ()) { for (compunit_symtab *cust : objfile_compunits (objfile)) { diff --git a/gdb/symtab.c b/gdb/symtab.c index b6751bec6b..370c8b45b3 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -473,7 +473,7 @@ iterate_over_symtabs (const char *name, gdb_assert (IS_ABSOLUTE_PATH (real_path.get ())); } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (iterate_over_some_symtabs (name, real_path.get (), objfile->compunit_symtabs, NULL, @@ -484,7 +484,7 @@ iterate_over_symtabs (const char *name, /* Same search rules as above apply here, but now we look thru the psymtabs. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (objfile->sf && objfile->sf->qf->map_symtabs_matching_filename (objfile, @@ -1010,7 +1010,7 @@ matching_obj_sections (struct obj_section *obj_first, /* Otherwise check that they are in corresponding objfiles. */ struct objfile *obj = NULL; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) if (objfile->obfd == first->owner) { obj = objfile; @@ -1047,7 +1047,7 @@ expand_symtab_containing_pc (CORE_ADDR pc, struct obj_section *section) || MSYMBOL_TYPE (msymbol.minsym) == mst_file_bss)) return; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { struct compunit_symtab *cust = NULL; @@ -2169,7 +2169,7 @@ lookup_objfile_from_block (const struct block *block) block = block_global_block (block); /* Look through all blockvectors. */ - for (objfile *obj : all_objfiles (current_program_space)) + for (objfile *obj : current_program_space->objfiles ()) { for (compunit_symtab *cust : objfile_compunits (obj)) if (block == BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), @@ -2588,7 +2588,7 @@ lookup_static_symbol (const char *name, const domain_enum domain) return result; } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { result = lookup_symbol_in_objfile (objfile, STATIC_BLOCK, name, domain); if (result.symbol != NULL) @@ -2795,14 +2795,14 @@ basic_lookup_transparent_type (const char *name) of the desired name as a global, then do psymtab-to-symtab conversion on the fly and return the found symbol. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { t = basic_lookup_transparent_type_1 (objfile, GLOBAL_BLOCK, name); if (t) return t; } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { t = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK, name); if (t) @@ -2816,14 +2816,14 @@ basic_lookup_transparent_type (const char *name) of the desired name as a file-level static, then do psymtab-to-symtab conversion on the fly and return the found symbol. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { t = basic_lookup_transparent_type_1 (objfile, STATIC_BLOCK, name); if (t) return t; } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { t = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK, name); if (t) @@ -2902,7 +2902,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section) It also happens for objfiles that have their functions reordered. For these, the symtab we are looking for is not necessarily read in. */ - for (objfile *obj_file : all_objfiles (current_program_space)) + for (objfile *obj_file : current_program_space->objfiles ()) { for (compunit_symtab *cust : objfile_compunits (obj_file)) { @@ -2964,7 +2964,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section) /* Not found in symtabs, search the "quick" symtabs (e.g. psymtabs). */ - for (objfile *objf : all_objfiles (current_program_space)) + for (objfile *objf : current_program_space->objfiles ()) { struct compunit_symtab *result; @@ -2996,7 +2996,7 @@ find_pc_compunit_symtab (CORE_ADDR pc) struct symbol * find_symbol_at_address (CORE_ADDR address) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (objfile->sf == NULL || objfile->sf->qf->find_compunit_symtab_by_address == NULL) @@ -3351,14 +3351,14 @@ find_line_symtab (struct symtab *sym_tab, int line, else best = 0; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (objfile->sf) objfile->sf->qf->expand_symtabs_with_fullname (objfile, symtab_to_fullname (sym_tab)); } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *cu : objfile_compunits (objfile)) { @@ -4198,7 +4198,7 @@ info_sources_command (const char *ignore, int from_tty) printf_filtered ("Source files for which symbols have been read in:\n\n"); data.first = 1; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *cu : objfile_compunits (objfile)) { @@ -4453,7 +4453,7 @@ search_symbols (const char *regexp, enum search_domain kind, if (nfiles == 0 && (kind == VARIABLES_DOMAIN || kind == FUNCTIONS_DOMAIN)) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile_msymbols (objfile)) { @@ -4490,7 +4490,7 @@ search_symbols (const char *regexp, enum search_domain kind, } } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *cust : objfile_compunits (objfile)) { @@ -4556,7 +4556,7 @@ search_symbols (const char *regexp, enum search_domain kind, if ((found_misc || (nfiles == 0 && kind != FUNCTIONS_DOMAIN)) && !treg.has_value ()) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile_msymbols (objfile)) { @@ -5272,7 +5272,7 @@ default_collect_symbol_completion_matches_break_on if (code == TYPE_CODE_UNDEF) { - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile_msymbols (objfile)) { @@ -5291,7 +5291,7 @@ default_collect_symbol_completion_matches_break_on } /* Add completions for all currently loaded symbol tables. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *cust : objfile_compunits (objfile)) add_symtab_completions (cust, tracker, mode, lookup_name, @@ -5600,7 +5600,7 @@ make_source_files_completion_list (const char *text, const char *word) filename_seen_cache filenames_seen; - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *cu : objfile_compunits (objfile)) { @@ -5717,7 +5717,7 @@ find_main_name (void) relies on the order of objfile creation -- which still isn't guaranteed to get the correct answer, but is just probably more accurate. */ - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (objfile->per_bfd->name_of_main != NULL) { diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 9258f39eca..2f223b3dfe 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -423,7 +423,7 @@ windows_iterate_over_objfiles_in_search_order return; } - for (objfile *objfile : all_objfiles (current_program_space)) + for (objfile *objfile : current_program_space->objfiles ()) { if (objfile != current_objfile) { -- 2.34.1