[Sanitizer] factor out GetThreadStackTopAndBottom from ASan runtime to common.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158140 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/asan/asan_thread.cc b/lib/asan/asan_thread.cc
index da397bb..d301a4b 100644
--- a/lib/asan/asan_thread.cc
+++ b/lib/asan/asan_thread.cc
@@ -18,6 +18,7 @@
#include "asan_thread.h"
#include "asan_thread_registry.h"
#include "asan_mapping.h"
+#include "sanitizer_common/sanitizer_common.h"
namespace __asan {
@@ -101,6 +102,12 @@
return res;
}
+void AsanThread::SetThreadStackTopAndBottom() {
+ GetThreadStackTopAndBottom(tid() == 0, &stack_top_, &stack_bottom_);
+ int local;
+ CHECK(AddrIsInStack((uptr)&local));
+}
+
void AsanThread::ClearShadowForThreadStack() {
PoisonShadow(stack_bottom_, stack_top_ - stack_bottom_, 0);
}