mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-28 23:39:35 +08:00
Remove for_each_inferior
This patch removes for_each_inferior, replacing all its usages with for_each_thread. gdb/gdbserver/ChangeLog: * inferiors.c (for_each_inferior): Remove. (clear_inferiors): Use for_each_thread. * inferiors.h (for_each_inferior): Remove. * linux-low.c (linux_wait_for_event_filtered): Use for_each_thread. (linux_stabilize_threads): Likewise. * regcache.c (regcache_release): Likewise. * server.c (gdb_wants_all_threads_stopped): Likewise. (clear_pending_status_callback): Remove. (handle_status): Use for_each_thread. (captured_main): Likewise. * win32-low.c (child_init_thread_list): Likewise. (win32_clear_inferiors): Likewise. (fake_breakpoint_event): Likewise.
This commit is contained in:
@ -1,3 +1,20 @@
|
|||||||
|
2017-12-02 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
|
* inferiors.c (for_each_inferior): Remove.
|
||||||
|
(clear_inferiors): Use for_each_thread.
|
||||||
|
* inferiors.h (for_each_inferior): Remove.
|
||||||
|
* linux-low.c (linux_wait_for_event_filtered): Use
|
||||||
|
for_each_thread.
|
||||||
|
(linux_stabilize_threads): Likewise.
|
||||||
|
* regcache.c (regcache_release): Likewise.
|
||||||
|
* server.c (gdb_wants_all_threads_stopped): Likewise.
|
||||||
|
(clear_pending_status_callback): Remove.
|
||||||
|
(handle_status): Use for_each_thread.
|
||||||
|
(captured_main): Likewise.
|
||||||
|
* win32-low.c (child_init_thread_list): Likewise.
|
||||||
|
(win32_clear_inferiors): Likewise.
|
||||||
|
(fake_breakpoint_event): Likewise.
|
||||||
|
|
||||||
2017-12-02 Simon Marchi <simon.marchi@polymtl.ca>
|
2017-12-02 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
* inferiors.h (find_inferior): Remove.
|
* inferiors.h (find_inferior): Remove.
|
||||||
|
@ -30,17 +30,6 @@ struct thread_info *current_thread;
|
|||||||
/* The current working directory used to start the inferior. */
|
/* The current working directory used to start the inferior. */
|
||||||
static const char *current_inferior_cwd = NULL;
|
static const char *current_inferior_cwd = NULL;
|
||||||
|
|
||||||
void
|
|
||||||
for_each_inferior (std::list<thread_info *> *thread_list,
|
|
||||||
void (*action) (thread_info *))
|
|
||||||
{
|
|
||||||
gdb_assert (thread_list == &all_threads);
|
|
||||||
|
|
||||||
for_each_thread ([&] (thread_info *thread) {
|
|
||||||
action (thread);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
for_each_inferior_with_data (std::list<thread_info *> *thread_list,
|
for_each_inferior_with_data (std::list<thread_info *> *thread_list,
|
||||||
void (*action) (thread_info *, void *),
|
void (*action) (thread_info *, void *),
|
||||||
@ -151,7 +140,7 @@ set_thread_regcache_data (struct thread_info *thread, struct regcache *data)
|
|||||||
void
|
void
|
||||||
clear_inferiors (void)
|
clear_inferiors (void)
|
||||||
{
|
{
|
||||||
for_each_inferior (&all_threads, free_one_thread);
|
for_each_thread (free_one_thread);
|
||||||
all_threads.clear ();
|
all_threads.clear ();
|
||||||
|
|
||||||
clear_dlls ();
|
clear_dlls ();
|
||||||
|
@ -140,8 +140,6 @@ int have_attached_inferiors_p (void);
|
|||||||
|
|
||||||
void clear_inferiors (void);
|
void clear_inferiors (void);
|
||||||
|
|
||||||
void for_each_inferior (std::list<thread_info *> *thread_list,
|
|
||||||
void (*action) (thread_info *));
|
|
||||||
void for_each_inferior_with_data (std::list<thread_info *> *thread_list,
|
void for_each_inferior_with_data (std::list<thread_info *> *thread_list,
|
||||||
void (*action) (thread_info *, void *),
|
void (*action) (thread_info *, void *),
|
||||||
void *data);
|
void *data);
|
||||||
|
@ -2736,7 +2736,7 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid,
|
|||||||
/* Now that we've pulled all events out of the kernel, resume
|
/* Now that we've pulled all events out of the kernel, resume
|
||||||
LWPs that don't have an interesting event to report. */
|
LWPs that don't have an interesting event to report. */
|
||||||
if (stopping_threads == NOT_STOPPING_THREADS)
|
if (stopping_threads == NOT_STOPPING_THREADS)
|
||||||
for_each_inferior (&all_threads, resume_stopped_resumed_lwps);
|
for_each_thread (resume_stopped_resumed_lwps);
|
||||||
|
|
||||||
/* ... and find an LWP with a status to report to the core, if
|
/* ... and find an LWP with a status to report to the core, if
|
||||||
any. */
|
any. */
|
||||||
@ -2972,7 +2972,7 @@ linux_stabilize_threads (void)
|
|||||||
stabilizing_threads = 1;
|
stabilizing_threads = 1;
|
||||||
|
|
||||||
/* Kick 'em all. */
|
/* Kick 'em all. */
|
||||||
for_each_inferior (&all_threads, move_out_of_jump_pad_callback);
|
for_each_thread (move_out_of_jump_pad_callback);
|
||||||
|
|
||||||
/* Loop until all are stopped out of the jump pads. */
|
/* Loop until all are stopped out of the jump pads. */
|
||||||
while (find_thread (lwp_running) != NULL)
|
while (find_thread (lwp_running) != NULL)
|
||||||
|
@ -281,7 +281,7 @@ void
|
|||||||
regcache_release (void)
|
regcache_release (void)
|
||||||
{
|
{
|
||||||
/* Flush and release all pre-existing register caches. */
|
/* Flush and release all pre-existing register caches. */
|
||||||
for_each_inferior (&all_threads, free_register_cache_thread);
|
for_each_thread (free_register_cache_thread);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3216,7 +3216,7 @@ myresume (char *own_buf, int step, int sig)
|
|||||||
resume (resume_info, n);
|
resume (resume_info, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback for for_each_inferior. Make a new stop reply for each
|
/* Callback for for_each_thread. Make a new stop reply for each
|
||||||
stopped thread. */
|
stopped thread. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3281,19 +3281,10 @@ gdb_wants_thread_stopped (thread_info *thread)
|
|||||||
static void
|
static void
|
||||||
gdb_wants_all_threads_stopped (void)
|
gdb_wants_all_threads_stopped (void)
|
||||||
{
|
{
|
||||||
for_each_inferior (&all_threads, gdb_wants_thread_stopped);
|
for_each_thread (gdb_wants_thread_stopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback for for_each_inferior. Clear the thread's pending status
|
/* Callback for for_each_thread. If the thread is stopped with an
|
||||||
flag. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
clear_pending_status_callback (thread_info *thread)
|
|
||||||
{
|
|
||||||
thread->status_pending_p = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Callback for for_each_inferior. If the thread is stopped with an
|
|
||||||
interesting event, mark it as having a pending event. */
|
interesting event, mark it as having a pending event. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3348,7 +3339,7 @@ handle_status (char *own_buf)
|
|||||||
reporting now pending. They'll be reported the next time the
|
reporting now pending. They'll be reported the next time the
|
||||||
threads are resumed. Start by marking all interesting events
|
threads are resumed. Start by marking all interesting events
|
||||||
as pending. */
|
as pending. */
|
||||||
for_each_inferior (&all_threads, set_pending_status_callback);
|
for_each_thread (set_pending_status_callback);
|
||||||
|
|
||||||
/* Prefer the last thread that reported an event to GDB (even if
|
/* Prefer the last thread that reported an event to GDB (even if
|
||||||
that was a GDB_SIGNAL_TRAP). */
|
that was a GDB_SIGNAL_TRAP). */
|
||||||
@ -3869,8 +3860,10 @@ captured_main (int argc, char *argv[])
|
|||||||
(by the same GDB instance or another) will refresh all its
|
(by the same GDB instance or another) will refresh all its
|
||||||
state from scratch. */
|
state from scratch. */
|
||||||
discard_queued_stop_replies (minus_one_ptid);
|
discard_queued_stop_replies (minus_one_ptid);
|
||||||
for_each_inferior (&all_threads,
|
for_each_thread ([] (thread_info *thread)
|
||||||
clear_pending_status_callback);
|
{
|
||||||
|
thread->status_pending_p = 0;
|
||||||
|
});
|
||||||
|
|
||||||
if (tracing)
|
if (tracing)
|
||||||
{
|
{
|
||||||
|
@ -339,7 +339,7 @@ child_xfer_memory (CORE_ADDR memaddr, char *our, int len,
|
|||||||
static void
|
static void
|
||||||
child_init_thread_list (void)
|
child_init_thread_list (void)
|
||||||
{
|
{
|
||||||
for_each_inferior (&all_threads, delete_thread_info);
|
for_each_thread (delete_thread_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Zero during the child initialization phase, and nonzero otherwise. */
|
/* Zero during the child initialization phase, and nonzero otherwise. */
|
||||||
@ -793,7 +793,7 @@ win32_clear_inferiors (void)
|
|||||||
if (current_process_handle != NULL)
|
if (current_process_handle != NULL)
|
||||||
CloseHandle (current_process_handle);
|
CloseHandle (current_process_handle);
|
||||||
|
|
||||||
for_each_inferior (&all_threads, delete_thread_info);
|
for_each_thread (delete_thread_info);
|
||||||
clear_inferiors ();
|
clear_inferiors ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1362,7 +1362,7 @@ fake_breakpoint_event (void)
|
|||||||
current_event.u.Exception.ExceptionRecord.ExceptionCode
|
current_event.u.Exception.ExceptionRecord.ExceptionCode
|
||||||
= EXCEPTION_BREAKPOINT;
|
= EXCEPTION_BREAKPOINT;
|
||||||
|
|
||||||
for_each_inferior (&all_threads, suspend_one_thread);
|
for_each_thread (suspend_one_thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
|
Reference in New Issue
Block a user