mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 22:48:57 +08:00
Remove usages of find_inferior in stop_all_lwps
Replace with for_each_thread. gdb/gdbserver/ChangeLog: * linux-low.c (send_sigstop_callback): Return void, change parameter type. Rename to... (send_sigstop): ... this. (suspend_and_send_sigstop_callback): Return void, change parameter type. Rename to... (suspend_and_send_sigstop): ... this. (stop_all_lwps): Use for_each_thread.
This commit is contained in:
@ -1,3 +1,13 @@
|
|||||||
|
2017-12-02 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
|
* linux-low.c (send_sigstop_callback): Return void, change
|
||||||
|
parameter type. Rename to...
|
||||||
|
(send_sigstop): ... this.
|
||||||
|
(suspend_and_send_sigstop_callback): Return void, change parameter
|
||||||
|
type. Rename to...
|
||||||
|
(suspend_and_send_sigstop): ... this.
|
||||||
|
(stop_all_lwps): Use for_each_thread.
|
||||||
|
|
||||||
2017-12-02 Simon Marchi <simon.marchi@polymtl.ca>
|
2017-12-02 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
* linux-low.c (lwp_running): Return bool, remove unused
|
* linux-low.c (lwp_running): Return bool, remove unused
|
||||||
|
@ -3933,36 +3933,35 @@ send_sigstop (struct lwp_info *lwp)
|
|||||||
kill_lwp (pid, SIGSTOP);
|
kill_lwp (pid, SIGSTOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
send_sigstop_callback (thread_info *thread, void *except)
|
send_sigstop (thread_info *thread, lwp_info *except)
|
||||||
{
|
{
|
||||||
struct lwp_info *lwp = get_thread_lwp (thread);
|
struct lwp_info *lwp = get_thread_lwp (thread);
|
||||||
|
|
||||||
/* Ignore EXCEPT. */
|
/* Ignore EXCEPT. */
|
||||||
if (lwp == except)
|
if (lwp == except)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
if (lwp->stopped)
|
if (lwp->stopped)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
send_sigstop (lwp);
|
send_sigstop (lwp);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Increment the suspend count of an LWP, and stop it, if not stopped
|
/* Increment the suspend count of an LWP, and stop it, if not stopped
|
||||||
yet. */
|
yet. */
|
||||||
static int
|
static void
|
||||||
suspend_and_send_sigstop_callback (thread_info *thread, void *except)
|
suspend_and_send_sigstop (thread_info *thread, lwp_info *except)
|
||||||
{
|
{
|
||||||
struct lwp_info *lwp = get_thread_lwp (thread);
|
struct lwp_info *lwp = get_thread_lwp (thread);
|
||||||
|
|
||||||
/* Ignore EXCEPT. */
|
/* Ignore EXCEPT. */
|
||||||
if (lwp == except)
|
if (lwp == except)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
lwp_suspended_inc (lwp);
|
lwp_suspended_inc (lwp);
|
||||||
|
|
||||||
return send_sigstop_callback (thread, except);
|
send_sigstop (thread, except);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4157,9 +4156,16 @@ stop_all_lwps (int suspend, struct lwp_info *except)
|
|||||||
: STOPPING_THREADS);
|
: STOPPING_THREADS);
|
||||||
|
|
||||||
if (suspend)
|
if (suspend)
|
||||||
find_inferior (&all_threads, suspend_and_send_sigstop_callback, except);
|
for_each_thread ([&] (thread_info *thread)
|
||||||
|
{
|
||||||
|
suspend_and_send_sigstop (thread, except);
|
||||||
|
});
|
||||||
else
|
else
|
||||||
find_inferior (&all_threads, send_sigstop_callback, except);
|
for_each_thread ([&] (thread_info *thread)
|
||||||
|
{
|
||||||
|
send_sigstop (thread, except);
|
||||||
|
});
|
||||||
|
|
||||||
wait_for_sigstop ();
|
wait_for_sigstop ();
|
||||||
stopping_threads = NOT_STOPPING_THREADS;
|
stopping_threads = NOT_STOPPING_THREADS;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user