Fix a thread state misunderstanding.

Note that this means that we now give the right answer for Object.wait(long)
but the wrong answer for Thread.sleep(long). It's not obvious how to easily
fix the latter. It seems like the easiest fix will be to check the class of
the object that's being waited on, and using TS_SLEEPING if it's a ThreadLock;
we already do similar in the stack dumping.

Change-Id: I83c0c54af1061e1678cefe7b07389dd10c2ea3d5
diff --git a/src/debugger.cc b/src/debugger.cc
index 4961edc..5a1b1ad 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -1375,10 +1375,12 @@
     return false;
   }
 
+  // TODO: if we're in Thread.sleep(long), we should return TS_SLEEPING,
+  // even if it's implemented using Object.wait(long).
   switch (thread->GetState()) {
   case Thread::kTerminated:   *pThreadStatus = JDWP::TS_ZOMBIE;   break;
   case Thread::kRunnable:     *pThreadStatus = JDWP::TS_RUNNING;  break;
-  case Thread::kTimedWaiting: *pThreadStatus = JDWP::TS_SLEEPING; break;
+  case Thread::kTimedWaiting: *pThreadStatus = JDWP::TS_WAIT;     break;
   case Thread::kBlocked:      *pThreadStatus = JDWP::TS_MONITOR;  break;
   case Thread::kWaiting:      *pThreadStatus = JDWP::TS_WAIT;     break;
   case Thread::kInitializing: *pThreadStatus = JDWP::TS_ZOMBIE;   break;
diff --git a/src/thread.h b/src/thread.h
index cd39794..4aa77dd 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -73,7 +73,7 @@
     // These correspond to JDWP states (but needn't share the same values).
     kTerminated   = 0,        // TS_ZOMBIE
     kRunnable     = 1,        // TS_RUNNING
-    kTimedWaiting = 2,        // TS_SLEEPING in Object.wait()
+    kTimedWaiting = 2,        // TS_WAIT in Object.wait() with a timeout
     kBlocked      = 3,        // TS_MONITOR on a monitor
     kWaiting      = 4,        // TS_WAIT in Object.wait()
     // Non-JDWP states.