Makes objects known to the debugger GC roots, implements the THST message, and lets DDMS request stack traces.
This fills out correct data in all columns of the "Threads" table, and
double-clicking on a thread shows that thread's stack.
Change-Id: I48f63c3612e12d35269158dc3a283f07db28c8e7
diff --git a/src/debugger.cc b/src/debugger.cc
index df32a51..2d9924d 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -50,6 +50,14 @@
return map_.find(id) != map_.end();
}
+ void VisitRoots(Heap::RootVisitor* visitor, void* arg) {
+ MutexLock mu(lock_);
+ typedef std::map<JDWP::ObjectId, Object*>::iterator It; // C++0x auto
+ for (It it = map_.begin(); it != map_.end(); ++it) {
+ visitor(it->second, arg);
+ }
+ }
+
private:
Mutex lock_;
std::map<JDWP::ObjectId, Object*> map_;
@@ -285,6 +293,12 @@
UNIMPLEMENTED(FATAL);
}
+void Dbg::VisitRoots(Heap::RootVisitor* visitor, void* arg) {
+ if (gRegistry != NULL) {
+ gRegistry->VisitRoots(visitor, arg);
+ }
+}
+
const char* Dbg::GetClassDescriptor(JDWP::RefTypeId id) {
UNIMPLEMENTED(FATAL);
return NULL;
@@ -781,7 +795,7 @@
}
}
-void DdmSendThreadStartCallback(Thread* t) {
+void DdmSendThreadStartCallback(Thread* t, void*) {
DdmSendThreadNotification(t, true);
}
@@ -793,7 +807,7 @@
gDdmThreadNotification = enable;
if (enable) {
- Runtime::Current()->GetThreadList()->ForEach(DdmSendThreadStartCallback);
+ Runtime::Current()->GetThreadList()->ForEach(DdmSendThreadStartCallback, NULL);
}
}