diff options
| author | Kostya Serebryany <kcc@google.com> | 2014-03-17 09:07:24 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2014-03-17 09:07:24 +0000 |
| commit | d674e6bdde6e948daef2b14ebf3a17811eee9c87 (patch) | |
| tree | 79455388521754afc7d71b3d3746883494bbe27f /compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc | |
| parent | ba41a739937e40af3119255dc06d42d06d58f2e2 (diff) | |
| download | bcm5719-llvm-d674e6bdde6e948daef2b14ebf3a17811eee9c87.tar.gz bcm5719-llvm-d674e6bdde6e948daef2b14ebf3a17811eee9c87.zip | |
[sanitizer] print more stack traces when reporting a deadlock (even more to come)
llvm-svn: 204034
Diffstat (limited to 'compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc')
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc index 185c163a8a9..91762f8566a 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include <sanitizer_common/sanitizer_deadlock_detector_interface.h> +#include <sanitizer_common/sanitizer_stackdepot.h> #include "tsan_rtl.h" #include "tsan_flags.h" @@ -425,6 +426,14 @@ void ReportDeadlock(ThreadState *thr, uptr pc, DDReport *r) { ScopedReport rep(ReportTypeDeadlock); for (int i = 0; i < r->n; i++) rep.AddMutex(r->loop[i].mtx_ctx0); + StackTrace stacks[ARRAY_SIZE(DDReport::loop)]; + for (int i = 0; i < r->n; i++) { + if (!r->loop[i].stk) continue; + uptr size; + const uptr *trace = StackDepotGet(r->loop[i].stk, &size); + stacks[i].Init(const_cast<uptr *>(trace), size); + rep.AddStack(&stacks[i]); + } StackTrace trace; trace.ObtainCurrent(thr, pc); rep.AddStack(&trace); |

