From 2030c079717475f5b6fad837bb81758891f3b802 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 15 Jan 2019 16:55:05 -0700 Subject: 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/symtab.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'gdb/symtab.c') diff --git a/gdb/symtab.c b/gdb/symtab.c index b6751be..370c8b4 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) { -- cgit v1.1