Various fixes for JDWP.
- Moved lock of thread list lock into DecodeThread from its callers
- Fixed scope of various locks to prevent locking violations
- Added transition for current thread from runnable to suspended before
suspending vm, and then a transition back
- Reworked lock ordering to allow JDWP locks to be held while grabbing
the thread list lock
- Moved debugger PostException until after suspension is re-allowed
Change-Id: Ie53e47ff1538e6cd3125c48ddb4c13758b29be63
diff --git a/src/jdwp/jdwp_handler.cc b/src/jdwp/jdwp_handler.cc
index 07e47b5..88677d5 100644
--- a/src/jdwp/jdwp_handler.cc
+++ b/src/jdwp/jdwp_handler.cc
@@ -277,7 +277,10 @@
*/
static JdwpError VM_Suspend(JdwpState*, const uint8_t*, int, ExpandBuf*)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ Thread* self = Thread::Current();
+ self->TransitionFromRunnableToSuspended(kWaitingForDebuggerSuspension);
Dbg::SuspendVM();
+ self->TransitionFromSuspendedToRunnable();
return ERR_NONE;
}