From: Tom Tromey Date: Sat, 19 Sep 2020 17:54:49 +0000 (-0600) Subject: Use gdb_bfd_sections in gcore_memory_sections X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f4f2b85fb2eab29ea981b2c3f2058c1dc04e413c;p=binutils-gdb.git 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. --- 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; }