diff options
Diffstat (limited to 'runtime/runtime_linux.cc')
-rw-r--r-- | runtime/runtime_linux.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/runtime/runtime_linux.cc b/runtime/runtime_linux.cc index 73ac034633..da1b2cac14 100644 --- a/runtime/runtime_linux.cc +++ b/runtime/runtime_linux.cc @@ -24,11 +24,13 @@ #include "base/logging.h" #include "base/mutex.h" #include "base/stringprintf.h" -#include "thread.h" +#include "thread-inl.h" #include "utils.h" namespace art { +static constexpr bool kDumpHeapObjectOnSigsevg = false; + struct Backtrace { void Dump(std::ostream& os) { DumpNativeStack(os, GetTid(), "\t", true); @@ -305,7 +307,15 @@ void HandleUnexpectedSignal(int signal_number, siginfo_t* info, void* raw_contex << "Thread: " << tid << " \"" << thread_name << "\"\n" << "Registers:\n" << Dumpable<UContext>(thread_context) << "\n" << "Backtrace:\n" << Dumpable<Backtrace>(thread_backtrace); - + Runtime* runtime = Runtime::Current(); + if (runtime != nullptr) { + gc::Heap* heap = runtime->GetHeap(); + LOG(INTERNAL_FATAL) << "Fault message: " << runtime->GetFaultMessage(); + if (kDumpHeapObjectOnSigsevg && heap != nullptr && info != nullptr) { + LOG(INTERNAL_FATAL) << "Dump heap object at fault address: "; + heap->DumpObject(LOG(INTERNAL_FATAL), reinterpret_cast<mirror::Object*>(info->si_addr)); + } + } if (getenv("debug_db_uid") != NULL || getenv("art_wait_for_gdb_on_crash") != NULL) { LOG(INTERNAL_FATAL) << "********************************************************\n" << "* Process " << getpid() << " thread " << tid << " \"" << thread_name << "\"" |