Remove most uses of ALL_OBJFILES

This removes most uses of ALL_OBJFILES, replacing them with ranged for
loops.  The remaining uses are all in macros, and will be removed in
subsequent patches.

gdb/ChangeLog
2019-01-09  Tom Tromey  <tom@tromey.com>

	* symtab.c (iterate_over_symtabs, matching_obj_sections)
	(expand_symtab_containing_pc, lookup_static_symbol)
	(basic_lookup_transparent_type, find_pc_sect_compunit_symtab)
	(find_symbol_at_address, find_line_symtab, find_main_name): Use
	all_objfiles.
	* probe.c (find_probe_by_pc, collect_probes): Use all_objfiles.
	* breakpoint.c (create_overlay_event_breakpoint)
	(create_longjmp_master_breakpoint)
	(create_std_terminate_master_breakpoint)
	(create_exception_master_breakpoint): Use all_objfiles.
	* linux-thread-db.c (try_thread_db_load_from_pdir)
	(has_libpthread): Use all_objfiles.
	* ada-lang.c (add_nonlocal_symbols): Use all_objfiles.
	* linespec.c (iterate_over_all_matching_symtabs)
	(search_minsyms_for_name): Use all_objfiles.
	* maint.c (maintenance_info_sections): Use all_objfiles.
	* main.c (captured_main_1): Use all_objfiles.
	* spu-tdep.c (spu_objfile_from_frame): Use all_objfiles.
	* guile/scm-objfile.c (gdbscm_objfiles): Use all_objfiles.
	* guile/scm-pretty-print.c
	(ppscm_find_pretty_printer_from_objfiles): Use all_objfiles.
	* solib-spu.c (append_ocl_sos): Use all_objfiles.
	* symmisc.c (maintenance_print_symbols): Use all_objfiles.
	(maintenance_print_msymbols): Use all_objfiles.
	* source.c (select_source_symtab): Use all_objfiles.
	* jit.c (jit_find_objf_with_entry_addr): Use all_objfiles.
	* symfile.c (remove_symbol_file_command)
	(expand_symtabs_matching, map_symbol_filenames): Use
	all_objfiles.
	* ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Use
	all_objfiles.
	* dwarf2-frame.c (dwarf2_frame_find_fde): Use all_objfiles.
	* objc-lang.c (find_methods): Use all_objfiles.
	* objfiles.c (have_partial_symbols, have_full_symbols)
	(have_minimal_symbols, qsort_cmp)
	(default_iterate_over_objfiles_in_search_order): Use
	all_objfiles.
	* hppa-tdep.c (find_unwind_entry): Use all_objfiles.
	* psymtab.c (maintenance_print_psymbols): Use all_objfiles.
	(maintenance_check_psymtabs): Use all_objfiles.
	(ALL_PSYMTABS): Remove.
	* compile/compile-object-run.c (do_module_cleanup): Use
	all_objfiles.
	* blockframe.c (find_pc_partial_function): Use all_objfiles.
	* cp-support.c (add_symbol_overload_list_qualified): Use
	all_objfiles.
	* windows-tdep.c (windows_iterate_over_objfiles_in_search_order):
	Use all_objfiles.
	* dwarf-index-write.c (save_gdb_index_command): Use all_objfiles.
	* python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Use
	all_objfiles.
	* python/py-objfile.c (objfpy_lookup_objfile_by_name)
	(objfpy_lookup_objfile_by_build_id): Use all_objfiles.
	* python/py-prettyprint.c (find_pretty_printer_from_objfiles):
	Uses all_objfiles.
	* solib.c (solib_read_symbols): Use all_objfiles
This commit is contained in:
Tom Tromey 2018-11-23 12:20:05 -07:00
parent 99d89cdea6
commit aed57c5371
32 changed files with 619 additions and 614 deletions

View File

@ -1,3 +1,62 @@
2019-01-09 Tom Tromey <tom@tromey.com>
* symtab.c (iterate_over_symtabs, matching_obj_sections)
(expand_symtab_containing_pc, lookup_static_symbol)
(basic_lookup_transparent_type, find_pc_sect_compunit_symtab)
(find_symbol_at_address, find_line_symtab, find_main_name): Use
all_objfiles.
* probe.c (find_probe_by_pc, collect_probes): Use all_objfiles.
* breakpoint.c (create_overlay_event_breakpoint)
(create_longjmp_master_breakpoint)
(create_std_terminate_master_breakpoint)
(create_exception_master_breakpoint): Use all_objfiles.
* linux-thread-db.c (try_thread_db_load_from_pdir)
(has_libpthread): Use all_objfiles.
* ada-lang.c (add_nonlocal_symbols): Use all_objfiles.
* linespec.c (iterate_over_all_matching_symtabs)
(search_minsyms_for_name): Use all_objfiles.
* maint.c (maintenance_info_sections): Use all_objfiles.
* main.c (captured_main_1): Use all_objfiles.
* spu-tdep.c (spu_objfile_from_frame): Use all_objfiles.
* guile/scm-objfile.c (gdbscm_objfiles): Use all_objfiles.
* guile/scm-pretty-print.c
(ppscm_find_pretty_printer_from_objfiles): Use all_objfiles.
* solib-spu.c (append_ocl_sos): Use all_objfiles.
* symmisc.c (maintenance_print_symbols): Use all_objfiles.
(maintenance_print_msymbols): Use all_objfiles.
* source.c (select_source_symtab): Use all_objfiles.
* jit.c (jit_find_objf_with_entry_addr): Use all_objfiles.
* symfile.c (remove_symbol_file_command)
(expand_symtabs_matching, map_symbol_filenames): Use
all_objfiles.
* ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Use
all_objfiles.
* dwarf2-frame.c (dwarf2_frame_find_fde): Use all_objfiles.
* objc-lang.c (find_methods): Use all_objfiles.
* objfiles.c (have_partial_symbols, have_full_symbols)
(have_minimal_symbols, qsort_cmp)
(default_iterate_over_objfiles_in_search_order): Use
all_objfiles.
* hppa-tdep.c (find_unwind_entry): Use all_objfiles.
* psymtab.c (maintenance_print_psymbols): Use all_objfiles.
(maintenance_check_psymtabs): Use all_objfiles.
(ALL_PSYMTABS): Remove.
* compile/compile-object-run.c (do_module_cleanup): Use
all_objfiles.
* blockframe.c (find_pc_partial_function): Use all_objfiles.
* cp-support.c (add_symbol_overload_list_qualified): Use
all_objfiles.
* windows-tdep.c (windows_iterate_over_objfiles_in_search_order):
Use all_objfiles.
* dwarf-index-write.c (save_gdb_index_command): Use all_objfiles.
* python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Use
all_objfiles.
* python/py-objfile.c (objfpy_lookup_objfile_by_name)
(objfpy_lookup_objfile_by_build_id): Use all_objfiles.
* python/py-prettyprint.c (find_pretty_printer_from_objfiles):
Uses all_objfiles.
* solib.c (solib_read_symbols): Use all_objfiles
2019-01-09 Tom Tromey <tom@tromey.com> 2019-01-09 Tom Tromey <tom@tromey.com>
* probe.c (parse_probes_in_pspace): Use all_objfiles. * probe.c (parse_probes_in_pspace): Use all_objfiles.

View File

@ -5604,7 +5604,6 @@ add_nonlocal_symbols (struct obstack *obstackp,
const lookup_name_info &lookup_name, const lookup_name_info &lookup_name,
domain_enum domain, int global) domain_enum domain, int global)
{ {
struct objfile *objfile;
struct compunit_symtab *cu; struct compunit_symtab *cu;
struct match_data data; struct match_data data;
@ -5613,7 +5612,7 @@ add_nonlocal_symbols (struct obstack *obstackp,
bool is_wild_match = lookup_name.ada ().wild_match_p (); bool is_wild_match = lookup_name.ada ().wild_match_p ();
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
data.objfile = objfile; data.objfile = objfile;
@ -5646,7 +5645,7 @@ add_nonlocal_symbols (struct obstack *obstackp,
const char *name = ada_lookup_name (lookup_name); const char *name = ada_lookup_name (lookup_name);
std::string name1 = std::string ("<_ada_") + name + '>'; std::string name1 = std::string ("<_ada_") + name + '>';
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
data.objfile = objfile; data.objfile = objfile;
objfile->sf->qf->map_matching_symbols (objfile, name1.c_str (), objfile->sf->qf->map_matching_symbols (objfile, name1.c_str (),

View File

@ -217,7 +217,6 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
struct symbol *f; struct symbol *f;
struct bound_minimal_symbol msymbol; struct bound_minimal_symbol msymbol;
struct compunit_symtab *compunit_symtab = NULL; struct compunit_symtab *compunit_symtab = NULL;
struct objfile *objfile;
CORE_ADDR mapped_pc; CORE_ADDR mapped_pc;
/* To ensure that the symbol returned belongs to the correct setion /* To ensure that the symbol returned belongs to the correct setion
@ -237,18 +236,19 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
goto return_cached_value; goto return_cached_value;
msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section); msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section);
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
if (objfile->sf) if (objfile->sf)
{ {
compunit_symtab compunit_symtab
= objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol, = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol,
mapped_pc, section, mapped_pc,
0); section,
} 0);
if (compunit_symtab != NULL) }
break; if (compunit_symtab != NULL)
} break;
}
if (compunit_symtab != NULL) if (compunit_symtab != NULL)
{ {

View File

@ -3203,10 +3203,9 @@ free_breakpoint_objfile_data (struct objfile *obj, void *data)
static void static void
create_overlay_event_breakpoint (void) create_overlay_event_breakpoint (void)
{ {
struct objfile *objfile;
const char *const func_name = "_ovly_debug_event"; const char *const func_name = "_ovly_debug_event";
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
struct breakpoint *b; struct breakpoint *b;
struct breakpoint_objfile_data *bp_objfile_data; struct breakpoint_objfile_data *bp_objfile_data;
@ -3262,95 +3261,93 @@ create_longjmp_master_breakpoint (void)
ALL_PSPACES (pspace) ALL_PSPACES (pspace)
{ {
struct objfile *objfile;
set_current_program_space (pspace); set_current_program_space (pspace);
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
int i; int i;
struct gdbarch *gdbarch; struct gdbarch *gdbarch;
struct breakpoint_objfile_data *bp_objfile_data; struct breakpoint_objfile_data *bp_objfile_data;
gdbarch = get_objfile_arch (objfile); gdbarch = get_objfile_arch (objfile);
bp_objfile_data = get_breakpoint_objfile_data (objfile); bp_objfile_data = get_breakpoint_objfile_data (objfile);
if (!bp_objfile_data->longjmp_searched) if (!bp_objfile_data->longjmp_searched)
{ {
std::vector<probe *> ret std::vector<probe *> ret
= find_probes_in_objfile (objfile, "libc", "longjmp"); = find_probes_in_objfile (objfile, "libc", "longjmp");
if (!ret.empty ()) if (!ret.empty ())
{ {
/* We are only interested in checking one element. */ /* We are only interested in checking one element. */
probe *p = ret[0]; probe *p = ret[0];
if (!p->can_evaluate_arguments ()) if (!p->can_evaluate_arguments ())
{ {
/* We cannot use the probe interface here, because it does /* We cannot use the probe interface here, because it does
not know how to evaluate arguments. */ not know how to evaluate arguments. */
ret.clear (); ret.clear ();
} }
} }
bp_objfile_data->longjmp_probes = ret; bp_objfile_data->longjmp_probes = ret;
bp_objfile_data->longjmp_searched = 1; bp_objfile_data->longjmp_searched = 1;
} }
if (!bp_objfile_data->longjmp_probes.empty ()) if (!bp_objfile_data->longjmp_probes.empty ())
{ {
for (probe *p : bp_objfile_data->longjmp_probes) for (probe *p : bp_objfile_data->longjmp_probes)
{ {
struct breakpoint *b; struct breakpoint *b;
b = create_internal_breakpoint (gdbarch, b = create_internal_breakpoint (gdbarch,
p->get_relocated_address (objfile), p->get_relocated_address (objfile),
bp_longjmp_master, bp_longjmp_master,
&internal_breakpoint_ops); &internal_breakpoint_ops);
b->location = new_probe_location ("-probe-stap libc:longjmp"); b->location = new_probe_location ("-probe-stap libc:longjmp");
b->enable_state = bp_disabled; b->enable_state = bp_disabled;
} }
continue;
}
if (!gdbarch_get_longjmp_target_p (gdbarch))
continue;
for (i = 0; i < NUM_LONGJMP_NAMES; i++)
{
struct breakpoint *b;
const char *func_name;
CORE_ADDR addr;
struct explicit_location explicit_loc;
if (msym_not_found_p (bp_objfile_data->longjmp_msym[i].minsym))
continue; continue;
}
func_name = longjmp_names[i]; if (!gdbarch_get_longjmp_target_p (gdbarch))
if (bp_objfile_data->longjmp_msym[i].minsym == NULL) continue;
{
struct bound_minimal_symbol m;
m = lookup_minimal_symbol_text (func_name, objfile); for (i = 0; i < NUM_LONGJMP_NAMES; i++)
if (m.minsym == NULL) {
{ struct breakpoint *b;
/* Prevent future lookups in this objfile. */ const char *func_name;
bp_objfile_data->longjmp_msym[i].minsym = &msym_not_found; CORE_ADDR addr;
continue; struct explicit_location explicit_loc;
}
bp_objfile_data->longjmp_msym[i] = m;
}
addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->longjmp_msym[i]); if (msym_not_found_p (bp_objfile_data->longjmp_msym[i].minsym))
b = create_internal_breakpoint (gdbarch, addr, bp_longjmp_master, continue;
&internal_breakpoint_ops);
initialize_explicit_location (&explicit_loc); func_name = longjmp_names[i];
explicit_loc.function_name = ASTRDUP (func_name); if (bp_objfile_data->longjmp_msym[i].minsym == NULL)
b->location = new_explicit_location (&explicit_loc); {
b->enable_state = bp_disabled; struct bound_minimal_symbol m;
}
} m = lookup_minimal_symbol_text (func_name, objfile);
if (m.minsym == NULL)
{
/* Prevent future lookups in this objfile. */
bp_objfile_data->longjmp_msym[i].minsym = &msym_not_found;
continue;
}
bp_objfile_data->longjmp_msym[i] = m;
}
addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->longjmp_msym[i]);
b = create_internal_breakpoint (gdbarch, addr, bp_longjmp_master,
&internal_breakpoint_ops);
initialize_explicit_location (&explicit_loc);
explicit_loc.function_name = ASTRDUP (func_name);
b->location = new_explicit_location (&explicit_loc);
b->enable_state = bp_disabled;
}
}
} }
} }
@ -3365,46 +3362,45 @@ create_std_terminate_master_breakpoint (void)
ALL_PSPACES (pspace) ALL_PSPACES (pspace)
{ {
struct objfile *objfile;
CORE_ADDR addr; CORE_ADDR addr;
set_current_program_space (pspace); set_current_program_space (pspace);
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
struct breakpoint *b; struct breakpoint *b;
struct breakpoint_objfile_data *bp_objfile_data; struct breakpoint_objfile_data *bp_objfile_data;
struct explicit_location explicit_loc; struct explicit_location explicit_loc;
bp_objfile_data = get_breakpoint_objfile_data (objfile); bp_objfile_data = get_breakpoint_objfile_data (objfile);
if (msym_not_found_p (bp_objfile_data->terminate_msym.minsym)) if (msym_not_found_p (bp_objfile_data->terminate_msym.minsym))
continue; continue;
if (bp_objfile_data->terminate_msym.minsym == NULL) if (bp_objfile_data->terminate_msym.minsym == NULL)
{ {
struct bound_minimal_symbol m; struct bound_minimal_symbol m;
m = lookup_minimal_symbol (func_name, NULL, objfile); m = lookup_minimal_symbol (func_name, NULL, objfile);
if (m.minsym == NULL || (MSYMBOL_TYPE (m.minsym) != mst_text if (m.minsym == NULL || (MSYMBOL_TYPE (m.minsym) != mst_text
&& MSYMBOL_TYPE (m.minsym) != mst_file_text)) && MSYMBOL_TYPE (m.minsym) != mst_file_text))
{ {
/* Prevent future lookups in this objfile. */ /* Prevent future lookups in this objfile. */
bp_objfile_data->terminate_msym.minsym = &msym_not_found; bp_objfile_data->terminate_msym.minsym = &msym_not_found;
continue; continue;
} }
bp_objfile_data->terminate_msym = m; bp_objfile_data->terminate_msym = m;
} }
addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->terminate_msym); addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->terminate_msym);
b = create_internal_breakpoint (get_objfile_arch (objfile), addr, b = create_internal_breakpoint (get_objfile_arch (objfile), addr,
bp_std_terminate_master, bp_std_terminate_master,
&internal_breakpoint_ops); &internal_breakpoint_ops);
initialize_explicit_location (&explicit_loc); initialize_explicit_location (&explicit_loc);
explicit_loc.function_name = ASTRDUP (func_name); explicit_loc.function_name = ASTRDUP (func_name);
b->location = new_explicit_location (&explicit_loc); b->location = new_explicit_location (&explicit_loc);
b->enable_state = bp_disabled; b->enable_state = bp_disabled;
} }
} }
} }
@ -3413,10 +3409,9 @@ create_std_terminate_master_breakpoint (void)
static void static void
create_exception_master_breakpoint (void) create_exception_master_breakpoint (void)
{ {
struct objfile *objfile;
const char *const func_name = "_Unwind_DebugHook"; const char *const func_name = "_Unwind_DebugHook";
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
struct breakpoint *b; struct breakpoint *b;
struct gdbarch *gdbarch; struct gdbarch *gdbarch;

View File

@ -62,7 +62,6 @@ static void
do_module_cleanup (void *arg, int registers_valid) do_module_cleanup (void *arg, int registers_valid)
{ {
struct do_module_cleanup *data = (struct do_module_cleanup *) arg; struct do_module_cleanup *data = (struct do_module_cleanup *) arg;
struct objfile *objfile;
if (data->executedp != NULL) if (data->executedp != NULL)
{ {
@ -83,7 +82,7 @@ do_module_cleanup (void *arg, int registers_valid)
} }
} }
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
if ((objfile->flags & OBJF_USERLOADED) == 0 if ((objfile->flags & OBJF_USERLOADED) == 0
&& (strcmp (objfile_name (objfile), data->objfile_name_string) == 0)) && (strcmp (objfile_name (objfile), data->objfile_name_string) == 0))
{ {

View File

@ -1374,17 +1374,16 @@ add_symbol_overload_list_qualified (const char *func_name,
std::vector<symbol *> *overload_list) std::vector<symbol *> *overload_list)
{ {
struct compunit_symtab *cust; struct compunit_symtab *cust;
struct objfile *objfile;
const struct block *b, *surrounding_static_block = 0; const struct block *b, *surrounding_static_block = 0;
/* Look through the partial symtabs for all symbols which begin by /* Look through the partial symtabs for all symbols which begin by
matching FUNC_NAME. Make sure we read that symbol table in. */ matching FUNC_NAME. Make sure we read that symbol table in. */
ALL_OBJFILES (objfile) for (objfile *objf : all_objfiles (current_program_space))
{ {
if (objfile->sf) if (objf->sf)
objfile->sf->qf->expand_symtabs_for_function (objfile, func_name); objf->sf->qf->expand_symtabs_for_function (objf, func_name);
} }
/* Search upwards from currently selected frame (so that we can /* Search upwards from currently selected frame (so that we can
complete on local vars. */ complete on local vars. */
@ -1397,6 +1396,7 @@ add_symbol_overload_list_qualified (const char *func_name,
/* Go through the symtabs and check the externs and statics for /* Go through the symtabs and check the externs and statics for
symbols which match. */ symbols which match. */
struct objfile *objfile;
ALL_COMPUNITS (objfile, cust) ALL_COMPUNITS (objfile, cust)
{ {
QUIT; QUIT;

View File

@ -1640,7 +1640,6 @@ write_psymtabs_to_index (struct dwarf2_per_objfile *dwarf2_per_objfile,
static void static void
save_gdb_index_command (const char *arg, int from_tty) save_gdb_index_command (const char *arg, int from_tty)
{ {
struct objfile *objfile;
const char dwarf5space[] = "-dwarf-5 "; const char dwarf5space[] = "-dwarf-5 ";
dw_index_kind index_kind = dw_index_kind::GDB_INDEX; dw_index_kind index_kind = dw_index_kind::GDB_INDEX;
@ -1658,35 +1657,35 @@ save_gdb_index_command (const char *arg, int from_tty)
if (!*arg) if (!*arg)
error (_("usage: save gdb-index [-dwarf-5] DIRECTORY")); error (_("usage: save gdb-index [-dwarf-5] DIRECTORY"));
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
struct stat st; struct stat st;
/* If the objfile does not correspond to an actual file, skip it. */ /* If the objfile does not correspond to an actual file, skip it. */
if (stat (objfile_name (objfile), &st) < 0) if (stat (objfile_name (objfile), &st) < 0)
continue; continue;
struct dwarf2_per_objfile *dwarf2_per_objfile struct dwarf2_per_objfile *dwarf2_per_objfile
= get_dwarf2_per_objfile (objfile); = get_dwarf2_per_objfile (objfile);
if (dwarf2_per_objfile != NULL) if (dwarf2_per_objfile != NULL)
{ {
TRY TRY
{ {
const char *basename = lbasename (objfile_name (objfile)); const char *basename = lbasename (objfile_name (objfile));
write_psymtabs_to_index (dwarf2_per_objfile, arg, basename, write_psymtabs_to_index (dwarf2_per_objfile, arg, basename,
index_kind); index_kind);
} }
CATCH (except, RETURN_MASK_ERROR) CATCH (except, RETURN_MASK_ERROR)
{ {
exception_fprintf (gdb_stderr, except, exception_fprintf (gdb_stderr, except,
_("Error while writing index for `%s': "), _("Error while writing index for `%s': "),
objfile_name (objfile)); objfile_name (objfile));
} }
END_CATCH END_CATCH
} }
} }
} }
void void

View File

@ -1702,9 +1702,7 @@ bsearch_fde_cmp (const void *key, const void *element)
static struct dwarf2_fde * static struct dwarf2_fde *
dwarf2_frame_find_fde (CORE_ADDR *pc, CORE_ADDR *out_offset) dwarf2_frame_find_fde (CORE_ADDR *pc, CORE_ADDR *out_offset)
{ {
struct objfile *objfile; for (objfile *objfile : all_objfiles (current_program_space))
ALL_OBJFILES (objfile)
{ {
struct dwarf2_fde_table *fde_table; struct dwarf2_fde_table *fde_table;
struct dwarf2_fde **p_fde; struct dwarf2_fde **p_fde;

View File

@ -366,17 +366,16 @@ gdbscm_get_current_objfile (void)
static SCM static SCM
gdbscm_objfiles (void) gdbscm_objfiles (void)
{ {
struct objfile *objf;
SCM result; SCM result;
result = SCM_EOL; result = SCM_EOL;
ALL_OBJFILES (objf) for (objfile *objf : all_objfiles (current_program_space))
{ {
SCM item = ofscm_scm_from_objfile (objf); SCM item = ofscm_scm_from_objfile (objf);
result = scm_cons (item, result); result = scm_cons (item, result);
} }
return scm_reverse_x (result, SCM_EOL); return scm_reverse_x (result, SCM_EOL);
} }

View File

@ -427,19 +427,18 @@ ppscm_search_pp_list (SCM list, SCM value)
static SCM static SCM
ppscm_find_pretty_printer_from_objfiles (SCM value) ppscm_find_pretty_printer_from_objfiles (SCM value)
{ {
struct objfile *objfile; for (objfile *objfile : all_objfiles (current_program_space))
{
objfile_smob *o_smob = ofscm_objfile_smob_from_objfile (objfile);
SCM pp
= ppscm_search_pp_list (ofscm_objfile_smob_pretty_printers (o_smob),
value);
ALL_OBJFILES (objfile) /* Note: This will return if pp is a <gdb:exception> object,
{ which is what we want. */
objfile_smob *o_smob = ofscm_objfile_smob_from_objfile (objfile); if (gdbscm_is_true (pp))
SCM pp = ppscm_search_pp_list (ofscm_objfile_smob_pretty_printers (o_smob), return pp;
value); }
/* Note: This will return if pp is a <gdb:exception> object,
which is what we want. */
if (gdbscm_is_true (pp))
return pp;
}
return SCM_BOOL_F; return SCM_BOOL_F;
} }

View File

@ -483,7 +483,6 @@ struct unwind_table_entry *
find_unwind_entry (CORE_ADDR pc) find_unwind_entry (CORE_ADDR pc)
{ {
int first, middle, last; int first, middle, last;
struct objfile *objfile;
struct hppa_objfile_private *priv; struct hppa_objfile_private *priv;
if (hppa_debug) if (hppa_debug)
@ -498,61 +497,61 @@ find_unwind_entry (CORE_ADDR pc)
return NULL; return NULL;
} }
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
struct hppa_unwind_info *ui; struct hppa_unwind_info *ui;
ui = NULL; ui = NULL;
priv = ((struct hppa_objfile_private *) priv = ((struct hppa_objfile_private *)
objfile_data (objfile, hppa_objfile_priv_data)); objfile_data (objfile, hppa_objfile_priv_data));
if (priv) if (priv)
ui = ((struct hppa_objfile_private *) priv)->unwind_info; ui = ((struct hppa_objfile_private *) priv)->unwind_info;
if (!ui) if (!ui)
{ {
read_unwind_info (objfile); read_unwind_info (objfile);
priv = ((struct hppa_objfile_private *) priv = ((struct hppa_objfile_private *)
objfile_data (objfile, hppa_objfile_priv_data)); objfile_data (objfile, hppa_objfile_priv_data));
if (priv == NULL) if (priv == NULL)
error (_("Internal error reading unwind information.")); error (_("Internal error reading unwind information."));
ui = ((struct hppa_objfile_private *) priv)->unwind_info; ui = ((struct hppa_objfile_private *) priv)->unwind_info;
} }
/* First, check the cache. */ /* First, check the cache. */
if (ui->cache if (ui->cache
&& pc >= ui->cache->region_start && pc >= ui->cache->region_start
&& pc <= ui->cache->region_end) && pc <= ui->cache->region_end)
{ {
if (hppa_debug) if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, "%s (cached) }\n", fprintf_unfiltered (gdb_stdlog, "%s (cached) }\n",
hex_string ((uintptr_t) ui->cache)); hex_string ((uintptr_t) ui->cache));
return ui->cache; return ui->cache;
} }
/* Not in the cache, do a binary search. */ /* Not in the cache, do a binary search. */
first = 0; first = 0;
last = ui->last; last = ui->last;
while (first <= last) while (first <= last)
{ {
middle = (first + last) / 2; middle = (first + last) / 2;
if (pc >= ui->table[middle].region_start if (pc >= ui->table[middle].region_start
&& pc <= ui->table[middle].region_end) && pc <= ui->table[middle].region_end)
{ {
ui->cache = &ui->table[middle]; ui->cache = &ui->table[middle];
if (hppa_debug) if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, "%s }\n", fprintf_unfiltered (gdb_stdlog, "%s }\n",
hex_string ((uintptr_t) ui->cache)); hex_string ((uintptr_t) ui->cache));
return &ui->table[middle]; return &ui->table[middle];
} }
if (pc < ui->table[middle].region_start) if (pc < ui->table[middle].region_start)
last = middle - 1; last = middle - 1;
else else
first = middle + 1; first = middle + 1;
} }
} /* ALL_OBJFILES() */ }
if (hppa_debug) if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, "NULL (not found) }\n"); fprintf_unfiltered (gdb_stdlog, "NULL (not found) }\n");

View File

@ -986,9 +986,7 @@ jit_unregister_code (struct objfile *objfile)
static struct objfile * static struct objfile *
jit_find_objf_with_entry_addr (CORE_ADDR entry_addr) jit_find_objf_with_entry_addr (CORE_ADDR entry_addr)
{ {
struct objfile *objf; for (objfile *objf : all_objfiles (current_program_space))
ALL_OBJFILES (objf)
{ {
struct jit_objfile_data *objf_data; struct jit_objfile_data *objf_data;

View File

@ -1130,7 +1130,6 @@ iterate_over_all_matching_symtabs
struct program_space *search_pspace, bool include_inline, struct program_space *search_pspace, bool include_inline,
gdb::function_view<symbol_found_callback_ftype> callback) gdb::function_view<symbol_found_callback_ftype> callback)
{ {
struct objfile *objfile;
struct program_space *pspace; struct program_space *pspace;
ALL_PSPACES (pspace) ALL_PSPACES (pspace)
@ -1142,46 +1141,48 @@ iterate_over_all_matching_symtabs
set_current_program_space (pspace); set_current_program_space (pspace);
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
struct compunit_symtab *cu; struct compunit_symtab *cu;
if (objfile->sf) if (objfile->sf)
objfile->sf->qf->expand_symtabs_matching (objfile, objfile->sf->qf->expand_symtabs_matching (objfile,
NULL, NULL,
lookup_name, lookup_name,
NULL, NULL, NULL, NULL,
search_domain); search_domain);
ALL_OBJFILE_COMPUNITS (objfile, cu) ALL_OBJFILE_COMPUNITS (objfile, cu)
{ {
struct symtab *symtab = COMPUNIT_FILETABS (cu); struct symtab *symtab = COMPUNIT_FILETABS (cu);
iterate_over_file_blocks (symtab, lookup_name, name_domain, callback); iterate_over_file_blocks (symtab, lookup_name, name_domain,
callback);
if (include_inline) if (include_inline)
{ {
struct block *block; struct block *block;
int i; int i;
for (i = FIRST_LOCAL_BLOCK; for (i = FIRST_LOCAL_BLOCK;
i < BLOCKVECTOR_NBLOCKS (SYMTAB_BLOCKVECTOR (symtab)); i < BLOCKVECTOR_NBLOCKS (SYMTAB_BLOCKVECTOR (symtab));
i++) i++)
{ {
block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), i); block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), i);
state->language->la_iterate_over_symbols state->language->la_iterate_over_symbols
(block, lookup_name, name_domain, [&] (block_symbol *bsym) (block, lookup_name, name_domain,
{ [&] (block_symbol *bsym)
/* Restrict calls to CALLBACK to symbols {
representing inline symbols only. */ /* Restrict calls to CALLBACK to symbols
if (SYMBOL_INLINED (bsym->symbol)) representing inline symbols only. */
return callback (bsym); if (SYMBOL_INLINED (bsym->symbol))
return true; return callback (bsym);
}); return true;
} });
} }
} }
} }
}
} }
} }
@ -4351,8 +4352,6 @@ search_minsyms_for_name (struct collect_info *info,
ALL_PSPACES (pspace) ALL_PSPACES (pspace)
{ {
struct objfile *objfile;
if (search_pspace != NULL && search_pspace != pspace) if (search_pspace != NULL && search_pspace != pspace)
continue; continue;
if (pspace->executing_startup) if (pspace->executing_startup)
@ -4360,17 +4359,17 @@ search_minsyms_for_name (struct collect_info *info,
set_current_program_space (pspace); set_current_program_space (pspace);
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
iterate_over_minimal_symbols (objfile, name, iterate_over_minimal_symbols (objfile, name,
[&] (struct minimal_symbol *msym) [&] (struct minimal_symbol *msym)
{ {
add_minsym (msym, objfile, nullptr, add_minsym (msym, objfile, nullptr,
info->state->list_mode, info->state->list_mode,
&minsyms); &minsyms);
return false; return false;
}); });
} }
} }
} }
else else

View File

@ -1053,12 +1053,10 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir)
static int static int
try_thread_db_load_from_pdir (const char *subdir) try_thread_db_load_from_pdir (const char *subdir)
{ {
struct objfile *obj;
if (!auto_load_thread_db) if (!auto_load_thread_db)
return 0; return 0;
ALL_OBJFILES (obj) for (objfile *obj : all_objfiles (current_program_space))
if (libpthread_name_p (objfile_name (obj))) if (libpthread_name_p (objfile_name (obj)))
{ {
if (try_thread_db_load_from_pdir_1 (obj, subdir)) if (try_thread_db_load_from_pdir_1 (obj, subdir))
@ -1167,9 +1165,7 @@ thread_db_load_search (void)
static int static int
has_libpthread (void) has_libpthread (void)
{ {
struct objfile *obj; for (objfile *obj : all_objfiles (current_program_space))
ALL_OBJFILES (obj)
if (libpthread_name_p (objfile_name (obj))) if (libpthread_name_p (objfile_name (obj)))
return 1; return 1;

View File

@ -485,7 +485,6 @@ captured_main_1 (struct captured_main_args *context)
int i; int i;
int save_auto_load; int save_auto_load;
struct objfile *objfile;
int ret = 1; int ret = 1;
#ifdef HAVE_USEFUL_SBRK #ifdef HAVE_USEFUL_SBRK
@ -1124,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 We wait until now because it is common to add to the source search
path in local_gdbinit. */ path in local_gdbinit. */
global_auto_load = save_auto_load; global_auto_load = save_auto_load;
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
load_auto_scripts_for_objfile (objfile); load_auto_scripts_for_objfile (objfile);
/* Process '-x' and '-ex' options. */ /* Process '-x' and '-ex' options. */

View File

@ -348,7 +348,6 @@ maintenance_info_sections (const char *arg, int from_tty)
printf_filtered (_("file type %s.\n"), bfd_get_target (exec_bfd)); printf_filtered (_("file type %s.\n"), bfd_get_target (exec_bfd));
if (arg && *arg && match_substring (arg, "ALLOBJ")) if (arg && *arg && match_substring (arg, "ALLOBJ"))
{ {
struct objfile *ofile;
struct obj_section *osect; struct obj_section *osect;
/* Only this function cares about the 'ALLOBJ' argument; /* Only this function cares about the 'ALLOBJ' argument;
@ -358,7 +357,7 @@ maintenance_info_sections (const char *arg, int from_tty)
if (strcmp (arg, "ALLOBJ") == 0) if (strcmp (arg, "ALLOBJ") == 0)
arg = NULL; arg = NULL;
ALL_OBJFILES (ofile) for (objfile *ofile : all_objfiles (current_program_space))
{ {
printf_filtered (_(" Object file: %s\n"), printf_filtered (_(" Object file: %s\n"),
bfd_get_filename (ofile->obfd)); bfd_get_filename (ofile->obfd));

View File

@ -972,8 +972,6 @@ find_methods (char type, const char *theclass, const char *category,
const char *selector, const char *selector,
std::vector<const char *> *symbol_names) std::vector<const char *> *symbol_names)
{ {
struct objfile *objfile = NULL;
const char *symname = NULL; const char *symname = NULL;
char ntype = '\0'; char ntype = '\0';
@ -986,7 +984,7 @@ find_methods (char type, const char *theclass, const char *category,
gdb_assert (symbol_names != NULL); gdb_assert (symbol_names != NULL);
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
unsigned int *objc_csym; unsigned int *objc_csym;
struct minimal_symbol *msymbol = NULL; struct minimal_symbol *msymbol = NULL;

View File

@ -1016,13 +1016,11 @@ objfile_has_symbols (struct objfile *objfile)
int int
have_partial_symbols (void) have_partial_symbols (void)
{ {
struct objfile *ofp; for (objfile *ofp : all_objfiles (current_program_space))
{
ALL_OBJFILES (ofp) if (objfile_has_partial_symbols (ofp))
{ return 1;
if (objfile_has_partial_symbols (ofp)) }
return 1;
}
return 0; return 0;
} }
@ -1033,13 +1031,11 @@ have_partial_symbols (void)
int int
have_full_symbols (void) have_full_symbols (void)
{ {
struct objfile *ofp; for (objfile *ofp : all_objfiles (current_program_space))
{
ALL_OBJFILES (ofp) if (objfile_has_full_symbols (ofp))
{ return 1;
if (objfile_has_full_symbols (ofp)) }
return 1;
}
return 0; return 0;
} }
@ -1072,15 +1068,13 @@ objfile_purge_solibs (void)
int int
have_minimal_symbols (void) have_minimal_symbols (void)
{ {
struct objfile *ofp; for (objfile *ofp : all_objfiles (current_program_space))
{
ALL_OBJFILES (ofp) if (ofp->per_bfd->minimal_symbol_count > 0)
{ {
if (ofp->per_bfd->minimal_symbol_count > 0) return 1;
{ }
return 1; }
}
}
return 0; return 0;
} }
@ -1145,9 +1139,7 @@ qsort_cmp (const void *a, const void *b)
{ {
/* Sort on sequence number of the objfile in the chain. */ /* Sort on sequence number of the objfile in the chain. */
const struct objfile *objfile; for (objfile *objfile : all_objfiles (current_program_space))
ALL_OBJFILES (objfile)
if (objfile == objfile1) if (objfile == objfile1)
return -1; return -1;
else if (objfile == objfile2) else if (objfile == objfile2)
@ -1502,7 +1494,7 @@ shared_objfile_contains_address_p (struct program_space *pspace,
} }
/* The default implementation for the "iterate_over_objfiles_in_search_order" /* The default implementation for the "iterate_over_objfiles_in_search_order"
gdbarch method. It is equivalent to use the ALL_OBJFILES macro, gdbarch method. It is equivalent to use the all_objfiles iterable,
searching the objfiles in the order they are stored internally, searching the objfiles in the order they are stored internally,
ignoring CURRENT_OBJFILE. ignoring CURRENT_OBJFILE.
@ -1516,9 +1508,8 @@ default_iterate_over_objfiles_in_search_order
void *cb_data, struct objfile *current_objfile) void *cb_data, struct objfile *current_objfile)
{ {
int stop = 0; int stop = 0;
struct objfile *objfile;
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
stop = cb (objfile, cb_data); stop = cb (objfile, cb_data);
if (stop) if (stop)

View File

@ -1788,10 +1788,8 @@ ppc_linux_spe_context_lookup (struct objfile *objfile)
static void static void
ppc_linux_spe_context_inferior_created (struct target_ops *t, int from_tty) ppc_linux_spe_context_inferior_created (struct target_ops *t, int from_tty)
{ {
struct objfile *objfile;
ppc_linux_spe_context_lookup (NULL); ppc_linux_spe_context_lookup (NULL);
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
ppc_linux_spe_context_lookup (objfile); ppc_linux_spe_context_lookup (objfile);
} }

View File

@ -244,29 +244,28 @@ find_probes_in_objfile (struct objfile *objfile, const char *provider,
struct bound_probe struct bound_probe
find_probe_by_pc (CORE_ADDR pc) find_probe_by_pc (CORE_ADDR pc)
{ {
struct objfile *objfile;
struct bound_probe result; struct bound_probe result;
result.objfile = NULL; result.objfile = NULL;
result.prob = NULL; result.prob = NULL;
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
if (!objfile->sf || !objfile->sf->sym_probe_fns if (!objfile->sf || !objfile->sf->sym_probe_fns
|| objfile->sect_index_text == -1) || objfile->sect_index_text == -1)
continue; continue;
/* If this proves too inefficient, we can replace with a hash. */ /* If this proves too inefficient, we can replace with a hash. */
const std::vector<probe *> &probes const std::vector<probe *> &probes
= objfile->sf->sym_probe_fns->sym_get_probes (objfile); = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
for (probe *p : probes) for (probe *p : probes)
if (p->get_relocated_address (objfile) == pc) if (p->get_relocated_address (objfile) == pc)
{ {
result.objfile = objfile; result.objfile = objfile;
result.prob = p; result.prob = p;
return result; return result;
} }
} }
return result; return result;
} }
@ -282,7 +281,6 @@ static std::vector<bound_probe>
collect_probes (const std::string &objname, const std::string &provider, collect_probes (const std::string &objname, const std::string &provider,
const std::string &probe_name, const static_probe_ops *spops) const std::string &probe_name, const static_probe_ops *spops)
{ {
struct objfile *objfile;
std::vector<bound_probe> result; std::vector<bound_probe> result;
gdb::optional<compiled_regex> obj_pat, prov_pat, probe_pat; gdb::optional<compiled_regex> obj_pat, prov_pat, probe_pat;
@ -296,7 +294,7 @@ collect_probes (const std::string &objname, const std::string &provider,
obj_pat.emplace (objname.c_str (), REG_NOSUB, obj_pat.emplace (objname.c_str (), REG_NOSUB,
_("Invalid object file regexp")); _("Invalid object file regexp"));
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
if (! objfile->sf || ! objfile->sf->sym_probe_fns) if (! objfile->sf || ! objfile->sf->sym_probe_fns)
continue; continue;

View File

@ -108,12 +108,6 @@ require_partial_symbols (struct objfile *objfile, int verbose)
#undef ALL_OBJFILE_PSYMTABS #undef ALL_OBJFILE_PSYMTABS
/* Traverse all psymtabs in all objfiles. */
#define ALL_PSYMTABS(objfile, p) \
ALL_OBJFILES (objfile) \
ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p)
/* Helper function for psym_map_symtabs_matching_filename that /* Helper function for psym_map_symtabs_matching_filename that
expands the symtabs and calls the iterator. */ expands the symtabs and calls the iterator. */
@ -1874,7 +1868,6 @@ maintenance_print_psymbols (const char *args, int from_tty)
{ {
struct ui_file *outfile = gdb_stdout; struct ui_file *outfile = gdb_stdout;
char *address_arg = NULL, *source_arg = NULL, *objfile_arg = NULL; char *address_arg = NULL, *source_arg = NULL, *objfile_arg = NULL;
struct objfile *objfile;
struct partial_symtab *ps; struct partial_symtab *ps;
int i, outfile_idx, found; int i, outfile_idx, found;
CORE_ADDR pc = 0; CORE_ADDR pc = 0;
@ -1944,7 +1937,7 @@ maintenance_print_psymbols (const char *args, int from_tty)
} }
found = 0; found = 0;
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
int printed_objfile_header = 0; int printed_objfile_header = 0;
int print_for_objfile = 1; int print_for_objfile = 1;
@ -2148,93 +2141,93 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
struct compunit_symtab *cust = NULL; struct compunit_symtab *cust = NULL;
struct partial_symtab *ps; struct partial_symtab *ps;
const struct blockvector *bv; const struct blockvector *bv;
struct objfile *objfile;
struct block *b; struct block *b;
int length; int length;
ALL_PSYMTABS (objfile, ps) for (objfile *objfile : all_objfiles (current_program_space))
{ ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps)
struct gdbarch *gdbarch = get_objfile_arch (objfile);
/* We don't call psymtab_to_symtab here because that may cause symtab
expansion. When debugging a problem it helps if checkers leave
things unchanged. */
cust = ps->compunit_symtab;
/* First do some checks that don't require the associated symtab. */
if (ps->text_high (objfile) < ps->text_low (objfile))
{ {
printf_filtered ("Psymtab "); struct gdbarch *gdbarch = get_objfile_arch (objfile);
puts_filtered (ps->filename);
printf_filtered (" covers bad range ");
fputs_filtered (paddress (gdbarch, ps->text_low (objfile)),
gdb_stdout);
printf_filtered (" - ");
fputs_filtered (paddress (gdbarch, ps->text_high (objfile)),
gdb_stdout);
printf_filtered ("\n");
continue;
}
/* Now do checks requiring the associated symtab. */ /* We don't call psymtab_to_symtab here because that may cause symtab
if (cust == NULL) expansion. When debugging a problem it helps if checkers leave
continue; things unchanged. */
bv = COMPUNIT_BLOCKVECTOR (cust); cust = ps->compunit_symtab;
b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
partial_symbol **psym = &objfile->static_psymbols[ps->statics_offset]; /* First do some checks that don't require the associated symtab. */
length = ps->n_static_syms; if (ps->text_high (objfile) < ps->text_low (objfile))
while (length--)
{
sym = block_lookup_symbol (b, symbol_search_name (*psym),
symbol_name_match_type::SEARCH_NAME,
(*psym)->domain);
if (!sym)
{ {
printf_filtered ("Static symbol `"); printf_filtered ("Psymtab ");
puts_filtered ((*psym)->name);
printf_filtered ("' only found in ");
puts_filtered (ps->filename); puts_filtered (ps->filename);
printf_filtered (" psymtab\n"); printf_filtered (" covers bad range ");
fputs_filtered (paddress (gdbarch, ps->text_low (objfile)),
gdb_stdout);
printf_filtered (" - ");
fputs_filtered (paddress (gdbarch, ps->text_high (objfile)),
gdb_stdout);
printf_filtered ("\n");
continue;
} }
psym++;
} /* Now do checks requiring the associated symtab. */
b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); if (cust == NULL)
psym = &objfile->global_psymbols[ps->globals_offset]; continue;
length = ps->n_global_syms; bv = COMPUNIT_BLOCKVECTOR (cust);
while (length--) b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
{ partial_symbol **psym = &objfile->static_psymbols[ps->statics_offset];
sym = block_lookup_symbol (b, symbol_search_name (*psym), length = ps->n_static_syms;
symbol_name_match_type::SEARCH_NAME, while (length--)
(*psym)->domain);
if (!sym)
{ {
printf_filtered ("Global symbol `"); sym = block_lookup_symbol (b, symbol_search_name (*psym),
puts_filtered ((*psym)->name); symbol_name_match_type::SEARCH_NAME,
printf_filtered ("' only found in "); (*psym)->domain);
puts_filtered (ps->filename); if (!sym)
printf_filtered (" psymtab\n"); {
printf_filtered ("Static symbol `");
puts_filtered ((*psym)->name);
printf_filtered ("' only found in ");
puts_filtered (ps->filename);
printf_filtered (" psymtab\n");
}
psym++;
}
b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
psym = &objfile->global_psymbols[ps->globals_offset];
length = ps->n_global_syms;
while (length--)
{
sym = block_lookup_symbol (b, symbol_search_name (*psym),
symbol_name_match_type::SEARCH_NAME,
(*psym)->domain);
if (!sym)
{
printf_filtered ("Global symbol `");
puts_filtered ((*psym)->name);
printf_filtered ("' only found in ");
puts_filtered (ps->filename);
printf_filtered (" psymtab\n");
}
psym++;
}
if (ps->raw_text_high () != 0
&& (ps->text_low (objfile) < BLOCK_START (b)
|| ps->text_high (objfile) > BLOCK_END (b)))
{
printf_filtered ("Psymtab ");
puts_filtered (ps->filename);
printf_filtered (" covers ");
fputs_filtered (paddress (gdbarch, ps->text_low (objfile)),
gdb_stdout);
printf_filtered (" - ");
fputs_filtered (paddress (gdbarch, ps->text_high (objfile)),
gdb_stdout);
printf_filtered (" but symtab covers only ");
fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout);
printf_filtered (" - ");
fputs_filtered (paddress (gdbarch, BLOCK_END (b)), gdb_stdout);
printf_filtered ("\n");
} }
psym++;
} }
if (ps->raw_text_high () != 0
&& (ps->text_low (objfile) < BLOCK_START (b)
|| ps->text_high (objfile) > BLOCK_END (b)))
{
printf_filtered ("Psymtab ");
puts_filtered (ps->filename);
printf_filtered (" covers ");
fputs_filtered (paddress (gdbarch, ps->text_low (objfile)),
gdb_stdout);
printf_filtered (" - ");
fputs_filtered (paddress (gdbarch, ps->text_high (objfile)),
gdb_stdout);
printf_filtered (" but symtab covers only ");
fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout);
printf_filtered (" - ");
fputs_filtered (paddress (gdbarch, BLOCK_END (b)), gdb_stdout);
printf_filtered ("\n");
}
}
} }
void void

View File

@ -501,9 +501,7 @@ objfpy_build_id_matches (const struct bfd_build_id *build_id,
static struct objfile * static struct objfile *
objfpy_lookup_objfile_by_name (const char *name) objfpy_lookup_objfile_by_name (const char *name)
{ {
struct objfile *objfile; for (objfile *objfile : all_objfiles (current_program_space))
ALL_OBJFILES (objfile)
{ {
const char *filename; const char *filename;
@ -529,9 +527,7 @@ objfpy_lookup_objfile_by_name (const char *name)
static struct objfile * static struct objfile *
objfpy_lookup_objfile_by_build_id (const char *build_id) objfpy_lookup_objfile_by_build_id (const char *build_id)
{ {
struct objfile *objfile; for (objfile *objfile : all_objfiles (current_program_space))
ALL_OBJFILES (objfile)
{ {
const struct bfd_build_id *obfd_build_id; const struct bfd_build_id *obfd_build_id;

View File

@ -93,28 +93,26 @@ search_pp_list (PyObject *list, PyObject *value)
static PyObject * static PyObject *
find_pretty_printer_from_objfiles (PyObject *value) find_pretty_printer_from_objfiles (PyObject *value)
{ {
struct objfile *obj; for (objfile *obj : all_objfiles (current_program_space))
{
gdbpy_ref<> objf = objfile_to_objfile_object (obj);
if (objf == NULL)
{
/* Ignore the error and continue. */
PyErr_Clear ();
continue;
}
ALL_OBJFILES (obj) gdbpy_ref<> pp_list (objfpy_get_printers (objf.get (), NULL));
{ gdbpy_ref<> function (search_pp_list (pp_list.get (), value));
gdbpy_ref<> objf = objfile_to_objfile_object (obj);
if (objf == NULL)
{
/* Ignore the error and continue. */
PyErr_Clear ();
continue;
}
gdbpy_ref<> pp_list (objfpy_get_printers (objf.get (), NULL)); /* If there is an error in any objfile list, abort the search and exit. */
gdbpy_ref<> function (search_pp_list (pp_list.get (), value)); if (function == NULL)
return NULL;
/* If there is an error in any objfile list, abort the search and exit. */ if (function != Py_None)
if (function == NULL) return function.release ();
return NULL; }
if (function != Py_None)
return function.release ();
}
Py_RETURN_NONE; Py_RETURN_NONE;
} }

View File

@ -121,8 +121,6 @@ gdbpy_get_matching_xmethod_workers
struct type *obj_type, const char *method_name, struct type *obj_type, const char *method_name,
std::vector<xmethod_worker_up> *dm_vec) std::vector<xmethod_worker_up> *dm_vec)
{ {
struct objfile *objfile;
gdb_assert (obj_type != NULL && method_name != NULL); gdb_assert (obj_type != NULL && method_name != NULL);
gdbpy_enter enter_py (get_current_arch (), current_language); gdbpy_enter enter_py (get_current_arch (), current_language);
@ -145,7 +143,7 @@ gdbpy_get_matching_xmethod_workers
/* Gather debug method matchers registered with the object files. /* Gather debug method matchers registered with the object files.
This could be done differently by iterating over each objfile's matcher 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. */ list individually, but there's no data yet to show it's needed. */
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile); gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile);

View File

@ -101,9 +101,8 @@ static void
append_ocl_sos (struct so_list **link_ptr) append_ocl_sos (struct so_list **link_ptr)
{ {
CORE_ADDR *ocl_program_addr_base; CORE_ADDR *ocl_program_addr_base;
struct objfile *objfile;
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
ocl_program_addr_base ocl_program_addr_base
= (CORE_ADDR *) objfile_data (objfile, ocl_program_data_key); = (CORE_ADDR *) objfile_data (objfile, ocl_program_data_key);

View File

@ -677,11 +677,15 @@ solib_read_symbols (struct so_list *so, symfile_add_flags flags)
TRY TRY
{ {
/* Have we already loaded this shared object? */ /* Have we already loaded this shared object? */
ALL_OBJFILES (so->objfile) so->objfile = nullptr;
for (objfile *objfile : all_objfiles (current_program_space))
{ {
if (filename_cmp (objfile_name (so->objfile), so->so_name) == 0 if (filename_cmp (objfile_name (objfile), so->so_name) == 0
&& so->objfile->addr_low == so->addr_low) && objfile->addr_low == so->addr_low)
break; {
so->objfile = objfile;
break;
}
} }
if (so->objfile == NULL) if (so->objfile == NULL)
{ {

View File

@ -288,13 +288,13 @@ select_source_symtab (struct symtab *s)
if (current_source_symtab) if (current_source_symtab)
return; return;
ALL_OBJFILES (ofp) for (objfile *objfile : all_objfiles (current_program_space))
{ {
if (ofp->sf) if (objfile->sf)
s = ofp->sf->qf->find_last_source_symtab (ofp); s = objfile->sf->qf->find_last_source_symtab (objfile);
if (s) if (s)
current_source_symtab = s; current_source_symtab = s;
} }
if (current_source_symtab) if (current_source_symtab)
return; return;

View File

@ -2000,12 +2000,11 @@ spu_objfile_from_frame (struct frame_info *frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame); struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
struct objfile *obj;
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
return NULL; return NULL;
ALL_OBJFILES (obj) for (objfile *obj : all_objfiles (current_program_space))
{ {
if (obj->sections != obj->sections_end if (obj->sections != obj->sections_end
&& SPUADDR_SPU (obj_section_addr (obj->sections)) == tdep->id) && SPUADDR_SPU (obj_section_addr (obj->sections)) == tdep->id)

View File

@ -2351,12 +2351,16 @@ remove_symbol_file_command (const char *args, int from_tty)
addr = parse_and_eval_address (argv[1]); addr = parse_and_eval_address (argv[1]);
ALL_OBJFILES (objf) for (objfile *objfile : all_objfiles (current_program_space))
{ {
if ((objf->flags & OBJF_USERLOADED) != 0 if ((objfile->flags & OBJF_USERLOADED) != 0
&& (objf->flags & OBJF_SHARED) != 0 && (objfile->flags & OBJF_SHARED) != 0
&& objf->pspace == pspace && is_addr_in_objfile (addr, objf)) && objfile->pspace == pspace
break; && is_addr_in_objfile (addr, objfile))
{
objf = objfile;
break;
}
} }
} }
else if (argv[0] != NULL) else if (argv[0] != NULL)
@ -2368,13 +2372,16 @@ remove_symbol_file_command (const char *args, int from_tty)
gdb::unique_xmalloc_ptr<char> filename (tilde_expand (argv[0])); gdb::unique_xmalloc_ptr<char> filename (tilde_expand (argv[0]));
ALL_OBJFILES (objf) for (objfile *objfile : all_objfiles (current_program_space))
{ {
if ((objf->flags & OBJF_USERLOADED) != 0 if ((objfile->flags & OBJF_USERLOADED) != 0
&& (objf->flags & OBJF_SHARED) != 0 && (objfile->flags & OBJF_SHARED) != 0
&& objf->pspace == pspace && objfile->pspace == pspace
&& filename_cmp (filename.get (), objfile_name (objf)) == 0) && filename_cmp (filename.get (), objfile_name (objfile)) == 0)
break; {
objf = objfile;
break;
}
} }
} }
@ -3791,16 +3798,14 @@ expand_symtabs_matching
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify, gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
enum search_domain kind) enum search_domain kind)
{ {
struct objfile *objfile; for (objfile *objfile : all_objfiles (current_program_space))
{
ALL_OBJFILES (objfile) if (objfile->sf)
{ objfile->sf->qf->expand_symtabs_matching (objfile, file_matcher,
if (objfile->sf) lookup_name,
objfile->sf->qf->expand_symtabs_matching (objfile, file_matcher, symbol_matcher,
lookup_name, expansion_notify, kind);
symbol_matcher, }
expansion_notify, kind);
}
} }
/* Wrapper around the quick_symbol_functions map_symbol_filenames "method". /* Wrapper around the quick_symbol_functions map_symbol_filenames "method".
@ -3811,14 +3816,12 @@ void
map_symbol_filenames (symbol_filename_ftype *fun, void *data, map_symbol_filenames (symbol_filename_ftype *fun, void *data,
int need_fullname) int need_fullname)
{ {
struct objfile *objfile; for (objfile *objfile : all_objfiles (current_program_space))
{
ALL_OBJFILES (objfile) if (objfile->sf)
{ objfile->sf->qf->map_symbol_filenames (objfile, fun, data,
if (objfile->sf) need_fullname);
objfile->sf->qf->map_symbol_filenames (objfile, fun, data, }
need_fullname);
}
} }
#if GDB_SELF_TEST #if GDB_SELF_TEST

View File

@ -470,12 +470,11 @@ maintenance_print_symbols (const char *args, int from_tty)
} }
else else
{ {
struct objfile *objfile;
struct compunit_symtab *cu; struct compunit_symtab *cu;
struct symtab *s; struct symtab *s;
int found = 0; int found = 0;
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
int print_for_objfile = 1; int print_for_objfile = 1;
@ -690,7 +689,6 @@ maintenance_print_msymbols (const char *args, int from_tty)
{ {
struct ui_file *outfile = gdb_stdout; struct ui_file *outfile = gdb_stdout;
char *objfile_arg = NULL; char *objfile_arg = NULL;
struct objfile *objfile;
int i, outfile_idx; int i, outfile_idx;
dont_repeat (); dont_repeat ();
@ -734,13 +732,13 @@ maintenance_print_msymbols (const char *args, int from_tty)
outfile = &arg_outfile; outfile = &arg_outfile;
} }
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
QUIT; QUIT;
if (objfile_arg == NULL if (objfile_arg == NULL
|| compare_filenames_for_search (objfile_name (objfile), objfile_arg)) || compare_filenames_for_search (objfile_name (objfile), objfile_arg))
dump_msymbols (objfile, outfile); dump_msymbols (objfile, outfile);
} }
} }
static void static void

View File

@ -464,7 +464,6 @@ void
iterate_over_symtabs (const char *name, iterate_over_symtabs (const char *name,
gdb::function_view<bool (symtab *)> callback) gdb::function_view<bool (symtab *)> callback)
{ {
struct objfile *objfile;
gdb::unique_xmalloc_ptr<char> real_path; gdb::unique_xmalloc_ptr<char> real_path;
/* Here we are interested in canonicalizing an absolute path, not /* Here we are interested in canonicalizing an absolute path, not
@ -475,7 +474,7 @@ iterate_over_symtabs (const char *name,
gdb_assert (IS_ABSOLUTE_PATH (real_path.get ())); gdb_assert (IS_ABSOLUTE_PATH (real_path.get ()));
} }
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
if (iterate_over_some_symtabs (name, real_path.get (), if (iterate_over_some_symtabs (name, real_path.get (),
objfile->compunit_symtabs, NULL, objfile->compunit_symtabs, NULL,
@ -486,7 +485,7 @@ iterate_over_symtabs (const char *name,
/* Same search rules as above apply here, but now we look thru the /* Same search rules as above apply here, but now we look thru the
psymtabs. */ psymtabs. */
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
if (objfile->sf if (objfile->sf
&& objfile->sf->qf->map_symtabs_matching_filename (objfile, && objfile->sf->qf->map_symtabs_matching_filename (objfile,
@ -1013,9 +1012,12 @@ matching_obj_sections (struct obj_section *obj_first,
/* Otherwise check that they are in corresponding objfiles. */ /* Otherwise check that they are in corresponding objfiles. */
ALL_OBJFILES (obj) for (objfile *objfile : all_objfiles (current_program_space))
if (obj->obfd == first->owner) if (objfile->obfd == first->owner)
break; {
obj = objfile;
break;
}
gdb_assert (obj != NULL); gdb_assert (obj != NULL);
if (obj->separate_debug_objfile != NULL if (obj->separate_debug_objfile != NULL
@ -1033,7 +1035,6 @@ matching_obj_sections (struct obj_section *obj_first,
void void
expand_symtab_containing_pc (CORE_ADDR pc, struct obj_section *section) expand_symtab_containing_pc (CORE_ADDR pc, struct obj_section *section)
{ {
struct objfile *objfile;
struct bound_minimal_symbol msymbol; struct bound_minimal_symbol msymbol;
/* If we know that this is not a text address, return failure. This is /* If we know that this is not a text address, return failure. This is
@ -1048,16 +1049,16 @@ expand_symtab_containing_pc (CORE_ADDR pc, struct obj_section *section)
|| MSYMBOL_TYPE (msymbol.minsym) == mst_file_bss)) || MSYMBOL_TYPE (msymbol.minsym) == mst_file_bss))
return; return;
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
struct compunit_symtab *cust = NULL; struct compunit_symtab *cust = NULL;
if (objfile->sf) if (objfile->sf)
cust = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol, cust = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol,
pc, section, 0); pc, section, 0);
if (cust) if (cust)
return; return;
} }
} }
/* Hash function for the symbol cache. */ /* Hash function for the symbol cache. */
@ -2576,7 +2577,6 @@ struct block_symbol
lookup_static_symbol (const char *name, const domain_enum domain) lookup_static_symbol (const char *name, const domain_enum domain)
{ {
struct symbol_cache *cache = get_symbol_cache (current_program_space); struct symbol_cache *cache = get_symbol_cache (current_program_space);
struct objfile *objfile;
struct block_symbol result; struct block_symbol result;
struct block_symbol_cache *bsc; struct block_symbol_cache *bsc;
struct symbol_cache_slot *slot; struct symbol_cache_slot *slot;
@ -2592,7 +2592,7 @@ lookup_static_symbol (const char *name, const domain_enum domain)
return result; return result;
} }
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
result = lookup_symbol_in_objfile (objfile, STATIC_BLOCK, name, domain); result = lookup_symbol_in_objfile (objfile, STATIC_BLOCK, name, domain);
if (result.symbol != NULL) if (result.symbol != NULL)
@ -2793,7 +2793,6 @@ basic_lookup_transparent_type_1 (struct objfile *objfile, int block_index,
struct type * struct type *
basic_lookup_transparent_type (const char *name) basic_lookup_transparent_type (const char *name)
{ {
struct objfile *objfile;
struct type *t; struct type *t;
/* Now search all the global symbols. Do the symtab's first, then /* Now search all the global symbols. Do the symtab's first, then
@ -2801,19 +2800,19 @@ basic_lookup_transparent_type (const char *name)
of the desired name as a global, then do psymtab-to-symtab of the desired name as a global, then do psymtab-to-symtab
conversion on the fly and return the found symbol. */ conversion on the fly and return the found symbol. */
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
t = basic_lookup_transparent_type_1 (objfile, GLOBAL_BLOCK, name); t = basic_lookup_transparent_type_1 (objfile, GLOBAL_BLOCK, name);
if (t) if (t)
return t; return t;
} }
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
t = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK, name); t = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK, name);
if (t) if (t)
return t; return t;
} }
/* Now search the static file-level symbols. /* Now search the static file-level symbols.
Not strictly correct, but more useful than an error. Not strictly correct, but more useful than an error.
@ -2822,19 +2821,19 @@ basic_lookup_transparent_type (const char *name)
of the desired name as a file-level static, then do psymtab-to-symtab of the desired name as a file-level static, then do psymtab-to-symtab
conversion on the fly and return the found symbol. */ conversion on the fly and return the found symbol. */
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
t = basic_lookup_transparent_type_1 (objfile, STATIC_BLOCK, name); t = basic_lookup_transparent_type_1 (objfile, STATIC_BLOCK, name);
if (t) if (t)
return t; return t;
} }
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
t = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK, name); t = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK, name);
if (t) if (t)
return t; return t;
} }
return (struct type *) 0; return (struct type *) 0;
} }
@ -2877,7 +2876,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
{ {
struct compunit_symtab *cust; struct compunit_symtab *cust;
struct compunit_symtab *best_cust = NULL; struct compunit_symtab *best_cust = NULL;
struct objfile *objfile; struct objfile *obj_file;
CORE_ADDR distance = 0; CORE_ADDR distance = 0;
struct bound_minimal_symbol msymbol; struct bound_minimal_symbol msymbol;
@ -2910,7 +2909,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
It also happens for objfiles that have their functions reordered. It also happens for objfiles that have their functions reordered.
For these, the symtab we are looking for is not necessarily read in. */ For these, the symtab we are looking for is not necessarily read in. */
ALL_COMPUNITS (objfile, cust) ALL_COMPUNITS (obj_file, cust)
{ {
struct block *b; struct block *b;
const struct blockvector *bv; const struct blockvector *bv;
@ -2929,15 +2928,15 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
/* In order to better support objfiles that contain both /* In order to better support objfiles that contain both
stabs and coff debugging info, we continue on if a psymtab stabs and coff debugging info, we continue on if a psymtab
can't be found. */ can't be found. */
if ((objfile->flags & OBJF_REORDERED) && objfile->sf) if ((obj_file->flags & OBJF_REORDERED) && obj_file->sf)
{ {
struct compunit_symtab *result; struct compunit_symtab *result;
result result
= objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, = obj_file->sf->qf->find_pc_sect_compunit_symtab (obj_file,
msymbol, msymbol,
pc, section, pc, section,
0); 0);
if (result != NULL) if (result != NULL)
return result; return result;
} }
@ -2948,8 +2947,8 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
ALL_BLOCK_SYMBOLS (b, iter, sym) ALL_BLOCK_SYMBOLS (b, iter, sym)
{ {
fixup_symbol_section (sym, objfile); fixup_symbol_section (sym, obj_file);
if (matching_obj_sections (SYMBOL_OBJ_SECTION (objfile, sym), if (matching_obj_sections (SYMBOL_OBJ_SECTION (obj_file, sym),
section)) section))
break; break;
} }
@ -2967,19 +2966,19 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
/* Not found in symtabs, search the "quick" symtabs (e.g. psymtabs). */ /* Not found in symtabs, search the "quick" symtabs (e.g. psymtabs). */
ALL_OBJFILES (objfile) for (objfile *objf : all_objfiles (current_program_space))
{ {
struct compunit_symtab *result; struct compunit_symtab *result;
if (!objfile->sf) if (!objf->sf)
continue; continue;
result = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, result = objf->sf->qf->find_pc_sect_compunit_symtab (objf,
msymbol, msymbol,
pc, section, pc, section,
1); 1);
if (result != NULL) if (result != NULL)
return result; return result;
} }
return NULL; return NULL;
} }
@ -2999,35 +2998,33 @@ find_pc_compunit_symtab (CORE_ADDR pc)
struct symbol * struct symbol *
find_symbol_at_address (CORE_ADDR address) find_symbol_at_address (CORE_ADDR address)
{ {
struct objfile *objfile; for (objfile *objfile : all_objfiles (current_program_space))
{
if (objfile->sf == NULL
|| objfile->sf->qf->find_compunit_symtab_by_address == NULL)
continue;
ALL_OBJFILES (objfile) struct compunit_symtab *symtab
{ = objfile->sf->qf->find_compunit_symtab_by_address (objfile, address);
if (objfile->sf == NULL if (symtab != NULL)
|| objfile->sf->qf->find_compunit_symtab_by_address == NULL) {
continue; const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (symtab);
struct compunit_symtab *symtab for (int i = GLOBAL_BLOCK; i <= STATIC_BLOCK; ++i)
= objfile->sf->qf->find_compunit_symtab_by_address (objfile, address);
if (symtab != NULL)
{
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (symtab);
for (int i = GLOBAL_BLOCK; i <= STATIC_BLOCK; ++i)
{
struct block *b = BLOCKVECTOR_BLOCK (bv, i);
struct block_iterator iter;
struct symbol *sym;
ALL_BLOCK_SYMBOLS (b, iter, sym)
{ {
if (SYMBOL_CLASS (sym) == LOC_STATIC struct block *b = BLOCKVECTOR_BLOCK (bv, i);
&& SYMBOL_VALUE_ADDRESS (sym) == address) struct block_iterator iter;
return sym; struct symbol *sym;
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
if (SYMBOL_CLASS (sym) == LOC_STATIC
&& SYMBOL_VALUE_ADDRESS (sym) == address)
return sym;
}
} }
} }
} }
}
return NULL; return NULL;
} }
@ -3352,7 +3349,6 @@ find_line_symtab (struct symtab *symtab, int line,
BEST_INDEX and BEST_LINETABLE identify the item for it. */ BEST_INDEX and BEST_LINETABLE identify the item for it. */
int best; int best;
struct objfile *objfile;
struct compunit_symtab *cu; struct compunit_symtab *cu;
struct symtab *s; struct symtab *s;
@ -3361,13 +3357,14 @@ find_line_symtab (struct symtab *symtab, int line,
else else
best = 0; best = 0;
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
if (objfile->sf) if (objfile->sf)
objfile->sf->qf->expand_symtabs_with_fullname (objfile, objfile->sf->qf->expand_symtabs_with_fullname
symtab_to_fullname (symtab)); (objfile, symtab_to_fullname (symtab));
} }
struct objfile *objfile;
ALL_FILETABS (objfile, cu, s) ALL_FILETABS (objfile, cu, s)
{ {
struct linetable *l; struct linetable *l;
@ -5691,7 +5688,6 @@ static void
find_main_name (void) find_main_name (void)
{ {
const char *new_main_name; const char *new_main_name;
struct objfile *objfile;
/* First check the objfiles to see whether a debuginfo reader has /* First check the objfiles to see whether a debuginfo reader has
picked up the appropriate main name. Historically the main name picked up the appropriate main name. Historically the main name
@ -5699,15 +5695,15 @@ find_main_name (void)
relies on the order of objfile creation -- which still isn't relies on the order of objfile creation -- which still isn't
guaranteed to get the correct answer, but is just probably more guaranteed to get the correct answer, but is just probably more
accurate. */ accurate. */
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
if (objfile->per_bfd->name_of_main != NULL) if (objfile->per_bfd->name_of_main != NULL)
{ {
set_main_name (objfile->per_bfd->name_of_main, set_main_name (objfile->per_bfd->name_of_main,
objfile->per_bfd->language_of_main); objfile->per_bfd->language_of_main);
return; return;
} }
} }
/* Try to see if the main procedure is in Ada. */ /* Try to see if the main procedure is in Ada. */
/* FIXME: brobecker/2005-03-07: Another way of doing this would /* FIXME: brobecker/2005-03-07: Another way of doing this would

View File

@ -415,7 +415,6 @@ windows_iterate_over_objfiles_in_search_order
void *cb_data, struct objfile *current_objfile) void *cb_data, struct objfile *current_objfile)
{ {
int stop; int stop;
struct objfile *objfile;
if (current_objfile) if (current_objfile)
{ {
@ -424,7 +423,7 @@ windows_iterate_over_objfiles_in_search_order
return; return;
} }
ALL_OBJFILES (objfile) for (objfile *objfile : all_objfiles (current_program_space))
{ {
if (objfile != current_objfile) if (objfile != current_objfile)
{ {