aboutsummaryrefslogtreecommitdiff
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:54 -0600
commit08f93a1a93f9b344a92dc9e411c83d70acfdf857 (patch)
treec63d527940947ccf43a34443f6e9e92f79c9e06b
parent03cd72b8107b34e7b572f9962ee589472ff1fa1e (diff)
downloadgdb-08f93a1a93f9b344a92dc9e411c83d70acfdf857.zip
gdb-08f93a1a93f9b344a92dc9e411c83d70acfdf857.tar.gz
gdb-08f93a1a93f9b344a92dc9e411c83d70acfdf857.tar.bz2
Use gdb_bfd_sections in elf_symfile_read
This changes elf_symfile_read to avoid bfd_map_over_sections, in favor of iteration. gdb/ChangeLog 2020-09-19 Tom Tromey <tom@tromey.com> * elfread.c (elf_locate_sections): Change parameters. (elf_symfile_read): Use foreach.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/elfread.c10
2 files changed, 10 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1c95044..469b6c7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2020-09-19 Tom Tromey <tom@tromey.com>
+ * elfread.c (elf_locate_sections): Change parameters.
+ (elf_symfile_read): Use foreach.
+
+2020-09-19 Tom Tromey <tom@tromey.com>
+
* cli/cli-dump.c (struct callback_data): Remove.
(restore_one_section): Rename from restore_section_callback.
Change parameters.
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 75bdd75..5dad3dd 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -176,11 +176,8 @@ elf_symfile_segments (bfd *abfd)
-kingdon). */
static void
-elf_locate_sections (bfd *ignore_abfd, asection *sectp, void *eip)
+elf_locate_sections (asection *sectp, struct elfinfo *ei)
{
- struct elfinfo *ei;
-
- ei = (struct elfinfo *) eip;
if (strcmp (sectp->name, ".stab") == 0)
{
ei->stabsect = sectp;
@@ -1211,7 +1208,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
memset ((char *) &ei, 0, sizeof (ei));
if (!(objfile->flags & OBJF_READNEVER))
- bfd_map_over_sections (abfd, elf_locate_sections, (void *) & ei);
+ {
+ for (asection *sect : gdb_bfd_sections (abfd))
+ elf_locate_sections (sect, &ei);
+ }
elf_read_minimal_symbols (objfile, symfile_flags, &ei);