summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/jdwp/jdwp_event.cc8
-rw-r--r--runtime/thread_list.cc12
2 files changed, 12 insertions, 8 deletions
diff --git a/runtime/jdwp/jdwp_event.cc b/runtime/jdwp/jdwp_event.cc
index e372c26..677b04b 100644
--- a/runtime/jdwp/jdwp_event.cc
+++ b/runtime/jdwp/jdwp_event.cc
@@ -576,14 +576,6 @@ void JdwpState::SuspendByPolicy(JdwpSuspendPolicy suspend_policy, JDWP::ObjectId
Dbg::ExecuteMethod(pReq);
pReq->error = ERR_NONE;
-
- /* clear this before signaling */
- pReq->invoke_needed = false;
-
- VLOG(jdwp) << "invoke complete, signaling and self-suspending";
- Thread* self = Thread::Current();
- MutexLock mu(self, pReq->lock);
- pReq->cond.Signal(self);
}
}
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 25f692d..9f67c96 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -577,6 +577,18 @@ void ThreadList::SuspendSelfForDebugger() {
VLOG(threads) << *self << " self-suspending (debugger)";
+ // Tell JDWP we've completed invocation and are ready to suspend.
+ DebugInvokeReq* pReq = self->GetInvokeReq();
+ DCHECK(pReq != NULL);
+ if (pReq->invoke_needed) {
+ // Clear this before signaling.
+ pReq->invoke_needed = false;
+
+ VLOG(jdwp) << "invoke complete, signaling";
+ MutexLock mu(self, pReq->lock);
+ pReq->cond.Signal(self);
+ }
+
// Tell JDWP that we've completed suspension. The JDWP thread can't
// tell us to resume before we're fully asleep because we hold the
// suspend count lock.