blob: 9134a88dac17706cb5a4dd1f154228c34e5142b1 [file] [log] [blame]
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -08001// 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
Stephen Hines2d1fdb22014-05-28 23:58:16 -07005
6#include <sanitizer/common_interface_defs.h>
7
Stephen Hines6d186232014-11-26 17:56:19 -08008static inline void FooBarBaz() {
Stephen Hines2d1fdb22014-05-28 23:58:16 -07009 __sanitizer_print_stack_trace();
10}
11
12int main() {
13 FooBarBaz();
14 return 0;
15}
16// CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}}
Stephen Hines6d186232014-11-26 17:56:19 -080017// 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