forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ubsan] Fix print_stacktrace=1:fast_unwind_on_fatal=0 to correctly fa…
…llback to fast unwinder ubsan_GetStackTrace (from 52b7510) called by ~ScopeReport leaves top/bottom zeroes in the `!WillUseFastUnwind(request_fast_unwind)` code path. When BufferedStackTrace::Unwind falls back to UnwindFast, `if (stack_top < 4096) return;` will return early, leaving just one frame in the stack trace. Fix this by always initializing top/bottom like 261d6e0. Reviewed By: eugenis, yln Differential Revision: https://reviews.llvm.org/D123562
- Loading branch information
Showing
2 changed files
with
27 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
compiler-rt/test/ubsan/TestCases/Misc/Linux/diag-stacktrace.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// Fast unwinder does not work with Thumb code | ||
// UNSUPPORTED: thumb | ||
|
||
// RUN: %clangxx -fsanitize=return %gmlt -O2 -fno-omit-frame-pointer -fasynchronous-unwind-tables %s -o %t | ||
// RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=0 not %run %t 2>&1 | FileCheck %s | ||
// RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=1 not %run %t 2>&1 | FileCheck %s | ||
// RUN: %clangxx -fsanitize=return %gmlt -O2 -fno-omit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %s -o %t | ||
// RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=0 not %run %t 2>&1 | FileCheck %s | ||
// RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=1 not %run %t 2>&1 | FileCheck %s | ||
|
||
// CHECK: runtime error: execution reached the end of a value-returning function without returning a value | ||
// CHECK-NEXT: #0 {{.*}}f() {{.*}}.cpp:[[#@LINE+1]] | ||
__attribute__((noinline)) int f() {} | ||
|
||
// CHECK-NEXT: #1 {{.*}}g() {{.*}}.cpp:[[#@LINE+1]] | ||
__attribute__((noinline)) void g() { f(); } | ||
|
||
// CHECK-NEXT: #2 {{.*}}h() {{.*}}.cpp:[[#@LINE+1]] | ||
__attribute__((noinline)) void h() { g(); } | ||
|
||
// CHECK-NEXT: #3 {{.*}}main {{.*}}.cpp:[[#@LINE+1]] | ||
int main() { h(); } |