Fail threads attaching during runtime shutdown.
Introduce counters to indicate that threads are being born. Don't allow
thread birth to occur during runtime shutdown.
Bug: 7000936
Change-Id: Ib0d78f78c0ff126a4b5d3b5a6f1a2ff8f5061ae9
diff --git a/src/debugger.cc b/src/debugger.cc
index 8477054..ee52984 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -1492,8 +1492,14 @@
// query all threads, so it's easier if we just don't tell them about this thread.
return;
}
- if (thread_group_ == NULL || t->GetThreadGroup(soa_) == thread_group_) {
- thread_ids_.push_back(gRegistry->Add(soa_.Decode<Object*>(t->GetPeer())));
+ bool should_add = (thread_group_ == NULL);
+ Object* peer = soa_.Decode<Object*>(t->GetPeer());
+ if (!should_add) {
+ Object* group = soa_.DecodeField(WellKnownClasses::java_lang_Thread_group)->GetObject(peer);
+ should_add = (group == thread_group_);
+ }
+ if (should_add) {
+ thread_ids_.push_back(gRegistry->Add(peer));
}
}