diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc @@ -49,6 +49,7 @@ static inline uhwptr *GetCanonicFrame(uptr bp, uptr stack_top, uptr stack_bottom) { + CHECK_GT(stack_top, stack_bottom); #ifdef __arm__ if (!IsValidFrame(bp, stack_top, stack_bottom)) return 0; uhwptr *bp_prev = (uhwptr *)bp; diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc @@ -729,10 +729,17 @@ ALWAYS_INLINE void PrintCurrentStackSlow(uptr pc) { #if !SANITIZER_GO + uptr bp = 0; + uptr top = 0; + uptr bottom = 0; + if (__sanitizer::StackTrace::WillUseFastUnwind(false)) { + bp = GET_CURRENT_FRAME(); + __sanitizer::GetThreadStackTopAndBottom(false, &top, &bottom); + } BufferedStackTrace *ptrace = new(internal_alloc(MBlockStackTrace, sizeof(BufferedStackTrace))) BufferedStackTrace(); - ptrace->Unwind(kStackTraceMax, pc, 0, 0, 0, 0, false); + ptrace->Unwind(kStackTraceMax, pc, bp, nullptr, top, bottom, false); for (uptr i = 0; i < ptrace->size / 2; i++) { uptr tmp = ptrace->trace_buffer[i]; ptrace->trace_buffer[i] = ptrace->trace_buffer[ptrace->size - i - 1]; diff --git a/compiler-rt/lib/ubsan/ubsan_diag_standalone.cc b/compiler-rt/lib/ubsan/ubsan_diag_standalone.cc --- a/compiler-rt/lib/ubsan/ubsan_diag_standalone.cc +++ b/compiler-rt/lib/ubsan/ubsan_diag_standalone.cc @@ -22,7 +22,7 @@ uptr top = 0; uptr bottom = 0; bool request_fast_unwind = common_flags()->fast_unwind_on_fatal; - if (request_fast_unwind) + if (__sanitizer::StackTrace::WillUseFastUnwind(request_fast_unwind)) __sanitizer::GetThreadStackTopAndBottom(false, &top, &bottom); GET_CURRENT_PC_BP_SP; diff --git a/compiler-rt/test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc b/compiler-rt/test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc --- a/compiler-rt/test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc @@ -1,8 +1,8 @@ // RUN: %clangxx -O0 %s -o %t && %env_tool_opts=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s // RUN: %env_tool_opts=stack_trace_format='"frame:%n lineno:%l"' %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM -// FIXME(dliew): Make this test work with other sanitizers -// XFAIL: darwin && (lsan || tsan || ubsan) +// FIXME(dliew): Make this test work on Darwin with LSan +// XFAIL: darwin && lsan #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc b/compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc --- a/compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc @@ -2,8 +2,8 @@ // Test that symbolizer does not crash on frame with large function name. -// FIXME(dliew): Make this test work with the other sanitizers. -// XFAIL: darwin && (lsan || tsan || ubsan) +// FIXME(dliew): Make this test work on Darwin with LSan +// XFAIL: darwin && lsan #include #include