mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 01:07:52 +00:00
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:
215
gdb/breakpoint.c
215
gdb/breakpoint.c
@@ -3203,10 +3203,9 @@ free_breakpoint_objfile_data (struct objfile *obj, void *data)
|
||||
static void
|
||||
create_overlay_event_breakpoint (void)
|
||||
{
|
||||
struct objfile *objfile;
|
||||
const char *const func_name = "_ovly_debug_event";
|
||||
|
||||
ALL_OBJFILES (objfile)
|
||||
for (objfile *objfile : all_objfiles (current_program_space))
|
||||
{
|
||||
struct breakpoint *b;
|
||||
struct breakpoint_objfile_data *bp_objfile_data;
|
||||
@@ -3262,95 +3261,93 @@ create_longjmp_master_breakpoint (void)
|
||||
|
||||
ALL_PSPACES (pspace)
|
||||
{
|
||||
struct objfile *objfile;
|
||||
|
||||
set_current_program_space (pspace);
|
||||
|
||||
ALL_OBJFILES (objfile)
|
||||
{
|
||||
int i;
|
||||
struct gdbarch *gdbarch;
|
||||
struct breakpoint_objfile_data *bp_objfile_data;
|
||||
for (objfile *objfile : all_objfiles (current_program_space))
|
||||
{
|
||||
int i;
|
||||
struct gdbarch *gdbarch;
|
||||
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)
|
||||
{
|
||||
std::vector<probe *> ret
|
||||
= find_probes_in_objfile (objfile, "libc", "longjmp");
|
||||
if (!bp_objfile_data->longjmp_searched)
|
||||
{
|
||||
std::vector<probe *> ret
|
||||
= find_probes_in_objfile (objfile, "libc", "longjmp");
|
||||
|
||||
if (!ret.empty ())
|
||||
{
|
||||
/* We are only interested in checking one element. */
|
||||
probe *p = ret[0];
|
||||
if (!ret.empty ())
|
||||
{
|
||||
/* We are only interested in checking one element. */
|
||||
probe *p = ret[0];
|
||||
|
||||
if (!p->can_evaluate_arguments ())
|
||||
{
|
||||
/* We cannot use the probe interface here, because it does
|
||||
not know how to evaluate arguments. */
|
||||
ret.clear ();
|
||||
}
|
||||
}
|
||||
bp_objfile_data->longjmp_probes = ret;
|
||||
bp_objfile_data->longjmp_searched = 1;
|
||||
}
|
||||
if (!p->can_evaluate_arguments ())
|
||||
{
|
||||
/* We cannot use the probe interface here, because it does
|
||||
not know how to evaluate arguments. */
|
||||
ret.clear ();
|
||||
}
|
||||
}
|
||||
bp_objfile_data->longjmp_probes = ret;
|
||||
bp_objfile_data->longjmp_searched = 1;
|
||||
}
|
||||
|
||||
if (!bp_objfile_data->longjmp_probes.empty ())
|
||||
{
|
||||
for (probe *p : bp_objfile_data->longjmp_probes)
|
||||
{
|
||||
struct breakpoint *b;
|
||||
if (!bp_objfile_data->longjmp_probes.empty ())
|
||||
{
|
||||
for (probe *p : bp_objfile_data->longjmp_probes)
|
||||
{
|
||||
struct breakpoint *b;
|
||||
|
||||
b = create_internal_breakpoint (gdbarch,
|
||||
p->get_relocated_address (objfile),
|
||||
bp_longjmp_master,
|
||||
&internal_breakpoint_ops);
|
||||
b->location = new_probe_location ("-probe-stap libc:longjmp");
|
||||
b->enable_state = bp_disabled;
|
||||
}
|
||||
b = create_internal_breakpoint (gdbarch,
|
||||
p->get_relocated_address (objfile),
|
||||
bp_longjmp_master,
|
||||
&internal_breakpoint_ops);
|
||||
b->location = new_probe_location ("-probe-stap libc:longjmp");
|
||||
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;
|
||||
}
|
||||
|
||||
func_name = longjmp_names[i];
|
||||
if (bp_objfile_data->longjmp_msym[i].minsym == NULL)
|
||||
{
|
||||
struct bound_minimal_symbol m;
|
||||
if (!gdbarch_get_longjmp_target_p (gdbarch))
|
||||
continue;
|
||||
|
||||
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;
|
||||
}
|
||||
for (i = 0; i < NUM_LONGJMP_NAMES; i++)
|
||||
{
|
||||
struct breakpoint *b;
|
||||
const char *func_name;
|
||||
CORE_ADDR addr;
|
||||
struct explicit_location explicit_loc;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (msym_not_found_p (bp_objfile_data->longjmp_msym[i].minsym))
|
||||
continue;
|
||||
|
||||
func_name = longjmp_names[i];
|
||||
if (bp_objfile_data->longjmp_msym[i].minsym == NULL)
|
||||
{
|
||||
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)
|
||||
{
|
||||
struct objfile *objfile;
|
||||
CORE_ADDR addr;
|
||||
|
||||
set_current_program_space (pspace);
|
||||
|
||||
ALL_OBJFILES (objfile)
|
||||
{
|
||||
struct breakpoint *b;
|
||||
struct breakpoint_objfile_data *bp_objfile_data;
|
||||
struct explicit_location explicit_loc;
|
||||
for (objfile *objfile : all_objfiles (current_program_space))
|
||||
{
|
||||
struct breakpoint *b;
|
||||
struct breakpoint_objfile_data *bp_objfile_data;
|
||||
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))
|
||||
continue;
|
||||
if (msym_not_found_p (bp_objfile_data->terminate_msym.minsym))
|
||||
continue;
|
||||
|
||||
if (bp_objfile_data->terminate_msym.minsym == NULL)
|
||||
{
|
||||
struct bound_minimal_symbol m;
|
||||
if (bp_objfile_data->terminate_msym.minsym == NULL)
|
||||
{
|
||||
struct bound_minimal_symbol m;
|
||||
|
||||
m = lookup_minimal_symbol (func_name, NULL, objfile);
|
||||
if (m.minsym == NULL || (MSYMBOL_TYPE (m.minsym) != mst_text
|
||||
&& MSYMBOL_TYPE (m.minsym) != mst_file_text))
|
||||
{
|
||||
/* Prevent future lookups in this objfile. */
|
||||
bp_objfile_data->terminate_msym.minsym = &msym_not_found;
|
||||
continue;
|
||||
}
|
||||
bp_objfile_data->terminate_msym = m;
|
||||
}
|
||||
m = lookup_minimal_symbol (func_name, NULL, objfile);
|
||||
if (m.minsym == NULL || (MSYMBOL_TYPE (m.minsym) != mst_text
|
||||
&& MSYMBOL_TYPE (m.minsym) != mst_file_text))
|
||||
{
|
||||
/* Prevent future lookups in this objfile. */
|
||||
bp_objfile_data->terminate_msym.minsym = &msym_not_found;
|
||||
continue;
|
||||
}
|
||||
bp_objfile_data->terminate_msym = m;
|
||||
}
|
||||
|
||||
addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->terminate_msym);
|
||||
b = create_internal_breakpoint (get_objfile_arch (objfile), addr,
|
||||
bp_std_terminate_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;
|
||||
}
|
||||
addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->terminate_msym);
|
||||
b = create_internal_breakpoint (get_objfile_arch (objfile), addr,
|
||||
bp_std_terminate_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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3413,10 +3409,9 @@ create_std_terminate_master_breakpoint (void)
|
||||
static void
|
||||
create_exception_master_breakpoint (void)
|
||||
{
|
||||
struct objfile *objfile;
|
||||
const char *const func_name = "_Unwind_DebugHook";
|
||||
|
||||
ALL_OBJFILES (objfile)
|
||||
for (objfile *objfile : all_objfiles (current_program_space))
|
||||
{
|
||||
struct breakpoint *b;
|
||||
struct gdbarch *gdbarch;
|
||||
|
||||
Reference in New Issue
Block a user