[PATCH] D58156: [Sanitizer] On Darwin `__sanitizer_print_stack_trace` only prints topmost frame
Julian Lettner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 18 10:47:49 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL354282: [Sanitizer] On Darwin `__sanitizer_print_stack_trace` only prints topmost frame (authored by yln, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D58156?vs=186556&id=187262#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58156/new/
https://reviews.llvm.org/D58156
Files:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
compiler-rt/trunk/lib/ubsan/ubsan_diag_standalone.cc
compiler-rt/trunk/test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc
compiler-rt/trunk/test/sanitizer_common/TestCases/symbolize_stack.cc
Index: compiler-rt/trunk/test/sanitizer_common/TestCases/symbolize_stack.cc
===================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/symbolize_stack.cc
+++ compiler-rt/trunk/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 <sanitizer/common_interface_defs.h>
#include <vector>
Index: compiler-rt/trunk/test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc
===================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc
+++ compiler-rt/trunk/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 <sanitizer/common_interface_defs.h>
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
+++ compiler-rt/trunk/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;
Index: compiler-rt/trunk/lib/ubsan/ubsan_diag_standalone.cc
===================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_diag_standalone.cc
+++ compiler-rt/trunk/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;
Index: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
===================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
+++ compiler-rt/trunk/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];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58156.187262.patch
Type: text/x-patch
Size: 3581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190218/3343ea86/attachment.bin>
More information about the llvm-commits
mailing list