Use gdb_bfd_sections in ELF osabi tag sniffing

This changes some ELF osabi tag-sniffing functions to avoid
bfd_map_over_sections, in favor of iteration.  I could only readily
test the generic one.

gdb/ChangeLog
2020-09-19  Tom Tromey  <tom@tromey.com>

	* osabi.h (generic_elf_osabi_sniff_abi_tag_sections): Update.
	* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Change
	parameters.
	(generic_elf_osabi_sniffer): Use foreach.
	* mips-sde-tdep.c (mips_sde_elf_osabi_sniffer): Use foreach.
	* arm-tdep.c (arm_elf_osabi_sniffer): Use foreach.
This commit is contained in:
Tom Tromey
2020-09-19 11:54:49 -06:00
parent 5bb6e9dd70
commit b35c1d1cf4
5 changed files with 23 additions and 14 deletions

View File

@@ -8863,9 +8863,10 @@ arm_elf_osabi_sniffer (bfd *abfd)
if (elfosabi == ELFOSABI_ARM)
/* GNU tools use this value. Check note sections in this case,
as well. */
bfd_map_over_sections (abfd,
generic_elf_osabi_sniff_abi_tag_sections,
&osabi);
{
for (asection *sect : gdb_bfd_sections (abfd))
generic_elf_osabi_sniff_abi_tag_sections (abfd, sect, &osabi);
}
/* Anything else will be handled by the generic ELF sniffer. */
return osabi;