Home | History | Annotate | Download | only in TestCases
      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
      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
      5 
      6 #include <sanitizer/common_interface_defs.h>
      7 
      8 static inline void FooBarBaz() {
      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}}
     17 // CHECK: {{    #1 0x.* in FooBarBaz(\(\))? .*}}print-stack-trace.cc:[[@LINE-8]]
     18 // CHECK: {{    #2 0x.* in main.*}}print-stack-trace.cc:[[@LINE-5]]
     19 
     20 // CUSTOM: frame:1 lineno:[[@LINE-11]]
     21 // CUSTOM: frame:2 lineno:[[@LINE-8]]
     22 
     23 // NOINLINE: #0 0x{{.*}} in __sanitizer_print_stack_trace
     24 // NOINLINE: #1 0x{{.*}} in main{{.*}}print-stack-trace.cc:[[@LINE-15]]
     25