++msan_report_count;
- StackTrace stack;
- GetStackTrace(&stack, kStackTraceMax, pc, bp,
- common_flags()->fast_unwind_on_fatal);
+ GET_FATAL_STACK_TRACE_PC_BP(pc, bp);
u32 report_origin =
(__msan_get_track_origins() && OriginIsValid(origin)) ? origin : 0;
} else if (!msan_expected_umr_found) {
GET_CALLER_PC_BP_SP;
(void)sp;
- StackTrace stack;
- GetStackTrace(&stack, kStackTraceMax, pc, bp,
- common_flags()->fast_unwind_on_fatal);
+ GET_FATAL_STACK_TRACE_PC_BP(pc, bp);
ReportExpectedUMRNotFound(&stack);
Die();
}
const char* __msan_default_options() { return ""; }
} // extern "C"
#endif
+
+extern "C" {
+SANITIZER_INTERFACE_ATTRIBUTE
+void __sanitizer_print_stack_trace() {
+ GET_FATAL_STACK_TRACE_PC_BP(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME());
+ stack.Print();
+}
+} // extern "C"
GetStackTrace(&stack, common_flags()->malloc_context_size, pc, bp, \
common_flags()->fast_unwind_on_malloc)
+#define GET_FATAL_STACK_TRACE_PC_BP(pc, bp) \
+ StackTrace stack; \
+ stack.size = 0; \
+ if (msan_inited) \
+ GetStackTrace(&stack, kStackTraceMax, pc, bp, \
+ common_flags()->fast_unwind_on_fatal)
+
#define GET_STORE_STACK_TRACE \
GET_STORE_STACK_TRACE_PC_BP(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME())
+++ /dev/null
-// RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %s -o %t && %run %t 2>&1 | FileCheck %s
-
-#include <sanitizer/asan_interface.h>
-
-void FooBarBaz() {
- __sanitizer_print_stack_trace();
-}
-
-int main() {
- FooBarBaz();
- return 0;
-}
-// CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}}
-// CHECK: {{ #1 0x.* in FooBarBaz\(\) .*print-stack-trace.cc:7}}
-// CHECK: {{ #2 0x.* in main .*print-stack-trace.cc:11}}
--- /dev/null
+// RUN: %clangxx -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx -O3 %s -o %t && %run %t 2>&1 | FileCheck %s
+//
+// Not yet implemented for TSan.
+// https://code.google.com/p/address-sanitizer/issues/detail?id=243
+// XFAIL: tsan
+
+#include <sanitizer/common_interface_defs.h>
+
+void FooBarBaz() {
+ __sanitizer_print_stack_trace();
+}
+
+int main() {
+ FooBarBaz();
+ return 0;
+}
+// CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}}
+// CHECK: {{ #1 0x.* in FooBarBaz\(\) .*print-stack-trace.cc:11}}
+// CHECK: {{ #2 0x.* in main.*print-stack-trace.cc:15}}
else:
lit_config.fatal("Unknown tool for sanitizer_common tests: %r" % config.tool_name)
+config.available_features.add(config.tool_name)
+
clang_cflags = ["-g"] + tool_cflags + [config.target_cflags]
clang_cxxflags = config.cxx_mode_flags + clang_cflags