aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-09-19 11:54:49 -0600
committerTom Tromey <tom@tromey.com>2020-09-19 11:54:49 -0600
commita190fabbfc6cca47d572550419f80c55802f3056 (patch)
tree5d5f72ee0e0b4a293d05e0748a761f1888174b96 /gdb
parentcafb0d81315ed3f8b4756a30e0c58fd73c161015 (diff)
downloadgdb-a190fabbfc6cca47d572550419f80c55802f3056.zip
gdb-a190fabbfc6cca47d572550419f80c55802f3056.tar.gz
gdb-a190fabbfc6cca47d572550419f80c55802f3056.tar.bz2
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 <tom@tromey.com> * corelow.c (add_to_thread_list): Change parameters. (core_target_open): Use foreach.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/corelow.c10
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 <tom@tromey.com>
+ * corelow.c (add_to_thread_list): Change parameters.
+ (core_target_open): Use foreach.
+
+2020-09-19 Tom Tromey <tom@tromey.com>
+
* 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)
{