1 // RUN: %clangxx -O0 %s -o %t && %tool_options=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s
2 // RUN: %clangxx -O3 %s -o %t && %tool_options=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s
3 // RUN: %tool_options='stack_trace_format="frame:%n lineno:%l"' %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM
4 // RUN: %tool_options=symbolize_inline_frames=false:stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s --check-prefix=NOINLINE
5
6 #include <sanitizer/common_interface_defs.h>
7
FooBarBaz()8 static inline void FooBarBaz() {
9 __sanitizer_print_stack_trace();
10 }
11
main()12 int main() {
13 FooBarBaz();
14 return 0;
15 }
16 // CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}}
17 // CHECK: {{ #1 0x.* in FooBarBaz(\(\))? .*print-stack-trace.cc:9}}
18 // CHECK: {{ #2 0x.* in main.*print-stack-trace.cc:13}}
19
20 // CUSTOM: frame:1 lineno:9
21 // CUSTOM: frame:2 lineno:13
22
23 // NOINLINE: #0 0x{{.*}} in __sanitizer_print_stack_trace
24 // NOINLINE: #1 0x{{.*}} in main{{.*}}print-stack-trace.cc:9
25