This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Check lwp_signal_can_be_delivered for enqueue/dequeue pending signals
- From: Yao Qi <qiyao at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 18 Mar 2016 14:36:32 -0000
- Subject: [binutils-gdb] Check lwp_signal_can_be_delivered for enqueue/dequeue pending signals
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=35ac8b3e2dbbe1fcd107dfcc6bbc4faed6bdc63f
commit 35ac8b3e2dbbe1fcd107dfcc6bbc4faed6bdc63f
Author: Yao Qi <yao.qi@linaro.org>
Date: Fri Mar 18 14:34:37 2016 +0000
Check lwp_signal_can_be_delivered for enqueue/dequeue pending signals
The enqueue and dequeue signals in linux_resume_one_lwp_throw use one
condition and its inverted one. This patch is to move the condition
into a function lwp_signal_can_be_delivered, so that the next patch can
change the condition in one place.
gdb/gdbserver:
2016-03-18 Yao Qi <yao.qi@linaro.org>
* linux-low.c (lwp_signal_can_be_delivered): New function.
(linux_resume_one_lwp_throw): Use lwp_signal_can_be_delivered.
Diff:
---
gdb/gdbserver/ChangeLog | 5 +++++
gdb/gdbserver/linux-low.c | 26 ++++++++++++++++----------
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index b210971..a63d7fb 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,10 @@
2016-03-18 Yao Qi <yao.qi@linaro.org>
+ * linux-low.c (lwp_signal_can_be_delivered): New function.
+ (linux_resume_one_lwp_throw): Use lwp_signal_can_be_delivered.
+
+2016-03-18 Yao Qi <yao.qi@linaro.org>
+
* linux-low.c (linux_resume_one_lwp_throw): Set 'signal' to
0 if signal is enqueued. Remove 'signal' from one debugging
message. Move one debugging message to some lines below.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index f267a96..7630f9f 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -4118,6 +4118,16 @@ single_step (struct lwp_info* lwp)
return step;
}
+/* The signal can be delivered to the inferior if we are not trying to
+ reinsert a breakpoint and not trying to finish a fast tracepoint
+ collect. */
+
+static int
+lwp_signal_can_be_delivered (struct lwp_info *lwp)
+{
+ return (lwp->bp_reinsert == 0 && !lwp->collecting_fast_tracepoint);
+}
+
/* Resume execution of LWP. If STEP is nonzero, single-step it. If
SIGNAL is nonzero, give it that signal. */
@@ -4157,13 +4167,12 @@ linux_resume_one_lwp_throw (struct lwp_info *lwp,
}
/* If we have pending signals or status, and a new signal, enqueue the
- signal. Also enqueue the signal if we are waiting to reinsert a
- breakpoint; it will be picked up again below. */
+ signal. Also enqueue the signal if it can't be delivered to the
+ inferior right now. */
if (signal != 0
&& (lwp->status_pending_p
|| lwp->pending_signals != NULL
- || lwp->bp_reinsert != 0
- || fast_tp_collecting))
+ || !lwp_signal_can_be_delivered (lwp)))
{
enqueue_pending_signal (lwp, signal, info);
@@ -4269,12 +4278,9 @@ linux_resume_one_lwp_throw (struct lwp_info *lwp,
}
}
- /* If we have pending signals, consume one unless we are trying to
- reinsert a breakpoint or we're trying to finish a fast tracepoint
- collect. */
- if (lwp->pending_signals != NULL
- && lwp->bp_reinsert == 0
- && fast_tp_collecting == 0)
+ /* If we have pending signals, consume one if it can be delivered to
+ the inferior. */
+ if (lwp->pending_signals != NULL && lwp_signal_can_be_delivered (lwp))
{
struct pending_signals **p_sig;