aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2016-04-25 09:46:36 +0100
committerYao Qi <yao.qi@linaro.org>2016-04-25 09:46:36 +0100
commit484b3c325d8182cd7b7da4ceeaedc238c7f80b5c (patch)
tree0d468ee77e93a0a6d5e847ebc654cd5962836e1e
parent85ba7d867af39fe1408accd1f9ea4ca3dcb84b99 (diff)
downloadgdb-484b3c325d8182cd7b7da4ceeaedc238c7f80b5c.zip
gdb-484b3c325d8182cd7b7da4ceeaedc238c7f80b5c.tar.gz
gdb-484b3c325d8182cd7b7da4ceeaedc238c7f80b5c.tar.bz2
Resume the inferior with signal rather than stepping over
When GDBserver steps over a breakpoint using software single step, it enqueues the signal, single step and deliver the signal in the next resume if step over is not needed. In this way, the program won't receive the signal if the conditional breakpoint is set a branch to self instruction, because the step over is always needed. This patch removes the restriction that don't deliver the signal to the inferior if we are trying to reinsert a breakpoint for software single step and change the decision on resume vs. step-over when the LWP has pending signals to deliver. gdb/gdbserver: 2016-04-25 Yao Qi <yao.qi@linaro.org> * linux-low.c (lwp_signal_can_be_delivered): Adjust. (need_step_over_p): Return zero if the LWP has pending signals can be delivered on software single step target.
-rw-r--r--gdb/gdbserver/ChangeLog6
-rw-r--r--gdb/gdbserver/linux-low.c18
2 files changed, 21 insertions, 3 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 323d582..c9b1e9d 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,11 @@
2016-04-25 Yao Qi <yao.qi@linaro.org>
+ * linux-low.c (lwp_signal_can_be_delivered): Adjust.
+ (need_step_over_p): Return zero if the LWP has pending signals
+ can be delivered on software single step target.
+
+2016-04-25 Yao Qi <yao.qi@linaro.org>
+
* linux-low.c (reinsert_raw_breakpoint): If bp->inserted is true
return instead of error.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 5cbd308..efa0774 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -4119,7 +4119,6 @@ single_step (struct lwp_info* lwp)
}
/* The signal can be delivered to the inferior if we are not trying to
- reinsert a breakpoint for software single step and not trying to
finish a fast tracepoint collect. Since signal can be delivered in
the step-over, the program may go to signal handler and trap again
after return from the signal handler. We can live with the spurious
@@ -4128,8 +4127,7 @@ single_step (struct lwp_info* lwp)
static int
lwp_signal_can_be_delivered (struct lwp_info *lwp)
{
- return (!(lwp->bp_reinsert != 0 && can_software_single_step ())
- && !lwp->collecting_fast_tracepoint);
+ return !lwp->collecting_fast_tracepoint;
}
/* Resume execution of LWP. If STEP is nonzero, single-step it. If
@@ -4578,6 +4576,20 @@ need_step_over_p (struct inferior_list_entry *entry, void *dummy)
return 0;
}
+ /* On software single step target, resume the inferior with signal
+ rather than stepping over. */
+ if (can_software_single_step ()
+ && lwp->pending_signals != NULL
+ && lwp_signal_can_be_delivered (lwp))
+ {
+ if (debug_threads)
+ debug_printf ("Need step over [LWP %ld]? Ignoring, has pending"
+ " signals.\n",
+ lwpid_of (thread));
+
+ return 0;
+ }
+
saved_thread = current_thread;
current_thread = thread;