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 --- compiler-rt/lib/sanitizer_common/sanitizer_flags.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_flags.cc') diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc index 55644e0d69f..40b6ec06715 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc @@ -68,6 +68,7 @@ void SetCommonFlagsDefaults(CommonFlags *f) { f->print_suppressions = true; f->disable_coredump = (SANITIZER_WORDSIZE == 64); f->symbolize_inline_frames = true; + f->stack_trace_format = "DEFAULT"; } void ParseCommonFlagsFromString(CommonFlags *f, const char *str) { @@ -161,6 +162,10 @@ void ParseCommonFlagsFromString(CommonFlags *f, const char *str) { "default and for sanitizers that don't reserve lots of virtual memory."); ParseFlag(str, &f->symbolize_inline_frames, "symbolize_inline_frames", "Print inlined frames in stacktraces. Defaults to true."); + ParseFlag(str, &f->stack_trace_format, "stack_trace_format", + "Format string used to render stack frames. " + "See sanitizer_stacktrace_printer.h for the format description. " + "Use DEFAULT to get default format."); // Do a sanity check for certain flags. if (f->malloc_context_size < 1) -- cgit v1.2.3