summaryrefslogtreecommitdiff
path: root/lib/tsan/rtl/tsan_rtl_mutex.cc
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2014-03-19 12:26:33 +0000
committerKostya Serebryany <kcc@google.com>2014-03-19 12:26:33 +0000
commit8ee651d7de366459e94ccb58e51864e41523457d (patch)
treef2a0957455d0aeb8e09de5cbc6f60c246ef89664 /lib/tsan/rtl/tsan_rtl_mutex.cc
parent82f9d9ca7a7c9b2521389a7c6bb9994275560d44 (diff)
[sanitizer] deadlock detector: a) initial support for suppressions, b) be more robust in case we failed to extract a stack trace for one of the locks
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204225 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/rtl/tsan_rtl_mutex.cc')
-rw-r--r--lib/tsan/rtl/tsan_rtl_mutex.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/tsan/rtl/tsan_rtl_mutex.cc b/lib/tsan/rtl/tsan_rtl_mutex.cc
index 8398e4b45..ab083ab29 100644
--- a/lib/tsan/rtl/tsan_rtl_mutex.cc
+++ b/lib/tsan/rtl/tsan_rtl_mutex.cc
@@ -428,17 +428,25 @@ void ReportDeadlock(ThreadState *thr, uptr pc, DDReport *r) {
for (int i = 0; i < r->n; i++)
rep.AddMutex(r->loop[i].mtx_ctx0);
StackTrace stacks[2 * DDReport::kMaxLoopSize];
+ uptr dummy_pc = 0x42;
for (int i = 0; i < r->n; i++) {
uptr size;
for (int j = 0; j < 2; j++) {
u32 stk = r->loop[i].stk[j];
- if (!stk) continue;
- const uptr *trace = StackDepotGet(stk, &size);
- stacks[i].Init(const_cast<uptr *>(trace), size);
+ if (stk) {
+ const uptr *trace = StackDepotGet(stk, &size);
+ stacks[i].Init(const_cast<uptr *>(trace), size);
+ } else {
+ // Sometimes we fail to extract the stack trace (FIXME: investigate),
+ // but we should still produce some stack trace in the report.
+ stacks[i].Init(&dummy_pc, 1);
+ }
rep.AddStack(&stacks[i]);
}
}
- OutputReport(ctx, rep);
+ // FIXME: use all stacks for suppressions, not just the second stack of the
+ // first edge.
+ OutputReport(ctx, rep, rep.GetReport()->stacks[1]);
#endif // TSAN_GO
}