[llvm-commits] [compiler-rt] r157568 - /compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc

Dmitry Vyukov dvyukov at google.com
Mon May 28 00:46:42 PDT 2012


Author: dvyukov
Date: Mon May 28 02:46:42 2012
New Revision: 157568

URL: http://llvm.org/viewvc/llvm-project?rev=157568&view=rev
Log:
tsan: more robust detection of stack of main thread

Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc?rev=157568&r1=157567&r2=157568&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc Mon May 28 02:46:42 2012
@@ -274,6 +274,11 @@
       Printf("Can't find [stack] in /proc/self/maps\n");
       Die();
     }
+    pos = (char*)internal_strchr(pos, '-');
+    if (pos == 0) {
+      Printf("Can't find [stack] in /proc/self/maps\n");
+      Die();
+    }
     uptr stack = 0;
     for (; pos++;) {
       uptr num = 0;
@@ -290,8 +295,7 @@
 
     struct rlimit rl;
     CHECK_EQ(getrlimit(RLIMIT_STACK, &rl), 0);
-
-    *stk_addr = stack;
+    *stk_addr = stack - rl.rlim_cur;
     *stk_size = rl.rlim_cur;
   } else {
     *stk_addr = 0;





More information about the llvm-commits mailing list