diff options
author | Tom Tromey <tom@tromey.com> | 2023-04-10 10:43:32 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-05-07 12:44:17 -0600 |
commit | 5250cbc85cbbf13221ed508c1b89f1ee0a6ac1ec (patch) | |
tree | 36230d533899f8a7459c129e1691944d82209b99 /gdb/symfile.c | |
parent | 9ed8433a04bf0430e2da3cd44c18667859782410 (diff) | |
download | binutils-5250cbc85cbbf13221ed508c1b89f1ee0a6ac1ec.zip binutils-5250cbc85cbbf13221ed508c1b89f1ee0a6ac1ec.tar.gz binutils-5250cbc85cbbf13221ed508c1b89f1ee0a6ac1ec.tar.bz2 |
Remove ALL_OBJFILE_OSECTIONS
This replaces ALL_OBJFILE_OSECTIONS with an iterator so that for-each
can be used.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index d1ab3cc..9623967 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -832,7 +832,6 @@ init_entry_point_info (struct objfile *objfile) if (ei->entry_point_p) { - struct obj_section *osect; CORE_ADDR entry_point = ei->entry_point; int found; @@ -847,7 +846,7 @@ init_entry_point_info (struct objfile *objfile) = gdbarch_addr_bits_remove (objfile->arch (), entry_point); found = 0; - ALL_OBJFILE_OSECTIONS (objfile, osect) + for (obj_section *osect : objfile->sections ()) { struct bfd_section *sect = osect->the_bfd_section; @@ -2999,10 +2998,8 @@ section_is_overlay (struct obj_section *section) static void overlay_invalidate_all (void) { - struct obj_section *sect; - for (objfile *objfile : current_program_space->objfiles ()) - ALL_OBJFILE_OSECTIONS (objfile, sect) + for (obj_section *sect : objfile->sections ()) if (section_is_overlay (sect)) sect->ovly_mapped = -1; } @@ -3174,12 +3171,12 @@ symbol_overlayed_address (CORE_ADDR address, struct obj_section *section) struct obj_section * find_pc_overlay (CORE_ADDR pc) { - struct obj_section *osect, *best_match = NULL; + struct obj_section *best_match = NULL; if (overlay_debugging) { for (objfile *objfile : current_program_space->objfiles ()) - ALL_OBJFILE_OSECTIONS (objfile, osect) + for (obj_section *osect : objfile->sections ()) if (section_is_overlay (osect)) { if (pc_in_mapped_range (pc, osect)) @@ -3203,12 +3200,10 @@ find_pc_overlay (CORE_ADDR pc) struct obj_section * find_pc_mapped_section (CORE_ADDR pc) { - struct obj_section *osect; - if (overlay_debugging) { for (objfile *objfile : current_program_space->objfiles ()) - ALL_OBJFILE_OSECTIONS (objfile, osect) + for (obj_section *osect : objfile->sections ()) if (pc_in_mapped_range (pc, osect) && section_is_mapped (osect)) return osect; } @@ -3223,12 +3218,11 @@ static void list_overlays_command (const char *args, int from_tty) { int nmapped = 0; - struct obj_section *osect; if (overlay_debugging) { for (objfile *objfile : current_program_space->objfiles ()) - ALL_OBJFILE_OSECTIONS (objfile, osect) + for (obj_section *osect : objfile->sections ()) if (section_is_mapped (osect)) { struct gdbarch *gdbarch = objfile->arch (); @@ -3264,8 +3258,6 @@ list_overlays_command (const char *args, int from_tty) static void map_overlay_command (const char *args, int from_tty) { - struct obj_section *sec, *sec2; - if (!overlay_debugging) error (_("Overlay debugging not enabled. Use " "either the 'overlay auto' or\n" @@ -3276,7 +3268,7 @@ map_overlay_command (const char *args, int from_tty) /* First, find a section matching the user supplied argument. */ for (objfile *obj_file : current_program_space->objfiles ()) - ALL_OBJFILE_OSECTIONS (obj_file, sec) + for (obj_section *sec : obj_file->sections ()) if (!strcmp (bfd_section_name (sec->the_bfd_section), args)) { /* Now, check to see if the section is an overlay. */ @@ -3289,7 +3281,7 @@ map_overlay_command (const char *args, int from_tty) /* Next, make a pass and unmap any sections that are overlapped by this new section: */ for (objfile *objfile2 : current_program_space->objfiles ()) - ALL_OBJFILE_OSECTIONS (objfile2, sec2) + for (obj_section *sec2 : objfile2->sections ()) if (sec2->ovly_mapped && sec != sec2 && sections_overlap (sec, sec2)) { @@ -3310,8 +3302,6 @@ map_overlay_command (const char *args, int from_tty) static void unmap_overlay_command (const char *args, int from_tty) { - struct obj_section *sec = NULL; - if (!overlay_debugging) error (_("Overlay debugging not enabled. " "Use either the 'overlay auto' or\n" @@ -3322,7 +3312,7 @@ unmap_overlay_command (const char *args, int from_tty) /* First, find a section matching the user supplied argument. */ for (objfile *objfile : current_program_space->objfiles ()) - ALL_OBJFILE_OSECTIONS (objfile, sec) + for (obj_section *sec : objfile->sections ()) if (!strcmp (bfd_section_name (sec->the_bfd_section), args)) { if (!sec->ovly_mapped) @@ -3581,17 +3571,17 @@ simple_overlay_update (struct obj_section *osect) /* Now may as well update all sections, even if only one was requested. */ for (objfile *objfile : current_program_space->objfiles ()) - ALL_OBJFILE_OSECTIONS (objfile, osect) - if (section_is_overlay (osect)) + for (obj_section *sect : objfile->sections ()) + if (section_is_overlay (sect)) { int i; - asection *bsect = osect->the_bfd_section; + asection *bsect = sect->the_bfd_section; for (i = 0; i < cache_novlys; i++) if (cache_ovly_table[i][VMA] == bfd_section_vma (bsect) && cache_ovly_table[i][LMA] == bfd_section_lma (bsect)) { /* obj_section matches i'th entry in ovly_table. */ - osect->ovly_mapped = cache_ovly_table[i][MAPPED]; + sect->ovly_mapped = cache_ovly_table[i][MAPPED]; break; /* finished with inner for loop: break out. */ } } |