From a190fabbfc6cca47d572550419f80c55802f3056 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 19 Sep 2020 11:54:49 -0600 Subject: 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. --- gdb/ChangeLog | 5 +++++ gdb/corelow.c | 10 ++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 16317fb..7e5201e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 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 existing function. diff --git a/gdb/corelow.c b/gdb/corelow.c index 96ec739..de15895 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) { -- cgit v1.1