1// RUN: %clangxx -fsanitize=undefined -O0 %s -o %t && UBSAN_OPTIONS=stack_trace_format=DEFAULT:fast_unwind_on_fatal=1 %run %t 2>&1 | FileCheck %s
2// RUN: %clangxx -fsanitize=undefined -O0 %s -o %t && UBSAN_OPTIONS=stack_trace_format=DEFAULT:fast_unwind_on_fatal=0 %run %t 2>&1 | FileCheck %s
3
4// This test is temporarily disabled due to broken unwinding on ARM.
5// UNSUPPORTED: target={{.*-linux-.*}}
6
7// The test doesn't pass on Darwin in UBSan-TSan configuration, because TSan is
8// using the slow unwinder which is not supported on Darwin. The test should
9// be universal after landing of https://reviews.llvm.org/D32806.
10
11#include <sanitizer/common_interface_defs.h>
12
13static inline void FooBarBaz() {
14 __sanitizer_print_stack_trace();
15}
16
17int main() {
18 FooBarBaz();
19 return 0;
20}
21
22// CHECK: {{.*}} in FooBarBaz{{.*}}print_stack_trace.cpp{{.*}}
23// CHECK: {{.*}} in main{{.*}}print_stack_trace.cpp{{.*}}
24

source code of compiler-rt/test/ubsan/TestCases/Misc/Linux/print_stack_trace.cpp