]> git.proxmox.com Git - rustc.git/blame - src/libcompiler_builtins/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc
New upstream version 1.25.0+dfsg1
[rustc.git] / src / libcompiler_builtins / compiler-rt / test / sanitizer_common / TestCases / print-stack-trace.cc
CommitLineData
92a42be0
SL
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
2c00a5a8 3// RUN: %env_tool_opts=stack_trace_format=frame%n_lineno%l %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM
92a42be0
SL
4// RUN: %env_tool_opts=symbolize_inline_frames=false:stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s --check-prefix=NOINLINE
5
2c00a5a8
XL
6// UNSUPPORTED: darwin
7
92a42be0
SL
8#include <sanitizer/common_interface_defs.h>
9
10static inline void FooBarBaz() {
11 __sanitizer_print_stack_trace();
12}
13
14int main() {
15 FooBarBaz();
16 return 0;
17}
18// CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}}
5bcae85e
SL
19// CHECK: {{ #1 0x.* in FooBarBaz(\(\))? .*}}print-stack-trace.cc:[[@LINE-8]]
20// CHECK: {{ #2 0x.* in main.*}}print-stack-trace.cc:[[@LINE-5]]
92a42be0 21
2c00a5a8
XL
22// CUSTOM: frame1_lineno[[@LINE-11]]
23// CUSTOM: frame2_lineno[[@LINE-8]]
92a42be0
SL
24
25// NOINLINE: #0 0x{{.*}} in __sanitizer_print_stack_trace
5bcae85e 26// NOINLINE: #1 0x{{.*}} in main{{.*}}print-stack-trace.cc:[[@LINE-15]]