diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2013-01-29 14:20:12 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2013-01-29 14:20:12 +0000 |
commit | 793e7610934531fa014aa2c0721d7901bdbae548 (patch) | |
tree | 9b6b0b0b10bfa43a71e7a921331782d581b077ee /lib/tsan/rtl/tsan_rtl_report.cc | |
parent | 31c05ea4d508a476403ba30c1f60ef6190eb46b6 (diff) | |
download | compiler-rt-793e7610934531fa014aa2c0721d7901bdbae548.tar.gz compiler-rt-793e7610934531fa014aa2c0721d7901bdbae548.tar.bz2 compiler-rt-793e7610934531fa014aa2c0721d7901bdbae548.tar.xz |
tsan: dump stack on internal assert failure
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173799 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/rtl/tsan_rtl_report.cc')
-rw-r--r-- | lib/tsan/rtl/tsan_rtl_report.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/tsan/rtl/tsan_rtl_report.cc b/lib/tsan/rtl/tsan_rtl_report.cc index c58455df..d28c69db 100644 --- a/lib/tsan/rtl/tsan_rtl_report.cc +++ b/lib/tsan/rtl/tsan_rtl_report.cc @@ -15,6 +15,7 @@ #include "sanitizer_common/sanitizer_placement_new.h" #include "sanitizer_common/sanitizer_stackdepot.h" #include "sanitizer_common/sanitizer_common.h" +#include "sanitizer_common/sanitizer_stacktrace.h" #include "tsan_platform.h" #include "tsan_rtl.h" #include "tsan_suppressions.h" @@ -29,12 +30,15 @@ namespace __tsan { using namespace __sanitizer; // NOLINT +static ReportStack *SymbolizeStack(const StackTrace& trace); + void TsanCheckFailed(const char *file, int line, const char *cond, u64 v1, u64 v2) { ScopedInRtl in_rtl; Printf("FATAL: ThreadSanitizer CHECK failed: " "%s:%d \"%s\" (0x%zx, 0x%zx)\n", file, line, cond, (uptr)v1, (uptr)v2); + PrintCurrentStackSlow(); Die(); } @@ -614,4 +618,16 @@ void PrintCurrentStack(ThreadState *thr, uptr pc) { PrintStack(SymbolizeStack(trace)); } +void PrintCurrentStackSlow() { +#ifndef TSAN_GO + __sanitizer::StackTrace *ptrace = new(internal_alloc(MBlockStackTrace, + sizeof(__sanitizer::StackTrace))) __sanitizer::StackTrace; + ptrace->SlowUnwindStack(__sanitizer::StackTrace::GetCurrentPc(), + kStackTraceMax); + StackTrace trace; + trace.Init(ptrace->trace, ptrace->size); + PrintStack(SymbolizeStack(trace)); +#endif +} + } // namespace __tsan |