forked from OSchip/llvm-project
Add runtime flag 'symbolize_inline_frames' to disable symbolization of inlined frames done in llvm-symbolizer
llvm-svn: 220582
This commit is contained in:
parent
4b7bd2d52f
commit
3ca50c34ec
|
@ -67,6 +67,7 @@ void SetCommonFlagsDefaults(CommonFlags *f) {
|
|||
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(CommonFlags *f, const char *str) {
|
|||
"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)
|
||||
|
|
|
@ -61,6 +61,7 @@ struct CommonFlags {
|
|||
const char *suppressions;
|
||||
bool print_suppressions;
|
||||
bool disable_coredump;
|
||||
bool symbolize_inline_frames;
|
||||
};
|
||||
|
||||
inline CommonFlags *common_flags() {
|
||||
|
|
|
@ -348,7 +348,12 @@ class LLVMSymbolizerProcess : public SymbolizerProcess {
|
|||
#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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -7,12 +7,16 @@ config.name = "SanitizerCommon-" + config.tool_name
|
|||
|
||||
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']
|
||||
|
||||
|
|
Loading…
Reference in New Issue