summaryrefslogtreecommitdiff
path: root/lib/tsan/rtl/tsan_sync.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2012-09-06 15:18:14 +0000
committerDmitry Vyukov <dvyukov@google.com>2012-09-06 15:18:14 +0000
commit0ab628c61594eb80612e5389d9c33da0e0d70c66 (patch)
tree7a318bfe3e35cb740a2f505ead6cfee305b656e2 /lib/tsan/rtl/tsan_sync.cc
parentdd5a237b06a6fdd29e632a8a0966792a54664d00 (diff)
tsan: increase max shadow stack size + reduce memory consumption at the same time (by not memorizing full stacks in traces)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@163322 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/rtl/tsan_sync.cc')
-rw-r--r--lib/tsan/rtl/tsan_sync.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/tsan/rtl/tsan_sync.cc b/lib/tsan/rtl/tsan_sync.cc
index 86265bb81..642d1b2ea 100644
--- a/lib/tsan/rtl/tsan_sync.cc
+++ b/lib/tsan/rtl/tsan_sync.cc
@@ -236,15 +236,19 @@ void StackTrace::ObtainCurrent(ThreadState *thr, uptr toppc) {
n_ = thr->shadow_stack_pos - thr->shadow_stack;
if (n_ + !!toppc == 0)
return;
+ uptr start = 0;
if (c_) {
CHECK_NE(s_, 0);
- CHECK_LE(n_ + !!toppc, c_);
+ if (n_ + !!toppc > c_) {
+ start = n_ - c_ + !!toppc;
+ n_ = c_ - !!toppc;
+ }
} else {
s_ = (uptr*)internal_alloc(MBlockStackTrace,
(n_ + !!toppc) * sizeof(s_[0]));
}
for (uptr i = 0; i < n_; i++)
- s_[i] = thr->shadow_stack[i];
+ s_[i] = thr->shadow_stack[start + i];
if (toppc) {
s_[n_] = toppc;
n_++;