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.
This commit is contained in:
parent
cafb0d8131
commit
a190fabbfc
2 changed files with 9 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
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>
|
2020-09-19 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* gdb_bfd.h (gdb_bfd_sections): New overload. Fix formatting of
|
* gdb_bfd.h (gdb_bfd_sections): New overload. Fix formatting of
|
||||||
|
|
|
@ -290,8 +290,6 @@ core_target::build_file_mappings ()
|
||||||
normalize_mem_ranges (&m_core_unavailable_mappings);
|
normalize_mem_ranges (&m_core_unavailable_mappings);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_to_thread_list (bfd *, asection *, void *);
|
|
||||||
|
|
||||||
/* An arbitrary identifier for the core inferior. */
|
/* An arbitrary identifier for the core inferior. */
|
||||||
#define CORELOW_PID 1
|
#define CORELOW_PID 1
|
||||||
|
|
||||||
|
@ -322,11 +320,10 @@ core_target::close ()
|
||||||
extract the list of threads in a core file. */
|
extract the list of threads in a core file. */
|
||||||
|
|
||||||
static void
|
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 core_tid;
|
||||||
int pid, lwpid;
|
int pid, lwpid;
|
||||||
asection *reg_sect = (asection *) reg_sect_arg;
|
|
||||||
bool fake_pid_p = false;
|
bool fake_pid_p = false;
|
||||||
struct inferior *inf;
|
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
|
/* Build up thread list from BFD sections, and possibly set the
|
||||||
current thread to the .reg/NN section matching the .reg
|
current thread to the .reg/NN section matching the .reg
|
||||||
section. */
|
section. */
|
||||||
bfd_map_over_sections (core_bfd, add_to_thread_list,
|
asection *reg_sect = bfd_get_section_by_name (core_bfd, ".reg");
|
||||||
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)
|
if (inferior_ptid == null_ptid)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue