blob: 1251f67b83cd3dca935da9f97b5c80b25a6be5b6 [file] [log] [blame]
Stephen Hines6d186232014-11-26 17:56:19 -08001// 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
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