Convert 'thread to mark-stack map empty' assertion into a CHECK
Using LOG(FATAL) doesn't print threads' headers, which is needed to
identify the thread(s) which has a mark-stack assigned.
Bug:144408451
Test: art/test/testrunner/testrunner.py --host
Change-Id: Ib273dd866e00f231ab67d9da7cad14659cbb7c6b
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index 67383c4..b9118ec 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -954,15 +954,19 @@
}
void ConcurrentCopying::AssertEmptyThreadMarkStackMap() {
- if (!thread_mark_stack_map_.empty()) {
- LOG(FATAL_WITHOUT_ABORT) << "thread_mark_stack_map not empty. size:"
- << thread_mark_stack_map_.size()
- << " Mappings:";
+ std::ostringstream oss;
+ auto capture_mappings = [this, &oss] () REQUIRES(mark_stack_lock_) {
for (const auto & iter : thread_mark_stack_map_) {
- LOG(FATAL_WITHOUT_ABORT) << "thread:" << iter.first << " mark-stack:" << iter.second;
+ oss << "thread:" << iter.first << " mark-stack:" << iter.second << "\n";
}
- LOG(FATAL) << "pooled_mark_stacks size:" << pooled_mark_stacks_.size();
- }
+ return oss.str();
+ };
+ CHECK(thread_mark_stack_map_.empty()) << "thread_mark_stack_map not empty. size:"
+ << thread_mark_stack_map_.size()
+ << "Mappings:\n"
+ << capture_mappings()
+ << "pooled_mark_stacks size:"
+ << pooled_mark_stacks_.size();
}
void ConcurrentCopying::AssertNoThreadMarkStackMapping(Thread* thread) {