diff options
| author | 2014-06-28 00:35:04 +0000 | |
|---|---|---|
| committer | 2014-06-27 16:59:53 +0000 | |
| commit | 3db4f0922ea9bf931a2393476278c8b18f852c9e (patch) | |
| tree | f34e571fe6d0357d2c068707476c9f4bdb5684d7 | |
| parent | 2789dd9d3469a284f21a5363c3d145b09a37a73c (diff) | |
| parent | 4e14e721055eeeb42b06ad231bce930f3e1c1728 (diff) | |
Merge "Avoid segvs if LOG(FATAL) is called during runtime start-up."
| -rw-r--r-- | runtime/runtime.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 8aa7ea18d1..53ddcca469 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -241,16 +241,22 @@ struct AbortState { } void DumpAllThreads(std::ostream& os, Thread* self) NO_THREAD_SAFETY_ANALYSIS { - bool tll_already_held = Locks::thread_list_lock_->IsExclusiveHeld(self); - bool ml_already_held = Locks::mutator_lock_->IsSharedHeld(self); - if (!tll_already_held || !ml_already_held) { - os << "Dumping all threads without appropriate locks held:" - << (!tll_already_held ? " thread list lock" : "") - << (!ml_already_held ? " mutator lock" : "") - << "\n"; + Runtime* runtime = Runtime::Current(); + if (runtime != nullptr) { + ThreadList* thread_list = runtime->GetThreadList(); + if (thread_list != nullptr) { + bool tll_already_held = Locks::thread_list_lock_->IsExclusiveHeld(self); + bool ml_already_held = Locks::mutator_lock_->IsSharedHeld(self); + if (!tll_already_held || !ml_already_held) { + os << "Dumping all threads without appropriate locks held:" + << (!tll_already_held ? " thread list lock" : "") + << (!ml_already_held ? " mutator lock" : "") + << "\n"; + } + os << "All threads:\n"; + thread_list->DumpLocked(os); + } } - os << "All threads:\n"; - Runtime::Current()->GetThreadList()->DumpLocked(os); } }; |