tsan: add a hook to obtain number of reports
authorDmitry Vyukov <dvyukov@google.com>
Fri, 28 Oct 2016 21:25:37 +0000 (21:25 +0000)
committerDmitry Vyukov <dvyukov@google.com>
Fri, 28 Oct 2016 21:25:37 +0000 (21:25 +0000)
Requested in:
https://github.com/golang/go/issues/15972
Will help to fail individual test cases with races.

llvm-svn: 285455

compiler-rt/lib/tsan/go/tsan_go.cc

index bc0d553..34625c8 100644 (file)
@@ -271,6 +271,11 @@ void __tsan_go_ignore_sync_end(ThreadState *thr) {
   ThreadIgnoreSyncEnd(thr, 0);
 }
 
+void __tsan_report_count(u64 *pn) {
+  Lock lock(&ctx->report_mtx);
+  *pn = ctx->nreported;
+}
+
 }  // extern "C"
 }  // namespace __tsan