[llvm-commits] [compiler-rt] r157760 - in /compiler-rt/trunk/lib/tsan/rtl: tsan_interceptors.cc tsan_stat.cc tsan_stat.h

Dmitry Vyukov dvyukov at google.com
Thu May 31 11:03:59 PDT 2012


Author: dvyukov
Date: Thu May 31 13:03:59 2012
New Revision: 157760

URL: http://llvm.org/viewvc/llvm-project?rev=157760&view=rev
Log:
tsan: intercept longjmp() but die in it, greatly simplifies problem diagnostic

Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_stat.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=157760&r1=157759&r2=157760&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Thu May 31 13:03:59 2012
@@ -235,6 +235,18 @@
   return 0;
 }
 
+TSAN_INTERCEPTOR(void, longjmp, void *env, int val) {
+  SCOPED_TSAN_INTERCEPTOR(longjmp, env, val);
+  Printf("ThreadSanitizer: longjmp() is not supported\n");
+  Die();
+}
+
+TSAN_INTERCEPTOR(void, siglongjmp, void *env, int val) {
+  SCOPED_TSAN_INTERCEPTOR(siglongjmp, env, val);
+  Printf("ThreadSanitizer: siglongjmp() is not supported\n");
+  Die();
+}
+
 static uptr fd2addr(int fd) {
   (void)fd;
   static u64 addr;
@@ -1370,6 +1382,9 @@
   REAL(memset) = poormans_memset;
   REAL(memcpy) = poormans_memcpy;
 
+  TSAN_INTERCEPT(longjmp);
+  TSAN_INTERCEPT(siglongjmp);
+
   TSAN_INTERCEPT(malloc);
   TSAN_INTERCEPT(calloc);
   TSAN_INTERCEPT(realloc);

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_stat.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_stat.cc?rev=157760&r1=157759&r2=157760&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_stat.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_stat.cc Thu May 31 13:03:59 2012
@@ -91,6 +91,8 @@
   name[StatAtomic8]                      = "            size 8                ";
 
   name[StatInterceptor]                  = "Interceptors                      ";
+  name[StatInt_longjmp]                  = "  longjmp                         ";
+  name[StatInt_siglongjmp]               = "  siglongjmp                      ";
   name[StatInt_malloc]                   = "  malloc                          ";
   name[StatInt_calloc]                   = "  calloc                          ";
   name[StatInt_realloc]                  = "  realloc                         ";

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h?rev=157760&r1=157759&r2=157760&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h Thu May 31 13:03:59 2012
@@ -91,6 +91,8 @@
 
   // Interceptors.
   StatInterceptor,
+  StatInt_longjmp,
+  StatInt_siglongjmp,
   StatInt_malloc,
   StatInt_calloc,
   StatInt_realloc,





More information about the llvm-commits mailing list