diff options
author | 2019-11-21 16:40:06 -0800 | |
---|---|---|
committer | 2019-11-22 03:03:42 +0000 | |
commit | cb177da21e46df1ef58a537e87df0e042ed1418b (patch) | |
tree | f9a192a3949cc8d8f649865d1c7b5d30d539ea6a | |
parent | 78a44b9863cc88da3f546b39f9cf3081561b5c51 (diff) |
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
-rw-r--r-- | runtime/gc/collector/concurrent_copying.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc index 67383c4f36..b9118eca3f 100644 --- a/runtime/gc/collector/concurrent_copying.cc +++ b/runtime/gc/collector/concurrent_copying.cc @@ -954,15 +954,19 @@ void ConcurrentCopying::RemoveThreadMarkStackMapping(Thread* thread, } 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) { |