Implement a bit more debugger functionality.
This fixes the deadlock by making SuspendSelfForDebugger not take the thread
list lock, making it more like the equivalent code in dalvikvm.
There's also some code cleanup, and a few more of the JDWP calls jdb makes
on startup. By fixing the deadlock, attaching jdb now causes us to hit
unimplemented code relating to thread stacks. That's tomorrow's job...
Change-Id: I7eac1b95946228fa60666587ff8766bcabb28bb1
diff --git a/src/debugger.cc b/src/debugger.cc
index cdb17d3..43448d8 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -645,14 +645,18 @@
return 0;
}
+Thread* DecodeThread(JDWP::ObjectId threadId) {
+ Object* thread_peer = gRegistry->Get<Object*>(threadId);
+ CHECK(thread_peer != NULL);
+ return Thread::FromManagedThread(thread_peer);
+}
+
bool Dbg::ThreadExists(JDWP::ObjectId threadId) {
- UNIMPLEMENTED(FATAL);
- return false;
+ return DecodeThread(threadId) != NULL;
}
bool Dbg::IsSuspended(JDWP::ObjectId threadId) {
- UNIMPLEMENTED(FATAL);
- return false;
+ return DecodeThread(threadId)->IsSuspended();
}
//void Dbg::WaitForSuspend(JDWP::ObjectId threadId);