From: Dmitry Vyukov Date: Mon, 28 May 2012 07:46:42 +0000 (+0000) Subject: tsan: more robust detection of stack of main thread X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ebdf670ae7035123613b98420557797218befcfa;p=platform%2Fupstream%2Fllvm.git tsan: more robust detection of stack of main thread llvm-svn: 157568 --- diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc index 6bb62e4..9030649 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc @@ -274,6 +274,11 @@ void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size, 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 @@ void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size, 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;