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  <tom@tromey.com>

	* gcore.c (make_output_phdrs): Remove 'ignored' parameter.
	(gcore_copy_callback): Likewise.
	(gcore_memory_sections): Use foreach.
This commit is contained in:
Tom Tromey 2020-09-19 11:54:49 -06:00
parent b35c1d1cf4
commit f4f2b85fb2
2 changed files with 12 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2020-09-19 Tom Tromey <tom@tromey.com>
* gcore.c (make_output_phdrs): Remove 'ignored' parameter.
(gcore_copy_callback): Likewise.
(gcore_memory_sections): Use foreach.
2020-09-19 Tom Tromey <tom@tromey.com>
* osabi.h (generic_elf_osabi_sniff_abi_tag_sections): Update.

View file

@ -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;
}