Commit 2030c079 authored by Tom Tromey's avatar Tom Tromey
Browse files

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  <tom@tromey.com>

	* progspace.h (program_space) <objfiles_range>: New typedef.
	<objfiles>: New method.
	<objfiles_head>: 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.
parent 776489e0
2019-01-17 Tom Tromey <tom@tromey.com>
* progspace.h (program_space) <objfiles_range>: New typedef.
<objfiles>: New method.
<objfiles_head>: 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 <tom@tromey.com>
* solib-target.c (lm_info_target_p): Remove typedef. Don't
......
......@@ -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))
{
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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))
{
......
......@@ -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))
{
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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
......
......@@ -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)
{
......
......@@ -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))
{
......
......@@ -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;
......
......@@ -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)
......
......@@ -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;
......
......@@ -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. */
......
......@@ -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))
{
......
......@@ -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))
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment