summaryrefslogtreecommitdiff
path: root/libsanitizer
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-13 17:01:30 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-13 17:01:30 +0000
commita36fdeb039266f65e21a97e02e28b75b3a3a0517 (patch)
tree9b002e56f585cf7c0a09e33bccf6247735ae68b9 /libsanitizer
parent313079546d70b1716787b71332a426e9e8166995 (diff)
downloadgcc-a36fdeb039266f65e21a97e02e28b75b3a3a0517.tar.gz
* sanitizer_common/sanitizer_deadlock_detector.h: Cherry pick
upstream r224518 and r224519. * tsan/tsan_rtl_thread.cc: Cherry pick upstream r224702 and r224834. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219545 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libsanitizer')
-rw-r--r--libsanitizer/ChangeLog7
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_deadlock_detector.h6
-rw-r--r--libsanitizer/tsan/tsan_rtl_thread.cc9
3 files changed, 17 insertions, 5 deletions
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 8b2eb82bbde..ab22345b113 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-13 Jakub Jelinek <jakub@redhat.com>
+
+ * sanitizer_common/sanitizer_deadlock_detector.h: Cherry pick
+ upstream r224518 and r224519.
+ * tsan/tsan_rtl_thread.cc: Cherry pick upstream r224702 and
+ r224834.
+
2014-12-16 Jakub Jelinek <jakub@redhat.com>
* sanitizer_common/sanitizer_symbolizer_libbacktrace.cc,
diff --git a/libsanitizer/sanitizer_common/sanitizer_deadlock_detector.h b/libsanitizer/sanitizer_common/sanitizer_deadlock_detector.h
index 949c486a14a..5c8317554ad 100644
--- a/libsanitizer/sanitizer_common/sanitizer_deadlock_detector.h
+++ b/libsanitizer/sanitizer_common/sanitizer_deadlock_detector.h
@@ -48,6 +48,8 @@ class DeadlockDetectorTLS {
if (epoch_ == current_epoch) return;
bv_.clear();
epoch_ = current_epoch;
+ n_recursive_locks = 0;
+ n_all_locks_ = 0;
}
uptr getEpoch() const { return epoch_; }
@@ -81,7 +83,8 @@ class DeadlockDetectorTLS {
}
}
// Printf("remLock: %zx %zx\n", lock_id, epoch_);
- CHECK(bv_.clearBit(lock_id));
+ if (!bv_.clearBit(lock_id))
+ return; // probably addLock happened before flush
if (n_all_locks_) {
for (sptr i = n_all_locks_ - 1; i >= 0; i--) {
if (all_locks_with_contexts_[i].lock == static_cast<u32>(lock_id)) {
@@ -173,6 +176,7 @@ class DeadlockDetector {
recycled_nodes_.clear();
available_nodes_.setAll();
g_.clear();
+ n_edges_ = 0;
return getAvailableNode(data);
}
diff --git a/libsanitizer/tsan/tsan_rtl_thread.cc b/libsanitizer/tsan/tsan_rtl_thread.cc
index 0c0acc2787f..d75445aa8bb 100644
--- a/libsanitizer/tsan/tsan_rtl_thread.cc
+++ b/libsanitizer/tsan/tsan_rtl_thread.cc
@@ -109,12 +109,13 @@ void ThreadContext::OnStarted(void *arg) {
thr->dd_pt = ctx->dd->CreatePhysicalThread();
thr->dd_lt = ctx->dd->CreateLogicalThread(unique_id);
}
+ thr->fast_state.SetHistorySize(flags()->history_size);
+ // Commit switch to the new part of the trace.
+ // TraceAddEvent will reset stack0/mset0 in the new part for us.
+ TraceAddEvent(thr, thr->fast_state, EventTypeMop, 0);
+
thr->fast_synch_epoch = epoch0;
AcquireImpl(thr, 0, &sync);
- thr->fast_state.SetHistorySize(flags()->history_size);
- const uptr trace = (epoch0 / kTracePartSize) % TraceParts();
- Trace *thr_trace = ThreadTrace(thr->tid);
- thr_trace->headers[trace].epoch0 = epoch0;
StatInc(thr, StatSyncAcquire);
sync.Reset(&thr->clock_cache);
DPrintf("#%d: ThreadStart epoch=%zu stk_addr=%zx stk_size=%zx "