Implement ThreadContinuing and detach the JDWP thread before it exits.

This fixes Calculator.

Change-Id: Ic38e234a91469e9694e21bbf1507912b542bf908
diff --git a/src/debugger.cc b/src/debugger.cc
index f8b52bc..7c26bd0 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -212,9 +212,8 @@
   return static_cast<int>(Thread::Current()->SetState(Thread::kVmWait));
 }
 
-int Dbg::ThreadContinuing(int status) {
-  UNIMPLEMENTED(FATAL);
-  return 0;
+int Dbg::ThreadContinuing(int new_state) {
+  return static_cast<int>(Thread::Current()->SetState(static_cast<Thread::State>(new_state)));
 }
 
 void Dbg::UndoDebuggerSuspensions() {
diff --git a/src/jdwp/jdwp_main.cc b/src/jdwp/jdwp_main.cc
index 31337fd..a7857a1 100644
--- a/src/jdwp/jdwp_main.cc
+++ b/src/jdwp/jdwp_main.cc
@@ -383,7 +383,8 @@
   /* back to running, for thread shutdown */
   Dbg::ThreadRunning();
 
-  LOG(VERBOSE) << "JDWP: thread exiting";
+  LOG(VERBOSE) << "JDWP: thread detaching and exiting...";
+  runtime->DetachCurrentThread();
 }
 
 pthread_t JdwpState::GetDebugThread() {