aboutsummaryrefslogtreecommitdiff
path: root/gdb/hppa-tdep.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-11-23 12:20:05 -0700
committerTom Tromey <tom@tromey.com>2019-01-09 18:28:14 -0700
commitaed57c537116ae91f553ac835b3f96d1f87b3bb0 (patch)
treec2699609b04041be0ab313616b8a20e771a7a47e /gdb/hppa-tdep.c
parent99d89cdea6c296bdd94ce532350d139d3900ff78 (diff)
downloadgdb-aed57c537116ae91f553ac835b3f96d1f87b3bb0.zip
gdb-aed57c537116ae91f553ac835b3f96d1f87b3bb0.tar.gz
gdb-aed57c537116ae91f553ac835b3f96d1f87b3bb0.tar.bz2
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
Diffstat (limited to 'gdb/hppa-tdep.c')
-rw-r--r--gdb/hppa-tdep.c99
1 files changed, 49 insertions, 50 deletions
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 7adc71c..d825bce 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -483,7 +483,6 @@ struct unwind_table_entry *
find_unwind_entry (CORE_ADDR pc)
{
int first, middle, last;
- struct objfile *objfile;
struct hppa_objfile_private *priv;
if (hppa_debug)
@@ -498,61 +497,61 @@ find_unwind_entry (CORE_ADDR pc)
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");