From: Tom Tromey Date: Sat, 19 Sep 2020 17:54:49 +0000 (-0600) Subject: Use gdb_bfd_sections in core_target_open X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a190fabbfc6cca47d572550419f80c55802f3056;p=binutils-gdb.git Use gdb_bfd_sections in core_target_open This changes core_target_open to avoid bfd_map_over_sections, in favor of iteration. gdb/ChangeLog 2020-09-19 Tom Tromey * corelow.c (add_to_thread_list): Change parameters. (core_target_open): Use foreach. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 16317fb017d..7e5201ee4b6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-09-19 Tom Tromey + + * corelow.c (add_to_thread_list): Change parameters. + (core_target_open): Use foreach. + 2020-09-19 Tom Tromey * gdb_bfd.h (gdb_bfd_sections): New overload. Fix formatting of diff --git a/gdb/corelow.c b/gdb/corelow.c index 96ec739c62f..de15895c80b 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -290,8 +290,6 @@ core_target::build_file_mappings () normalize_mem_ranges (&m_core_unavailable_mappings); } -static void add_to_thread_list (bfd *, asection *, void *); - /* An arbitrary identifier for the core inferior. */ #define CORELOW_PID 1 @@ -322,11 +320,10 @@ core_target::close () extract the list of threads in a core file. */ static void -add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) +add_to_thread_list (asection *asect, asection *reg_sect) { int core_tid; int pid, lwpid; - asection *reg_sect = (asection *) reg_sect_arg; bool fake_pid_p = false; struct inferior *inf; @@ -493,8 +490,9 @@ core_target_open (const char *arg, int from_tty) /* Build up thread list from BFD sections, and possibly set the current thread to the .reg/NN section matching the .reg section. */ - bfd_map_over_sections (core_bfd, add_to_thread_list, - bfd_get_section_by_name (core_bfd, ".reg")); + asection *reg_sect = bfd_get_section_by_name (core_bfd, ".reg"); + for (asection *sect : gdb_bfd_sections (core_bfd)) + add_to_thread_list (sect, reg_sect); if (inferior_ptid == null_ptid) {