summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/msan/msan.cc
diff options
context:
space:
mode:
authorJulian Lettner <jlettner@apple.com>2019-02-27 22:16:02 +0000
committerJulian Lettner <jlettner@apple.com>2019-02-27 22:16:02 +0000
commita0884da62a471f08c65a03e337aea23203a43eb8 (patch)
treedfc44a82b399aa5f2b281a67dc42fcff7b4af2c5 /compiler-rt/lib/msan/msan.cc
parent6a198366a0cc214c8876620b6ea6f696620973f9 (diff)
downloadbcm5719-llvm-a0884da62a471f08c65a03e337aea23203a43eb8.tar.gz
bcm5719-llvm-a0884da62a471f08c65a03e337aea23203a43eb8.zip
[NFC][Sanitizer] Pull up GetStackTrace into sanitizer_common
We already independently declare GetStackTrace in all (except TSan) sanitizer runtime headers. Lets move it to sanitizer_stacktrace.h to have one canonical way to fill in a BufferedStackFrame. Also enables us to use it in sanitizer_common itself. This patch defines GetStackTrace for TSan and moves the function from ubsan_diag.cc to ubsan_diag_standalone.cc to avoid duplicate symbols for the UBSan-ASan runtime. Other than that this patch just moves the code out of headers and into the correct namespace. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58651 llvm-svn: 355039
Diffstat (limited to 'compiler-rt/lib/msan/msan.cc')
-rw-r--r--compiler-rt/lib/msan/msan.cc32
1 files changed, 17 insertions, 15 deletions
diff --git a/compiler-rt/lib/msan/msan.cc b/compiler-rt/lib/msan/msan.cc
index 25fe9104546..29d58c0a28c 100644
--- a/compiler-rt/lib/msan/msan.cc
+++ b/compiler-rt/lib/msan/msan.cc
@@ -221,21 +221,6 @@ static void InitializeFlags() {
if (f->store_context_size < 1) f->store_context_size = 1;
}
-void GetStackTrace(BufferedStackTrace *stack, uptr max_s, uptr pc, uptr bp,
- void *context, bool request_fast_unwind) {
- MsanThread *t = GetCurrentThread();
- if (!t || !StackTrace::WillUseFastUnwind(request_fast_unwind)) {
- // Block reports from our interceptors during _Unwind_Backtrace.
- SymbolizerScope sym_scope;
- return stack->Unwind(max_s, pc, bp, context, 0, 0, false);
- }
- if (StackTrace::WillUseFastUnwind(request_fast_unwind))
- stack->Unwind(max_s, pc, bp, nullptr, t->stack_top(), t->stack_bottom(),
- true);
- else
- stack->Unwind(max_s, pc, 0, context, 0, 0, false);
-}
-
void PrintWarning(uptr pc, uptr bp) {
PrintWarningWithOrigin(pc, bp, __msan_origin_tls);
}
@@ -316,6 +301,23 @@ u32 ChainOrigin(u32 id, StackTrace *stack) {
} // namespace __msan
+void __sanitizer::GetStackTrace(BufferedStackTrace *stack, uptr max_s, uptr pc,
+ uptr bp, void *context,
+ bool request_fast_unwind) {
+ using namespace __msan;
+ MsanThread *t = GetCurrentThread();
+ if (!t || !StackTrace::WillUseFastUnwind(request_fast_unwind)) {
+ // Block reports from our interceptors during _Unwind_Backtrace.
+ SymbolizerScope sym_scope;
+ return stack->Unwind(max_s, pc, bp, context, 0, 0, false);
+ }
+ if (StackTrace::WillUseFastUnwind(request_fast_unwind))
+ stack->Unwind(max_s, pc, bp, nullptr, t->stack_top(), t->stack_bottom(),
+ true);
+ else
+ stack->Unwind(max_s, pc, 0, context, 0, 0, false);
+}
+
// Interface.
using namespace __msan;
OpenPOWER on IntegriCloud