JDWP: fix thread state on event suspension
Before suspending event thread, we ensure its state is kSuspended
so the debugger sees it as RUNNING instead of WAIT.
Bug: 19103406
Change-Id: I58b4141a958bf6a3c360f6994967fad0078ea373
diff --git a/runtime/jdwp/jdwp_event.cc b/runtime/jdwp/jdwp_event.cc
index b71f6cd..fc08d23 100644
--- a/runtime/jdwp/jdwp_event.cc
+++ b/runtime/jdwp/jdwp_event.cc
@@ -633,7 +633,11 @@
AcquireJdwpTokenForEvent(threadId);
}
EventFinish(pReq);
- SuspendByPolicy(suspend_policy, thread_self_id);
+ {
+ // Before suspending, we change our state to kSuspended so the debugger sees us as RUNNING.
+ ScopedThreadStateChange stsc(self, kSuspended);
+ SuspendByPolicy(suspend_policy, thread_self_id);
+ }
self->TransitionFromSuspendedToRunnable();
}