aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-09-19 11:54:49 -0600
committerTom Tromey <tom@tromey.com>2020-09-19 11:54:51 -0600
commitcb814f2e3062ae3c82bba3baca6450c5e3317e58 (patch)
treecc4638726cc154a8237e36967afbbec06a003e9e /gdb/objfiles.c
parent3cabfd268b2d2301a8bfcfa124c162a1d45cfc68 (diff)
downloadfsf-binutils-gdb-cb814f2e3062ae3c82bba3baca6450c5e3317e58.zip
fsf-binutils-gdb-cb814f2e3062ae3c82bba3baca6450c5e3317e58.tar.gz
fsf-binutils-gdb-cb814f2e3062ae3c82bba3baca6450c5e3317e58.tar.bz2
Use gdb_bfd_sections in build_objfile_section_table
This changes build_objfile_section_table to avoid bfd_map_over_sections, in favor of iteration. gdb/ChangeLog 2020-09-19 Tom Tromey <tom@tromey.com> * objfiles.c (add_to_objfile_sections): Rename from add_to_objfile_sections_full. (add_to_objfile_sections): Remove. (build_objfile_section_table): Use foreach.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 3aa7973..471a5c4 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -257,13 +257,13 @@ objfile_lookup_static_link (struct objfile *objfile,
-/* Called via bfd_map_over_sections to build up the section table that
- the objfile references. The objfile contains pointers to the start
- of the table (objfile->sections) and to the first location after
- the end of the table (objfile->sections_end). */
+/* Build up the section table that the objfile references. The
+ objfile contains pointers to the start of the table
+ (objfile->sections) and to the first location after the end of the
+ table (objfile->sections_end). */
static void
-add_to_objfile_sections_full (struct bfd *abfd, struct bfd_section *asect,
+add_to_objfile_sections (struct bfd *abfd, struct bfd_section *asect,
struct objfile *objfile, int force)
{
struct obj_section *section;
@@ -283,13 +283,6 @@ add_to_objfile_sections_full (struct bfd *abfd, struct bfd_section *asect,
section->ovly_mapped = 0;
}
-static void
-add_to_objfile_sections (struct bfd *abfd, struct bfd_section *asect,
- void *objfilep)
-{
- add_to_objfile_sections_full (abfd, asect, (struct objfile *) objfilep, 0);
-}
-
/* Builds a section table for OBJFILE.
Note that the OFFSET and OVLY_MAPPED in each table entry are
@@ -304,14 +297,14 @@ build_objfile_section_table (struct objfile *objfile)
count,
struct obj_section);
objfile->sections_end = (objfile->sections + count);
- bfd_map_over_sections (objfile->obfd,
- add_to_objfile_sections, (void *) objfile);
+ for (asection *sect : gdb_bfd_sections (objfile->obfd))
+ add_to_objfile_sections (objfile->obfd, sect, objfile, 0);
/* See gdb_bfd_section_index. */
- add_to_objfile_sections_full (objfile->obfd, bfd_com_section_ptr, objfile, 1);
- add_to_objfile_sections_full (objfile->obfd, bfd_und_section_ptr, objfile, 1);
- add_to_objfile_sections_full (objfile->obfd, bfd_abs_section_ptr, objfile, 1);
- add_to_objfile_sections_full (objfile->obfd, bfd_ind_section_ptr, objfile, 1);
+ add_to_objfile_sections (objfile->obfd, bfd_com_section_ptr, objfile, 1);
+ add_to_objfile_sections (objfile->obfd, bfd_und_section_ptr, objfile, 1);
+ add_to_objfile_sections (objfile->obfd, bfd_abs_section_ptr, objfile, 1);
+ add_to_objfile_sections (objfile->obfd, bfd_ind_section_ptr, objfile, 1);
}
/* Given a pointer to an initialized bfd (ABFD) and some flag bits,