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>
+
* probe.c (parse_probes_in_pspace): Use all_objfiles.
* guile/scm-progspace.c (gdbscm_progspace_objfiles): Use
all_objfiles.
const lookup_name_info &lookup_name,
domain_enum domain, int global)
{
- struct objfile *objfile;
struct compunit_symtab *cu;
struct match_data data;
bool is_wild_match = lookup_name.ada ().wild_match_p ();
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
data.objfile = objfile;
const char *name = ada_lookup_name (lookup_name);
std::string name1 = std::string ("<_ada_") + name + '>';
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
data.objfile = objfile;
objfile->sf->qf->map_matching_symbols (objfile, name1.c_str (),
struct symbol *f;
struct bound_minimal_symbol msymbol;
struct compunit_symtab *compunit_symtab = NULL;
- struct objfile *objfile;
CORE_ADDR mapped_pc;
/* To ensure that the symbol returned belongs to the correct setion
goto return_cached_value;
msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section);
- ALL_OBJFILES (objfile)
- {
- if (objfile->sf)
- {
- compunit_symtab
- = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol,
- mapped_pc, section,
- 0);
- }
- if (compunit_symtab != NULL)
- break;
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ if (objfile->sf)
+ {
+ compunit_symtab
+ = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol,
+ mapped_pc,
+ section,
+ 0);
+ }
+ if (compunit_symtab != NULL)
+ break;
+ }
if (compunit_symtab != NULL)
{
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;
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;
- }
-
- 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;
+ 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;
+ 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;
+ 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;
- }
+ 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;
- }
- }
+ 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;
+ }
+ }
}
}
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;
+ }
}
}
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;
do_module_cleanup (void *arg, int registers_valid)
{
struct do_module_cleanup *data = (struct do_module_cleanup *) arg;
- struct objfile *objfile;
if (data->executedp != NULL)
{
}
}
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
if ((objfile->flags & OBJF_USERLOADED) == 0
&& (strcmp (objfile_name (objfile), data->objfile_name_string) == 0))
{
std::vector<symbol *> *overload_list)
{
struct compunit_symtab *cust;
- struct objfile *objfile;
const struct block *b, *surrounding_static_block = 0;
/* Look through the partial symtabs for all symbols which begin by
matching FUNC_NAME. Make sure we read that symbol table in. */
- ALL_OBJFILES (objfile)
- {
- if (objfile->sf)
- objfile->sf->qf->expand_symtabs_for_function (objfile, func_name);
- }
+ for (objfile *objf : all_objfiles (current_program_space))
+ {
+ if (objf->sf)
+ objf->sf->qf->expand_symtabs_for_function (objf, func_name);
+ }
/* Search upwards from currently selected frame (so that we can
complete on local vars. */
/* Go through the symtabs and check the externs and statics for
symbols which match. */
+ struct objfile *objfile;
ALL_COMPUNITS (objfile, cust)
{
QUIT;
static void
save_gdb_index_command (const char *arg, int from_tty)
{
- struct objfile *objfile;
const char dwarf5space[] = "-dwarf-5 ";
dw_index_kind index_kind = dw_index_kind::GDB_INDEX;
if (!*arg)
error (_("usage: save gdb-index [-dwarf-5] DIRECTORY"));
- ALL_OBJFILES (objfile)
- {
- struct stat st;
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ struct stat st;
- /* If the objfile does not correspond to an actual file, skip it. */
- if (stat (objfile_name (objfile), &st) < 0)
- continue;
+ /* If the objfile does not correspond to an actual file, skip it. */
+ if (stat (objfile_name (objfile), &st) < 0)
+ continue;
- struct dwarf2_per_objfile *dwarf2_per_objfile
- = get_dwarf2_per_objfile (objfile);
+ struct dwarf2_per_objfile *dwarf2_per_objfile
+ = get_dwarf2_per_objfile (objfile);
- if (dwarf2_per_objfile != NULL)
- {
- TRY
- {
- const char *basename = lbasename (objfile_name (objfile));
- write_psymtabs_to_index (dwarf2_per_objfile, arg, basename,
- index_kind);
- }
- CATCH (except, RETURN_MASK_ERROR)
- {
- exception_fprintf (gdb_stderr, except,
- _("Error while writing index for `%s': "),
- objfile_name (objfile));
- }
- END_CATCH
- }
+ if (dwarf2_per_objfile != NULL)
+ {
+ TRY
+ {
+ const char *basename = lbasename (objfile_name (objfile));
+ write_psymtabs_to_index (dwarf2_per_objfile, arg, basename,
+ index_kind);
+ }
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ exception_fprintf (gdb_stderr, except,
+ _("Error while writing index for `%s': "),
+ objfile_name (objfile));
+ }
+ END_CATCH
+ }
- }
+ }
}
void
static struct dwarf2_fde *
dwarf2_frame_find_fde (CORE_ADDR *pc, CORE_ADDR *out_offset)
{
- struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
struct dwarf2_fde_table *fde_table;
struct dwarf2_fde **p_fde;
static SCM
gdbscm_objfiles (void)
{
- struct objfile *objf;
SCM result;
result = SCM_EOL;
- ALL_OBJFILES (objf)
- {
- SCM item = ofscm_scm_from_objfile (objf);
+ for (objfile *objf : all_objfiles (current_program_space))
+ {
+ SCM item = ofscm_scm_from_objfile (objf);
- result = scm_cons (item, result);
- }
+ result = scm_cons (item, result);
+ }
return scm_reverse_x (result, SCM_EOL);
}
static SCM
ppscm_find_pretty_printer_from_objfiles (SCM value)
{
- struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
- {
- objfile_smob *o_smob = ofscm_objfile_smob_from_objfile (objfile);
- SCM pp = ppscm_search_pp_list (ofscm_objfile_smob_pretty_printers (o_smob),
- value);
-
- /* Note: This will return if pp is a <gdb:exception> object,
- which is what we want. */
- if (gdbscm_is_true (pp))
- return pp;
- }
+ 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);
+
+ /* 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;
}
find_unwind_entry (CORE_ADDR pc)
{
int first, middle, last;
- struct objfile *objfile;
struct hppa_objfile_private *priv;
if (hppa_debug)
return NULL;
}
- ALL_OBJFILES (objfile)
- {
- struct hppa_unwind_info *ui;
- ui = NULL;
- priv = ((struct hppa_objfile_private *)
- objfile_data (objfile, hppa_objfile_priv_data));
- if (priv)
- ui = ((struct hppa_objfile_private *) priv)->unwind_info;
-
- if (!ui)
- {
- read_unwind_info (objfile);
- priv = ((struct hppa_objfile_private *)
- objfile_data (objfile, hppa_objfile_priv_data));
- if (priv == NULL)
- error (_("Internal error reading unwind information."));
- ui = ((struct hppa_objfile_private *) priv)->unwind_info;
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ struct hppa_unwind_info *ui;
+ ui = NULL;
+ priv = ((struct hppa_objfile_private *)
+ objfile_data (objfile, hppa_objfile_priv_data));
+ if (priv)
+ ui = ((struct hppa_objfile_private *) priv)->unwind_info;
+
+ if (!ui)
+ {
+ read_unwind_info (objfile);
+ priv = ((struct hppa_objfile_private *)
+ objfile_data (objfile, hppa_objfile_priv_data));
+ if (priv == NULL)
+ error (_("Internal error reading unwind information."));
+ ui = ((struct hppa_objfile_private *) priv)->unwind_info;
+ }
- /* First, check the cache. */
+ /* First, check the cache. */
- if (ui->cache
- && pc >= ui->cache->region_start
- && pc <= ui->cache->region_end)
- {
- if (hppa_debug)
- fprintf_unfiltered (gdb_stdlog, "%s (cached) }\n",
- hex_string ((uintptr_t) ui->cache));
- return ui->cache;
- }
+ if (ui->cache
+ && pc >= ui->cache->region_start
+ && pc <= ui->cache->region_end)
+ {
+ if (hppa_debug)
+ fprintf_unfiltered (gdb_stdlog, "%s (cached) }\n",
+ hex_string ((uintptr_t) ui->cache));
+ return ui->cache;
+ }
- /* Not in the cache, do a binary search. */
+ /* Not in the cache, do a binary search. */
- first = 0;
- last = ui->last;
+ first = 0;
+ last = ui->last;
- while (first <= last)
- {
- middle = (first + last) / 2;
- if (pc >= ui->table[middle].region_start
- && pc <= ui->table[middle].region_end)
- {
- ui->cache = &ui->table[middle];
- if (hppa_debug)
- fprintf_unfiltered (gdb_stdlog, "%s }\n",
- hex_string ((uintptr_t) ui->cache));
- return &ui->table[middle];
- }
+ while (first <= last)
+ {
+ middle = (first + last) / 2;
+ if (pc >= ui->table[middle].region_start
+ && pc <= ui->table[middle].region_end)
+ {
+ ui->cache = &ui->table[middle];
+ if (hppa_debug)
+ fprintf_unfiltered (gdb_stdlog, "%s }\n",
+ hex_string ((uintptr_t) ui->cache));
+ return &ui->table[middle];
+ }
- if (pc < ui->table[middle].region_start)
- last = middle - 1;
- else
- first = middle + 1;
- }
- } /* ALL_OBJFILES() */
+ if (pc < ui->table[middle].region_start)
+ last = middle - 1;
+ else
+ first = middle + 1;
+ }
+ }
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, "NULL (not found) }\n");
static struct objfile *
jit_find_objf_with_entry_addr (CORE_ADDR entry_addr)
{
- struct objfile *objf;
-
- ALL_OBJFILES (objf)
+ for (objfile *objf : all_objfiles (current_program_space))
{
struct jit_objfile_data *objf_data;
struct program_space *search_pspace, bool include_inline,
gdb::function_view<symbol_found_callback_ftype> callback)
{
- struct objfile *objfile;
struct program_space *pspace;
ALL_PSPACES (pspace)
set_current_program_space (pspace);
- ALL_OBJFILES (objfile)
- {
- struct compunit_symtab *cu;
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ struct compunit_symtab *cu;
- if (objfile->sf)
- objfile->sf->qf->expand_symtabs_matching (objfile,
- NULL,
- lookup_name,
- NULL, NULL,
- search_domain);
+ if (objfile->sf)
+ objfile->sf->qf->expand_symtabs_matching (objfile,
+ NULL,
+ lookup_name,
+ NULL, NULL,
+ search_domain);
- ALL_OBJFILE_COMPUNITS (objfile, cu)
- {
- struct symtab *symtab = COMPUNIT_FILETABS (cu);
+ ALL_OBJFILE_COMPUNITS (objfile, 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)
- {
- struct block *block;
- int i;
+ if (include_inline)
+ {
+ struct block *block;
+ int i;
- for (i = FIRST_LOCAL_BLOCK;
- i < BLOCKVECTOR_NBLOCKS (SYMTAB_BLOCKVECTOR (symtab));
- i++)
- {
- block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), i);
- state->language->la_iterate_over_symbols
- (block, lookup_name, name_domain, [&] (block_symbol *bsym)
- {
- /* Restrict calls to CALLBACK to symbols
- representing inline symbols only. */
- if (SYMBOL_INLINED (bsym->symbol))
- return callback (bsym);
- return true;
- });
- }
- }
- }
- }
+ for (i = FIRST_LOCAL_BLOCK;
+ i < BLOCKVECTOR_NBLOCKS (SYMTAB_BLOCKVECTOR (symtab));
+ i++)
+ {
+ block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), i);
+ state->language->la_iterate_over_symbols
+ (block, lookup_name, name_domain,
+ [&] (block_symbol *bsym)
+ {
+ /* Restrict calls to CALLBACK to symbols
+ representing inline symbols only. */
+ if (SYMBOL_INLINED (bsym->symbol))
+ return callback (bsym);
+ return true;
+ });
+ }
+ }
+ }
+ }
}
}
ALL_PSPACES (pspace)
{
- struct objfile *objfile;
-
if (search_pspace != NULL && search_pspace != pspace)
continue;
if (pspace->executing_startup)
set_current_program_space (pspace);
- ALL_OBJFILES (objfile)
- {
- iterate_over_minimal_symbols (objfile, name,
- [&] (struct minimal_symbol *msym)
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ iterate_over_minimal_symbols (objfile, name,
+ [&] (struct minimal_symbol *msym)
{
add_minsym (msym, objfile, nullptr,
info->state->list_mode,
&minsyms);
return false;
});
- }
+ }
}
}
else
static int
try_thread_db_load_from_pdir (const char *subdir)
{
- struct objfile *obj;
-
if (!auto_load_thread_db)
return 0;
- ALL_OBJFILES (obj)
+ for (objfile *obj : all_objfiles (current_program_space))
if (libpthread_name_p (objfile_name (obj)))
{
if (try_thread_db_load_from_pdir_1 (obj, subdir))
static int
has_libpthread (void)
{
- struct objfile *obj;
-
- ALL_OBJFILES (obj)
+ for (objfile *obj : all_objfiles (current_program_space))
if (libpthread_name_p (objfile_name (obj)))
return 1;
int i;
int save_auto_load;
- struct objfile *objfile;
int ret = 1;
#ifdef HAVE_USEFUL_SBRK
We wait until now because it is common to add to the source search
path in local_gdbinit. */
global_auto_load = save_auto_load;
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
load_auto_scripts_for_objfile (objfile);
/* Process '-x' and '-ex' options. */
printf_filtered (_("file type %s.\n"), bfd_get_target (exec_bfd));
if (arg && *arg && match_substring (arg, "ALLOBJ"))
{
- struct objfile *ofile;
struct obj_section *osect;
/* Only this function cares about the 'ALLOBJ' argument;
if (strcmp (arg, "ALLOBJ") == 0)
arg = NULL;
- ALL_OBJFILES (ofile)
+ for (objfile *ofile : all_objfiles (current_program_space))
{
printf_filtered (_(" Object file: %s\n"),
bfd_get_filename (ofile->obfd));
const char *selector,
std::vector<const char *> *symbol_names)
{
- struct objfile *objfile = NULL;
-
const char *symname = NULL;
char ntype = '\0';
gdb_assert (symbol_names != NULL);
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
unsigned int *objc_csym;
struct minimal_symbol *msymbol = NULL;
int
have_partial_symbols (void)
{
- struct objfile *ofp;
-
- ALL_OBJFILES (ofp)
- {
- if (objfile_has_partial_symbols (ofp))
- return 1;
- }
+ for (objfile *ofp : all_objfiles (current_program_space))
+ {
+ if (objfile_has_partial_symbols (ofp))
+ return 1;
+ }
return 0;
}
int
have_full_symbols (void)
{
- struct objfile *ofp;
-
- ALL_OBJFILES (ofp)
- {
- if (objfile_has_full_symbols (ofp))
- return 1;
- }
+ for (objfile *ofp : all_objfiles (current_program_space))
+ {
+ if (objfile_has_full_symbols (ofp))
+ return 1;
+ }
return 0;
}
int
have_minimal_symbols (void)
{
- struct objfile *ofp;
-
- ALL_OBJFILES (ofp)
- {
- if (ofp->per_bfd->minimal_symbol_count > 0)
- {
- return 1;
- }
- }
+ for (objfile *ofp : all_objfiles (current_program_space))
+ {
+ if (ofp->per_bfd->minimal_symbol_count > 0)
+ {
+ return 1;
+ }
+ }
return 0;
}
{
/* Sort on sequence number of the objfile in the chain. */
- const struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
if (objfile == objfile1)
return -1;
else if (objfile == objfile2)
}
/* 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,
ignoring CURRENT_OBJFILE.
void *cb_data, struct objfile *current_objfile)
{
int stop = 0;
- struct objfile *objfile;
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
stop = cb (objfile, cb_data);
if (stop)
static void
ppc_linux_spe_context_inferior_created (struct target_ops *t, int from_tty)
{
- struct objfile *objfile;
-
ppc_linux_spe_context_lookup (NULL);
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
ppc_linux_spe_context_lookup (objfile);
}
struct bound_probe
find_probe_by_pc (CORE_ADDR pc)
{
- struct objfile *objfile;
struct bound_probe result;
result.objfile = NULL;
result.prob = NULL;
- ALL_OBJFILES (objfile)
- {
- if (!objfile->sf || !objfile->sf->sym_probe_fns
- || objfile->sect_index_text == -1)
- continue;
-
- /* If this proves too inefficient, we can replace with a hash. */
- const std::vector<probe *> &probes
- = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
- for (probe *p : probes)
- if (p->get_relocated_address (objfile) == pc)
- {
- result.objfile = objfile;
- result.prob = p;
- return result;
- }
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ if (!objfile->sf || !objfile->sf->sym_probe_fns
+ || objfile->sect_index_text == -1)
+ continue;
+
+ /* If this proves too inefficient, we can replace with a hash. */
+ const std::vector<probe *> &probes
+ = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+ for (probe *p : probes)
+ if (p->get_relocated_address (objfile) == pc)
+ {
+ result.objfile = objfile;
+ result.prob = p;
+ return result;
+ }
+ }
return result;
}
collect_probes (const std::string &objname, const std::string &provider,
const std::string &probe_name, const static_probe_ops *spops)
{
- struct objfile *objfile;
std::vector<bound_probe> result;
gdb::optional<compiled_regex> obj_pat, prov_pat, probe_pat;
obj_pat.emplace (objname.c_str (), REG_NOSUB,
_("Invalid object file regexp"));
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
if (! objfile->sf || ! objfile->sf->sym_probe_fns)
continue;
#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
expands the symtabs and calls the iterator. */
{
struct ui_file *outfile = gdb_stdout;
char *address_arg = NULL, *source_arg = NULL, *objfile_arg = NULL;
- struct objfile *objfile;
struct partial_symtab *ps;
int i, outfile_idx, found;
CORE_ADDR pc = 0;
}
found = 0;
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
int printed_objfile_header = 0;
int print_for_objfile = 1;
struct compunit_symtab *cust = NULL;
struct partial_symtab *ps;
const struct blockvector *bv;
- struct objfile *objfile;
struct block *b;
int length;
- ALL_PSYMTABS (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))
+ for (objfile *objfile : all_objfiles (current_program_space))
+ ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps)
{
- printf_filtered ("Psymtab ");
- 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;
- }
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
- /* Now do checks requiring the associated symtab. */
- if (cust == NULL)
- continue;
- bv = COMPUNIT_BLOCKVECTOR (cust);
- b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
- partial_symbol **psym = &objfile->static_psymbols[ps->statics_offset];
- length = ps->n_static_syms;
- while (length--)
- {
- sym = block_lookup_symbol (b, symbol_search_name (*psym),
- symbol_name_match_type::SEARCH_NAME,
- (*psym)->domain);
- if (!sym)
+ /* 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 ("Static symbol `");
- puts_filtered ((*psym)->name);
- printf_filtered ("' only found in ");
+ printf_filtered ("Psymtab ");
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++;
- }
- 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)
+
+ /* Now do checks requiring the associated symtab. */
+ if (cust == NULL)
+ continue;
+ bv = COMPUNIT_BLOCKVECTOR (cust);
+ b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+ partial_symbol **psym = &objfile->static_psymbols[ps->statics_offset];
+ length = ps->n_static_syms;
+ 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 `");
+ 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--)
{
- printf_filtered ("Global symbol `");
- puts_filtered ((*psym)->name);
- printf_filtered ("' only found in ");
+ 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 (" psymtab\n");
+ 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
static struct objfile *
objfpy_lookup_objfile_by_name (const char *name)
{
- struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
const char *filename;
static struct objfile *
objfpy_lookup_objfile_by_build_id (const char *build_id)
{
- struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
const struct bfd_build_id *obfd_build_id;
static PyObject *
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<> 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));
- gdbpy_ref<> function (search_pp_list (pp_list.get (), value));
-
- /* If there is an error in any objfile list, abort the search and exit. */
- if (function == NULL)
- return NULL;
+ gdbpy_ref<> pp_list (objfpy_get_printers (objf.get (), NULL));
+ gdbpy_ref<> function (search_pp_list (pp_list.get (), value));
- if (function != Py_None)
- return function.release ();
- }
+ /* If there is an error in any objfile list, abort the search and exit. */
+ if (function == NULL)
+ return NULL;
+
+ if (function != Py_None)
+ return function.release ();
+ }
Py_RETURN_NONE;
}
struct type *obj_type, const char *method_name,
std::vector<xmethod_worker_up> *dm_vec)
{
- struct objfile *objfile;
-
gdb_assert (obj_type != NULL && method_name != NULL);
gdbpy_enter enter_py (get_current_arch (), current_language);
/* Gather debug method matchers registered with the object files.
This could be done differently by iterating over each objfile's matcher
list individually, but there's no data yet to show it's needed. */
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile);
append_ocl_sos (struct so_list **link_ptr)
{
CORE_ADDR *ocl_program_addr_base;
- struct objfile *objfile;
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
ocl_program_addr_base
= (CORE_ADDR *) objfile_data (objfile, ocl_program_data_key);
TRY
{
/* 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
- && so->objfile->addr_low == so->addr_low)
- break;
+ if (filename_cmp (objfile_name (objfile), so->so_name) == 0
+ && objfile->addr_low == so->addr_low)
+ {
+ so->objfile = objfile;
+ break;
+ }
}
if (so->objfile == NULL)
{
if (current_source_symtab)
return;
- ALL_OBJFILES (ofp)
- {
- if (ofp->sf)
- s = ofp->sf->qf->find_last_source_symtab (ofp);
- if (s)
- current_source_symtab = s;
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ if (objfile->sf)
+ s = objfile->sf->qf->find_last_source_symtab (objfile);
+ if (s)
+ current_source_symtab = s;
+ }
if (current_source_symtab)
return;
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- struct objfile *obj;
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
return NULL;
- ALL_OBJFILES (obj)
+ for (objfile *obj : all_objfiles (current_program_space))
{
if (obj->sections != obj->sections_end
&& SPUADDR_SPU (obj_section_addr (obj->sections)) == tdep->id)
addr = parse_and_eval_address (argv[1]);
- ALL_OBJFILES (objf)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
- if ((objf->flags & OBJF_USERLOADED) != 0
- && (objf->flags & OBJF_SHARED) != 0
- && objf->pspace == pspace && is_addr_in_objfile (addr, objf))
- break;
+ if ((objfile->flags & OBJF_USERLOADED) != 0
+ && (objfile->flags & OBJF_SHARED) != 0
+ && objfile->pspace == pspace
+ && is_addr_in_objfile (addr, objfile))
+ {
+ objf = objfile;
+ break;
+ }
}
}
else if (argv[0] != NULL)
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
- && (objf->flags & OBJF_SHARED) != 0
- && objf->pspace == pspace
- && filename_cmp (filename.get (), objfile_name (objf)) == 0)
- break;
+ if ((objfile->flags & OBJF_USERLOADED) != 0
+ && (objfile->flags & OBJF_SHARED) != 0
+ && objfile->pspace == pspace
+ && filename_cmp (filename.get (), objfile_name (objfile)) == 0)
+ {
+ objf = objfile;
+ break;
+ }
}
}
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
enum search_domain kind)
{
- struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
- {
- if (objfile->sf)
- objfile->sf->qf->expand_symtabs_matching (objfile, file_matcher,
- lookup_name,
- symbol_matcher,
- expansion_notify, kind);
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ if (objfile->sf)
+ objfile->sf->qf->expand_symtabs_matching (objfile, file_matcher,
+ lookup_name,
+ symbol_matcher,
+ expansion_notify, kind);
+ }
}
/* Wrapper around the quick_symbol_functions map_symbol_filenames "method".
map_symbol_filenames (symbol_filename_ftype *fun, void *data,
int need_fullname)
{
- struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
- {
- if (objfile->sf)
- objfile->sf->qf->map_symbol_filenames (objfile, fun, data,
- need_fullname);
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ if (objfile->sf)
+ objfile->sf->qf->map_symbol_filenames (objfile, fun, data,
+ need_fullname);
+ }
}
#if GDB_SELF_TEST
}
else
{
- struct objfile *objfile;
struct compunit_symtab *cu;
struct symtab *s;
int found = 0;
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
int print_for_objfile = 1;
{
struct ui_file *outfile = gdb_stdout;
char *objfile_arg = NULL;
- struct objfile *objfile;
int i, outfile_idx;
dont_repeat ();
outfile = &arg_outfile;
}
- ALL_OBJFILES (objfile)
- {
- QUIT;
- if (objfile_arg == NULL
- || compare_filenames_for_search (objfile_name (objfile), objfile_arg))
- dump_msymbols (objfile, outfile);
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ QUIT;
+ if (objfile_arg == NULL
+ || compare_filenames_for_search (objfile_name (objfile), objfile_arg))
+ dump_msymbols (objfile, outfile);
+ }
}
static void
iterate_over_symtabs (const char *name,
gdb::function_view<bool (symtab *)> callback)
{
- struct objfile *objfile;
gdb::unique_xmalloc_ptr<char> real_path;
/* Here we are interested in canonicalizing an absolute path, not
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 (),
objfile->compunit_symtabs, NULL,
/* Same search rules as above apply here, but now we look thru the
psymtabs. */
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
if (objfile->sf
&& objfile->sf->qf->map_symtabs_matching_filename (objfile,
/* Otherwise check that they are in corresponding objfiles. */
- ALL_OBJFILES (obj)
- if (obj->obfd == first->owner)
- break;
+ for (objfile *objfile : all_objfiles (current_program_space))
+ if (objfile->obfd == first->owner)
+ {
+ obj = objfile;
+ break;
+ }
gdb_assert (obj != NULL);
if (obj->separate_debug_objfile != NULL
void
expand_symtab_containing_pc (CORE_ADDR pc, struct obj_section *section)
{
- struct objfile *objfile;
struct bound_minimal_symbol msymbol;
/* If we know that this is not a text address, return failure. This is
|| MSYMBOL_TYPE (msymbol.minsym) == mst_file_bss))
return;
- ALL_OBJFILES (objfile)
- {
- struct compunit_symtab *cust = NULL;
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ struct compunit_symtab *cust = NULL;
- if (objfile->sf)
- cust = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol,
- pc, section, 0);
- if (cust)
- return;
- }
+ if (objfile->sf)
+ cust = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol,
+ pc, section, 0);
+ if (cust)
+ return;
+ }
}
\f
/* Hash function for the symbol cache. */
lookup_static_symbol (const char *name, const domain_enum domain)
{
struct symbol_cache *cache = get_symbol_cache (current_program_space);
- struct objfile *objfile;
struct block_symbol result;
struct block_symbol_cache *bsc;
struct symbol_cache_slot *slot;
return result;
}
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
result = lookup_symbol_in_objfile (objfile, STATIC_BLOCK, name, domain);
if (result.symbol != NULL)
struct type *
basic_lookup_transparent_type (const char *name)
{
- struct objfile *objfile;
struct type *t;
/* Now search all the global symbols. Do the symtab's first, then
of the desired name as a global, then do psymtab-to-symtab
conversion on the fly and return the found symbol. */
- ALL_OBJFILES (objfile)
- {
- t = basic_lookup_transparent_type_1 (objfile, GLOBAL_BLOCK, name);
- if (t)
- return t;
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ t = basic_lookup_transparent_type_1 (objfile, GLOBAL_BLOCK, name);
+ if (t)
+ return t;
+ }
- ALL_OBJFILES (objfile)
- {
- t = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK, name);
- if (t)
- return t;
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ t = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK, name);
+ if (t)
+ return t;
+ }
/* Now search the static file-level symbols.
Not strictly correct, but more useful than an error.
of the desired name as a file-level static, then do psymtab-to-symtab
conversion on the fly and return the found symbol. */
- ALL_OBJFILES (objfile)
- {
- t = basic_lookup_transparent_type_1 (objfile, STATIC_BLOCK, name);
- if (t)
- return t;
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ t = basic_lookup_transparent_type_1 (objfile, STATIC_BLOCK, name);
+ if (t)
+ return t;
+ }
- ALL_OBJFILES (objfile)
- {
- t = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK, name);
- if (t)
- return t;
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ t = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK, name);
+ if (t)
+ return t;
+ }
return (struct type *) 0;
}
{
struct compunit_symtab *cust;
struct compunit_symtab *best_cust = NULL;
- struct objfile *objfile;
+ struct objfile *obj_file;
CORE_ADDR distance = 0;
struct bound_minimal_symbol msymbol;
It also happens for objfiles that have their functions reordered.
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;
const struct blockvector *bv;
/* In order to better support objfiles that contain both
stabs and coff debugging info, we continue on if a psymtab
can't be found. */
- if ((objfile->flags & OBJF_REORDERED) && objfile->sf)
+ if ((obj_file->flags & OBJF_REORDERED) && obj_file->sf)
{
struct compunit_symtab *result;
result
- = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile,
- msymbol,
- pc, section,
- 0);
+ = obj_file->sf->qf->find_pc_sect_compunit_symtab (obj_file,
+ msymbol,
+ pc, section,
+ 0);
if (result != NULL)
return result;
}
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
- fixup_symbol_section (sym, objfile);
- if (matching_obj_sections (SYMBOL_OBJ_SECTION (objfile, sym),
+ fixup_symbol_section (sym, obj_file);
+ if (matching_obj_sections (SYMBOL_OBJ_SECTION (obj_file, sym),
section))
break;
}
/* Not found in symtabs, search the "quick" symtabs (e.g. psymtabs). */
- ALL_OBJFILES (objfile)
- {
- struct compunit_symtab *result;
-
- if (!objfile->sf)
- continue;
- result = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile,
- msymbol,
- pc, section,
- 1);
- if (result != NULL)
- return result;
- }
+ for (objfile *objf : all_objfiles (current_program_space))
+ {
+ struct compunit_symtab *result;
+
+ if (!objf->sf)
+ continue;
+ result = objf->sf->qf->find_pc_sect_compunit_symtab (objf,
+ msymbol,
+ pc, section,
+ 1);
+ if (result != NULL)
+ return result;
+ }
return NULL;
}
struct symbol *
find_symbol_at_address (CORE_ADDR address)
{
- struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
- {
- if (objfile->sf == NULL
- || objfile->sf->qf->find_compunit_symtab_by_address == NULL)
- continue;
-
- struct compunit_symtab *symtab
- = objfile->sf->qf->find_compunit_symtab_by_address (objfile, address);
- if (symtab != NULL)
- {
- const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (symtab);
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ if (objfile->sf == NULL
+ || objfile->sf->qf->find_compunit_symtab_by_address == NULL)
+ continue;
- for (int i = GLOBAL_BLOCK; i <= STATIC_BLOCK; ++i)
- {
- struct block *b = BLOCKVECTOR_BLOCK (bv, i);
- struct block_iterator iter;
- struct symbol *sym;
+ struct compunit_symtab *symtab
+ = objfile->sf->qf->find_compunit_symtab_by_address (objfile, address);
+ if (symtab != NULL)
+ {
+ const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (symtab);
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (int i = GLOBAL_BLOCK; i <= STATIC_BLOCK; ++i)
{
- if (SYMBOL_CLASS (sym) == LOC_STATIC
- && SYMBOL_VALUE_ADDRESS (sym) == address)
- return sym;
+ 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
+ && SYMBOL_VALUE_ADDRESS (sym) == address)
+ return sym;
+ }
}
- }
- }
- }
+ }
+ }
return NULL;
}
BEST_INDEX and BEST_LINETABLE identify the item for it. */
int best;
- struct objfile *objfile;
struct compunit_symtab *cu;
struct symtab *s;
else
best = 0;
- ALL_OBJFILES (objfile)
- {
- if (objfile->sf)
- objfile->sf->qf->expand_symtabs_with_fullname (objfile,
- symtab_to_fullname (symtab));
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ if (objfile->sf)
+ objfile->sf->qf->expand_symtabs_with_fullname
+ (objfile, symtab_to_fullname (symtab));
+ }
+ struct objfile *objfile;
ALL_FILETABS (objfile, cu, s)
{
struct linetable *l;
find_main_name (void)
{
const char *new_main_name;
- struct objfile *objfile;
/* First check the objfiles to see whether a debuginfo reader has
picked up the appropriate main name. Historically the main name
relies on the order of objfile creation -- which still isn't
guaranteed to get the correct answer, but is just probably more
accurate. */
- ALL_OBJFILES (objfile)
- {
- if (objfile->per_bfd->name_of_main != NULL)
- {
- set_main_name (objfile->per_bfd->name_of_main,
- objfile->per_bfd->language_of_main);
- return;
- }
- }
+ for (objfile *objfile : all_objfiles (current_program_space))
+ {
+ if (objfile->per_bfd->name_of_main != NULL)
+ {
+ set_main_name (objfile->per_bfd->name_of_main,
+ objfile->per_bfd->language_of_main);
+ return;
+ }
+ }
/* Try to see if the main procedure is in Ada. */
/* FIXME: brobecker/2005-03-07: Another way of doing this would
void *cb_data, struct objfile *current_objfile)
{
int stop;
- struct objfile *objfile;
if (current_objfile)
{
return;
}
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
if (objfile != current_objfile)
{