From fbaaed6b581a3d08b16f0a247e32e98398d014ea Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Thu, 6 Nov 2014 18:43:45 +0000 Subject: [Sanitizer] Introduce "stack_trace_format" runtime flag. This flag can be used to specify the format of stack frames - user can now provide a string with placeholders, which should be printed for each stack frame with placeholders replaced with actual data. For example "%p" will be replaced by PC, "%s" will be replaced by the source file name etc. "DEFAULT" value enforces default stack trace format currently used in all the sanitizers except TSan. This change also implements __sanitizer_print_stack_trace interface function in TSan. llvm-svn: 221469 --- .../sanitizer_common/TestCases/print-stack-trace.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'compiler-rt/test') diff --git a/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc b/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc index a842ca65d67..1251f67b83c 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc +++ b/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cc @@ -1,10 +1,7 @@ -// RUN: %clangxx -O0 %s -o %t && %run %t 2>&1 | FileCheck %s -// RUN: %clangxx -O3 %s -o %t && %run %t 2>&1 | FileCheck %s -// RUN: %tool_options=symbolize_inline_frames=false %run %t 2>&1 | FileCheck %s --check-prefix=NOINLINE - -// Not yet implemented for TSan. -// https://code.google.com/p/address-sanitizer/issues/detail?id=243 -// XFAIL: tsan +// RUN: %clangxx -O0 %s -o %t && %tool_options=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s +// RUN: %clangxx -O3 %s -o %t && %tool_options=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s +// RUN: %tool_options='stack_trace_format="frame:%n lineno:%l"' %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM +// RUN: %tool_options=symbolize_inline_frames=false:stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s --check-prefix=NOINLINE #include @@ -17,8 +14,11 @@ int main() { return 0; } // CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}} -// CHECK: {{ #1 0x.* in FooBarBaz(\(\))? .*print-stack-trace.cc:12}} -// CHECK: {{ #2 0x.* in main.*print-stack-trace.cc:16}} +// CHECK: {{ #1 0x.* in FooBarBaz(\(\))? .*print-stack-trace.cc:9}} +// CHECK: {{ #2 0x.* in main.*print-stack-trace.cc:13}} + +// CUSTOM: frame:1 lineno:9 +// CUSTOM: frame:2 lineno:13 // NOINLINE: #0 0x{{.*}} in __sanitizer_print_stack_trace -// NOINLINE: #1 0x{{.*}} in main{{.*}}print-stack-trace.cc:12 +// NOINLINE: #1 0x{{.*}} in main{{.*}}print-stack-trace.cc:9 -- cgit v1.2.3