1*7c3d14c8STreehugger Robot // RUN: %clangxx -O0 %s -o %t && %env_tool_opts=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s 2*7c3d14c8STreehugger Robot // RUN: %clangxx -O3 %s -o %t && %env_tool_opts=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s 3*7c3d14c8STreehugger Robot // RUN: %env_tool_opts=stack_trace_format='"frame:%n lineno:%l"' %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM 4*7c3d14c8STreehugger Robot // RUN: %env_tool_opts=symbolize_inline_frames=false:stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s --check-prefix=NOINLINE 5*7c3d14c8STreehugger Robot 6*7c3d14c8STreehugger Robot #include <sanitizer/common_interface_defs.h> 7*7c3d14c8STreehugger Robot FooBarBaz()8*7c3d14c8STreehugger Robotstatic inline void FooBarBaz() { 9*7c3d14c8STreehugger Robot __sanitizer_print_stack_trace(); 10*7c3d14c8STreehugger Robot } 11*7c3d14c8STreehugger Robot main()12*7c3d14c8STreehugger Robotint main() { 13*7c3d14c8STreehugger Robot FooBarBaz(); 14*7c3d14c8STreehugger Robot return 0; 15*7c3d14c8STreehugger Robot } 16*7c3d14c8STreehugger Robot // CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}} 17*7c3d14c8STreehugger Robot // CHECK: {{ #1 0x.* in FooBarBaz(\(\))? .*}}print-stack-trace.cc:[[@LINE-8]] 18*7c3d14c8STreehugger Robot // CHECK: {{ #2 0x.* in main.*}}print-stack-trace.cc:[[@LINE-5]] 19*7c3d14c8STreehugger Robot 20*7c3d14c8STreehugger Robot // CUSTOM: frame:1 lineno:[[@LINE-11]] 21*7c3d14c8STreehugger Robot // CUSTOM: frame:2 lineno:[[@LINE-8]] 22*7c3d14c8STreehugger Robot 23*7c3d14c8STreehugger Robot // NOINLINE: #0 0x{{.*}} in __sanitizer_print_stack_trace 24*7c3d14c8STreehugger Robot // NOINLINE: #1 0x{{.*}} in main{{.*}}print-stack-trace.cc:[[@LINE-15]] 25