From f4f2b85fb2eab29ea981b2c3f2058c1dc04e413c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 19 Sep 2020 11:54:49 -0600 Subject: [PATCH] Use gdb_bfd_sections in gcore_memory_sections This changes gcore_memory_sections to avoid bfd_map_over_sections, in favor of iteration. gdb/ChangeLog 2020-09-19 Tom Tromey * gcore.c (make_output_phdrs): Remove 'ignored' parameter. (gcore_copy_callback): Likewise. (gcore_memory_sections): Use foreach. --- gdb/ChangeLog | 6 ++++++ gdb/gcore.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1fb3c8834a1..eaffc9dfb28 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-09-19 Tom Tromey + + * gcore.c (make_output_phdrs): Remove 'ignored' parameter. + (gcore_copy_callback): Likewise. + (gcore_memory_sections): Use foreach. + 2020-09-19 Tom Tromey * osabi.h (generic_elf_osabi_sniff_abi_tag_sections): Update. diff --git a/gdb/gcore.c b/gdb/gcore.c index d0e36b1a708..46ca2da5003 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -364,7 +364,7 @@ derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top) } static void -make_output_phdrs (bfd *obfd, asection *osec, void *ignored) +make_output_phdrs (bfd *obfd, asection *osec) { int p_flags = 0; int p_type = 0; @@ -531,7 +531,7 @@ objfile_find_memory_regions (struct target_ops *self, } static void -gcore_copy_callback (bfd *obfd, asection *osec, void *ignored) +gcore_copy_callback (bfd *obfd, asection *osec) { bfd_size_type size, total_size = bfd_section_size (osec); file_ptr offset = 0; @@ -587,10 +587,12 @@ gcore_memory_sections (bfd *obfd) } /* Record phdrs for section-to-segment mapping. */ - bfd_map_over_sections (obfd, make_output_phdrs, NULL); + for (asection *sect : gdb_bfd_sections (obfd)) + make_output_phdrs (obfd, sect); /* Copy memory region contents. */ - bfd_map_over_sections (obfd, gcore_copy_callback, NULL); + for (asection *sect : gdb_bfd_sections (obfd)) + gcore_copy_callback (obfd, sect); return 1; } -- 2.30.2