Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / print-stack-trace.cpp
blob9d7d03d81b531f63dc900dcdb57654df811d1b9e
1 // RUN: %clangxx -O0 %s -o %t && %env_tool_opts=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s
2 // RUN: %clangxx -O3 %s -o %t && %env_tool_opts=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s
3 // RUN: %env_tool_opts=stack_trace_format=frame%n_lineno%l %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM
4 // RUN: %env_tool_opts=symbolize_inline_frames=false:stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s --check-prefix=NOINLINE
5 // RUN: %env_tool_opts=stack_trace_format='"frame:%n address:%%p"' %run %t 2>&1 | FileCheck %s --check-prefix=NOSYMBOLIZE
7 // UNSUPPORTED: darwin
9 // TODO(yln): temporary failing due to refactoring
10 // UNSUPPORTED: ubsan
12 #include <sanitizer/common_interface_defs.h>
14 static inline void FooBarBaz() {
15 __sanitizer_print_stack_trace();
18 int main() {
19 FooBarBaz();
20 return 0;
22 // CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}}
23 // CHECK: {{ #1 0x.* in FooBarBaz(\(\))? .*}}print-stack-trace.cpp:[[@LINE-8]]
24 // CHECK: {{ #2 0x.* in main.*}}print-stack-trace.cpp:[[@LINE-5]]
26 // CUSTOM: frame1_lineno[[@LINE-11]]
27 // CUSTOM: frame2_lineno[[@LINE-8]]
29 // NOINLINE: #0 0x{{.*}} in __sanitizer_print_stack_trace
30 // NOINLINE: #1 0x{{.*}} in main{{.*}}print-stack-trace.cpp:[[@LINE-15]]
32 // NOSYMBOLIZE: frame:0 address:{{0x.*}}
33 // NOSYMBOLIZE: frame:1 address:{{0x.*}}
34 // NOSYMBOLIZE: frame:2 address:{{0x.*}}