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/locks.h b/src/locks.h
index c009f1d..9da7711 100644
--- a/src/locks.h
+++ b/src/locks.h
@@ -37,18 +37,19 @@
   kThreadSuspendCountLock = 2,
   kAbortLock = 3,
   kDefaultMutexLevel = 4,
-  kJdwpAttachLock = 5,
-  kJdwpStartLock = 6,
-  kJdwpSerialLock = 7,
-  kAllocSpaceLock = 8,
-  kLoadLibraryLock = 9,
-  kClassLinkerClassesLock = 10,
-  kThreadListLock = 11,
-  kRuntimeShutdownLock = 12,
-  kHeapBitmapLock = 13,
-  kMonitorLock = 14,
-  kMutatorLock = 15,
-  kZygoteCreationLock = 16,
+  kAllocSpaceLock = 5,
+  kLoadLibraryLock = 6,
+  kClassLinkerClassesLock = 7,
+  kThreadListLock = 8,
+  kJdwpEventListLock = 9,
+  kJdwpAttachLock = 10,
+  kJdwpStartLock = 11,
+  kJdwpSerialLock = 12,
+  kRuntimeShutdownLock = 13,
+  kHeapBitmapLock = 14,
+  kMonitorLock = 15,
+  kMutatorLock = 16,
+  kZygoteCreationLock = 17,
   kMaxMutexLevel = kZygoteCreationLock,
 };
 std::ostream& operator<<(std::ostream& os, const LockLevel& rhs);