diff options
| -rw-r--r-- | runtime/native_stack_dump.cc | 4 | ||||
| -rw-r--r-- | runtime/native_stack_dump.h | 3 | ||||
| -rw-r--r-- | runtime/runtime_common.h | 4 |
3 files changed, 8 insertions, 3 deletions
diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc index c26c26e544..0db1770eea 100644 --- a/runtime/native_stack_dump.cc +++ b/runtime/native_stack_dump.cc @@ -287,7 +287,8 @@ void DumpNativeStack(std::ostream& os, BacktraceMap* existing_map, const char* prefix, ArtMethod* current_method, - void* ucontext_ptr) { + void* ucontext_ptr, + bool skip_frames) { // b/18119146 if (RUNNING_ON_MEMORY_TOOL != 0) { return; @@ -300,6 +301,7 @@ void DumpNativeStack(std::ostream& os, map = tmp_map.get(); } std::unique_ptr<Backtrace> backtrace(Backtrace::Create(BACKTRACE_CURRENT_PROCESS, tid, map)); + backtrace->SetSkipFrames(skip_frames); if (!backtrace->Unwind(0, reinterpret_cast<ucontext*>(ucontext_ptr))) { os << prefix << "(backtrace::Unwind failed for thread " << tid << ": " << backtrace->GetErrorString(backtrace->GetError()) << ")" << std::endl; diff --git a/runtime/native_stack_dump.h b/runtime/native_stack_dump.h index d64bc824a5..ad4bfab0e9 100644 --- a/runtime/native_stack_dump.h +++ b/runtime/native_stack_dump.h @@ -35,7 +35,8 @@ void DumpNativeStack(std::ostream& os, BacktraceMap* map = nullptr, const char* prefix = "", ArtMethod* current_method = nullptr, - void* ucontext = nullptr) + void* ucontext = nullptr, + bool skip_frames = true) NO_THREAD_SAFETY_ANALYSIS; // Dumps the kernel stack for thread 'tid' to 'os'. Note that this is only available on linux-x86. diff --git a/runtime/runtime_common.h b/runtime/runtime_common.h index 3fba441b55..698d0603ee 100644 --- a/runtime/runtime_common.h +++ b/runtime/runtime_common.h @@ -40,7 +40,9 @@ struct Backtrace { public: explicit Backtrace(void* raw_context) : raw_context_(raw_context) {} void Dump(std::ostream& os) const { - DumpNativeStack(os, GetTid(), nullptr, "\t", nullptr, raw_context_); + // This is a backtrace from a crash, do not skip any frames in case the + // crash is in the unwinder itself. + DumpNativeStack(os, GetTid(), nullptr, "\t", nullptr, raw_context_, false); } private: // Stores the context of the signal that was unexpected and will terminate the runtime. The |