[llvm-commits] [compiler-rt] r160728 - in /compiler-rt/trunk/lib/tsan: go/buildgo.sh rtl/tsan_flags.cc rtl/tsan_rtl_report.cc

Dmitry Vyukov dvyukov at google.com
Wed Jul 25 07:30:51 PDT 2012


Author: dvyukov
Date: Wed Jul 25 09:30:51 2012
New Revision: 160728

URL: http://llvm.org/viewvc/llvm-project?rev=160728&view=rev
Log:
tsan: allow environment to override OnReport() and OverrideFlags()

Modified:
    compiler-rt/trunk/lib/tsan/go/buildgo.sh
    compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc

Modified: compiler-rt/trunk/lib/tsan/go/buildgo.sh
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/go/buildgo.sh?rev=160728&r1=160727&r2=160728&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/go/buildgo.sh (original)
+++ compiler-rt/trunk/lib/tsan/go/buildgo.sh Wed Jul 25 09:30:51 2012
@@ -48,6 +48,7 @@
         "
 fi
 
+SRCS+=$ADD_SRCS
 #ASMS="../rtl/tsan_rtl_amd64.S"
 
 rm -f gotsan.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc?rev=160728&r1=160727&r2=160728&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc Wed Jul 25 09:30:51 2012
@@ -24,9 +24,13 @@
 }
 
 // Can be overriden in frontend.
+#ifdef TSAN_EXTERNAL_HOOKS
+void OverrideFlags(Flags *f);
+#else
 void WEAK OverrideFlags(Flags *f) {
   (void)f;
 }
+#endif
 
 void InitializeFlags(Flags *f, const char *env) {
   internal_memset(f, 0, sizeof(*f));

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=160728&r1=160727&r2=160728&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Wed Jul 25 09:30:51 2012
@@ -38,10 +38,14 @@
 namespace __tsan {
 
 // Can be overriden by an application/test to intercept reports.
+#ifdef TSAN_EXTERNAL_HOOKS
+bool OnReport(const ReportDesc *rep, bool suppressed);
+#else
 bool WEAK OnReport(const ReportDesc *rep, bool suppressed) {
   (void)rep;
   return suppressed;
 }
+#endif
 
 static void StackStripMain(ReportStack *stack) {
   ReportStack *last_frame = 0;
@@ -50,12 +54,12 @@
   uptr prefix_len = internal_strlen(prefix);
   const char *path_prefix = flags()->strip_path_prefix;
   uptr path_prefix_len = internal_strlen(path_prefix);
+  char *pos;
   for (ReportStack *ent = stack; ent; ent = ent->next) {
     if (ent->func && 0 == internal_strncmp(ent->func, prefix, prefix_len))
       ent->func += prefix_len;
-    if (ent->file && 0 == internal_strncmp(ent->file, path_prefix,
-                                           path_prefix_len))
-      ent->file += path_prefix_len;
+    if (ent->file && (pos = internal_strstr(ent->file, path_prefix)))
+      ent->file = pos + path_prefix_len;
     if (ent->file && ent->file[0] == '.' && ent->file[1] == '/')
       ent->file += 2;
     last_frame2 = last_frame;





More information about the llvm-commits mailing list