diff options
author | Yao Qi <yao.qi@linaro.org> | 2016-07-21 12:12:18 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2016-07-21 12:12:18 +0100 |
commit | 0e9a339ec8ffab80fdbe97adaf888fe03b73fe22 (patch) | |
tree | ec98676c0811dbdb1e1c3fd78ad975b80a36f76d /gdb | |
parent | 4281b351bfa3b646ab531cf73c56e49366fef108 (diff) | |
download | gdb-0e9a339ec8ffab80fdbe97adaf888fe03b73fe22.zip gdb-0e9a339ec8ffab80fdbe97adaf888fe03b73fe22.tar.gz gdb-0e9a339ec8ffab80fdbe97adaf888fe03b73fe22.tar.bz2 |
Enqueue signal even when resuming threads
Nowadays, we only enqueue signal when we leave thread pending in
linux_resume_one_thread. If lwp->resume->sig isn't zero (GDB wants
to resume with signal), we pass lwp->resume->sig to
linux_resume_one_lwp.
In order to reduce the difference between resuming thread with signal
and proceeding thread with signal, when we resume thread, we can
enqueue signal too, and proceed thread. The signal will be consumed in
linux_resume_one_lwp_throw from lwp->pending_signals.
gdb/gdbserver:
2016-07-21 Yao Qi <yao.qi@linaro.org>
* linux-low.c (proceed_one_lwp): Declare.
(linux_resume_one_thread): Remove local variable 'step'.
Lift code enqueue signal. Call proceed_one_lwp instead of
linux_resume_one_lwp.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 41 |
2 files changed, 27 insertions, 21 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 3130334..e5aed82 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,12 @@ 2016-07-21 Yao Qi <yao.qi@linaro.org> + * linux-low.c (proceed_one_lwp): Declare. + (linux_resume_one_thread): Remove local variable 'step'. + Lift code enqueue signal. Call proceed_one_lwp instead of + linux_resume_one_lwp. + +2016-07-21 Yao Qi <yao.qi@linaro.org> + * linux-low.c (linux_resume_one_thread): Call enqueue_pending_signal. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index c8d0266..d9f847d 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -268,6 +268,7 @@ static void enqueue_pending_signal (struct lwp_info *lwp, int signal, siginfo_t static void complete_ongoing_step_over (void); static int linux_low_ptrace_options (int attached); static int check_ptrace_stopped_lwp_gone (struct lwp_info *lp); +static int proceed_one_lwp (struct inferior_list_entry *entry, void *except); /* When the event-loop is doing a step-over, this points at the thread being stepped. */ @@ -4912,7 +4913,6 @@ linux_resume_one_thread (struct inferior_list_entry *entry, void *arg) { struct thread_info *thread = (struct thread_info *) entry; struct lwp_info *lwp = get_thread_lwp (thread); - int step; int leave_all_stopped = * (int *) arg; int leave_pending; @@ -4979,36 +4979,35 @@ linux_resume_one_thread (struct inferior_list_entry *entry, void *arg) || lwp->status_pending_p || leave_all_stopped); + /* If we have a new signal, enqueue the signal. */ + if (lwp->resume->sig != 0) + { + siginfo_t info, *info_p; + + /* If this is the same signal we were previously stopped by, + make sure to queue its siginfo. */ + if (WIFSTOPPED (lwp->last_status) + && WSTOPSIG (lwp->last_status) == lwp->resume->sig + && ptrace (PTRACE_GETSIGINFO, lwpid_of (thread), + (PTRACE_TYPE_ARG3) 0, &info) == 0) + info_p = &info; + else + info_p = NULL; + + enqueue_pending_signal (lwp, lwp->resume->sig, info_p); + } + if (!leave_pending) { if (debug_threads) debug_printf ("resuming LWP %ld\n", lwpid_of (thread)); - step = (lwp->resume->kind == resume_step); - linux_resume_one_lwp (lwp, step, lwp->resume->sig, NULL); + proceed_one_lwp (entry, NULL); } else { if (debug_threads) debug_printf ("leaving LWP %ld stopped\n", lwpid_of (thread)); - - /* If we have a new signal, enqueue the signal. */ - if (lwp->resume->sig != 0) - { - siginfo_t info, *info_p; - - /* If this is the same signal we were previously stopped by, - make sure to queue its siginfo. */ - if (WIFSTOPPED (lwp->last_status) - && WSTOPSIG (lwp->last_status) == lwp->resume->sig - && ptrace (PTRACE_GETSIGINFO, lwpid_of (thread), - (PTRACE_TYPE_ARG3) 0, &info) == 0) - info_p = &info; - else - info_p = NULL; - - enqueue_pending_signal (lwp, lwp->resume->sig, info_p); - } } thread->last_status.kind = TARGET_WAITKIND_IGNORE; |