Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 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 |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 5 | |
| 6 | #include <sanitizer/common_interface_defs.h> |
| 7 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 8 | static inline void FooBarBaz() { |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 9 | __sanitizer_print_stack_trace(); |
| 10 | } |
| 11 | |
| 12 | int main() { |
| 13 | FooBarBaz(); |
| 14 | return 0; |
| 15 | } |
| 16 | // CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}} |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 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 |