[compiler-rt] r220582 - Add runtime flag 'symbolize_inline_frames' to disable symbolization of inlined frames done in llvm-symbolizer
Alexey Samsonov
vonosmas at gmail.com
Fri Oct 24 11:34:44 PDT 2014
Author: samsonov
Date: Fri Oct 24 13:34:43 2014
New Revision: 220582
URL: http://llvm.org/viewvc/llvm-project?rev=220582&view=rev
Log:
Add runtime flag 'symbolize_inline_frames' to disable symbolization of inlined frames done in llvm-symbolizer
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc
compiler-rt/trunk/test/sanitizer_common/lit.common.cfg
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc?rev=220582&r1=220581&r2=220582&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc Fri Oct 24 13:34:43 2014
@@ -67,6 +67,7 @@ void SetCommonFlagsDefaults(CommonFlags
f->suppressions = "";
f->print_suppressions = true;
f->disable_coredump = (SANITIZER_WORDSIZE == 64);
+ f->symbolize_inline_frames = true;
}
void ParseCommonFlagsFromString(CommonFlags *f, const char *str) {
@@ -158,6 +159,8 @@ void ParseCommonFlagsFromString(CommonFl
"Disable core dumping. By default, disable_core=1 on 64-bit to avoid "
"dumping a 16T+ core file. Ignored on OSes that don't dump core by"
"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.");
// Do a sanity check for certain flags.
if (f->malloc_context_size < 1)
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h?rev=220582&r1=220581&r2=220582&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h Fri Oct 24 13:34:43 2014
@@ -61,6 +61,7 @@ struct CommonFlags {
const char *suppressions;
bool print_suppressions;
bool disable_coredump;
+ bool symbolize_inline_frames;
};
inline CommonFlags *common_flags() {
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc?rev=220582&r1=220581&r2=220582&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc Fri Oct 24 13:34:43 2014
@@ -348,7 +348,12 @@ class LLVMSymbolizerProcess : public Sym
#else
const char* const kSymbolizerArch = "--default-arch=unknown";
#endif
- execl(path_to_binary, path_to_binary, kSymbolizerArch, (char *)0);
+
+ const char *const inline_flag = common_flags()->symbolize_inline_frames
+ ? "--inlining=true"
+ : "--inlining=false";
+ execl(path_to_binary, path_to_binary, inline_flag, kSymbolizerArch,
+ (char *)0);
}
};
Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc?rev=220582&r1=220581&r2=220582&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/print-stack-trace.cc Fri Oct 24 13:34:43 2014
@@ -1,13 +1,14 @@
// 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
#include <sanitizer/common_interface_defs.h>
-void FooBarBaz() {
+static inline void FooBarBaz() {
__sanitizer_print_stack_trace();
}
@@ -16,5 +17,8 @@ int main() {
return 0;
}
// CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}}
-// CHECK: {{ #1 0x.* in FooBarBaz(\(\))? .*print-stack-trace.cc:11}}
-// CHECK: {{ #2 0x.* in main.*print-stack-trace.cc:15}}
+// CHECK: {{ #1 0x.* in FooBarBaz(\(\))? .*print-stack-trace.cc:12}}
+// CHECK: {{ #2 0x.* in main.*print-stack-trace.cc:16}}
+
+// NOINLINE: #0 0x{{.*}} in __sanitizer_print_stack_trace
+// NOINLINE: #1 0x{{.*}} in main{{.*}}print-stack-trace.cc:12
Modified: compiler-rt/trunk/test/sanitizer_common/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/lit.common.cfg?rev=220582&r1=220581&r2=220582&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/lit.common.cfg (original)
+++ compiler-rt/trunk/test/sanitizer_common/lit.common.cfg Fri Oct 24 13:34:43 2014
@@ -7,12 +7,16 @@ config.name = "SanitizerCommon-" + confi
if config.tool_name == "asan":
tool_cflags = ["-fsanitize=address"]
+ tool_options = "ASAN_OPTIONS"
elif config.tool_name == "tsan":
tool_cflags = ["-fsanitize=thread"]
+ tool_options = "TSAN_OPTIONS"
elif config.tool_name == "msan":
tool_cflags = ["-fsanitize=memory"]
+ tool_options = "MSAN_OPTIONS"
elif config.tool_name == "lsan":
tool_cflags = ["-fsanitize=leak"]
+ tool_options = "LSAN_OPTIONS"
else:
lit_config.fatal("Unknown tool for sanitizer_common tests: %r" % config.tool_name)
@@ -26,6 +30,7 @@ def build_invocation(compile_flags):
config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )
config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
+config.substitutions.append( ("%tool_options", tool_options) )
config.suffixes = ['.c', '.cc', '.cpp']
More information about the llvm-commits
mailing list