From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 7/9] Enqueue signal even when resuming threads
Date: Thu, 30 Jun 2016 14:09:00 -0000 [thread overview]
Message-ID: <1467295765-3457-8-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1467295765-3457-1-git-send-email-yao.qi@linaro.org>
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-06-29 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.
---
gdb/gdbserver/linux-low.c | 41 ++++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 21 deletions(-)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 8061758..abaf288 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -267,6 +267,7 @@ static int kill_lwp (unsigned long lwpid, int signo);
static void enqueue_pending_signal (struct lwp_info *lwp, int signal, siginfo_t *info);
static void complete_ongoing_step_over (void);
static int linux_low_ptrace_options (int attached);
+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. */
@@ -4834,7 +4835,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;
@@ -4901,36 +4901,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;
--
1.9.1
next prev parent reply other threads:[~2016-06-30 14:09 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-30 14:09 [PATCH 0/9 V3] Use reinsert breakpoint for vCont;s Yao Qi
2016-06-30 14:09 ` [PATCH 8/9] Use reinsert_breakpoint " Yao Qi
2016-07-01 15:07 ` Pedro Alves
2016-07-05 8:15 ` Yao Qi
2016-07-21 8:38 ` Yao Qi
2016-07-21 10:02 ` Pedro Alves
2016-06-30 14:09 ` [PATCH 4/9] Make reinsert_breakpoint thread specific Yao Qi
2016-06-30 14:09 ` [PATCH 2/9] Create sub classes of 'struct breakpoint' Yao Qi
2016-06-30 14:09 ` [PATCH 6/9] Use enqueue_pending_signal in linux_resume_one_thread Yao Qi
2016-06-30 14:09 ` [PATCH 5/9] Switch current_thread to lwp's thread in install_software_single_step_breakpoints Yao Qi
2016-06-30 14:09 ` [PATCH 3/9] Refactor clone_all_breakpoints Yao Qi
2016-06-30 14:09 ` [PATCH 1/9] Pass breakpoint type in set_breakpoint_at Yao Qi
2016-06-30 14:09 ` [PATCH 9/9] Support vCont s and S actions with software single step Yao Qi
2016-06-30 14:09 ` Yao Qi [this message]
2016-07-01 15:06 ` [PATCH 7/9] Enqueue signal even when resuming threads Pedro Alves
2016-07-01 16:45 ` Yao Qi
2016-07-01 16:55 ` Pedro Alves
2016-07-01 17:01 ` Pedro Alves
2016-07-21 11:18 ` [PATCH 0/9 V3] Use reinsert breakpoint for vCont;s Yao Qi
2016-11-14 19:14 ` Antoine Tremblay
2016-11-21 12:08 ` Yao Qi
[not found] ` <wwok37ikrgmq.fsf@ericsson.com>
2016-11-23 19:03 ` Antoine Tremblay
2016-11-24 21:55 ` Yao Qi
2016-11-25 12:22 ` Antoine Tremblay
2016-11-25 13:13 ` Antoine Tremblay
2016-11-25 13:35 ` Antoine Tremblay
2016-11-25 13:44 ` Pedro Alves
2016-11-25 13:57 ` Antoine Tremblay
2016-11-25 14:28 ` Antoine Tremblay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1467295765-3457-8-git-send-email-yao.qi@linaro.org \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox