summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-05-28 01:25:44 +0000
committerKostya Serebryany <kcc@google.com>2016-05-28 01:25:44 +0000
commit2fb0222c8d0d12fd294265e90e184848feee81c2 (patch)
tree32a9e9ee86f20c905d4c5d618e32def1c460730d /lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
parent929d23ef5045d955ef2c36f2bbdb3dc61eca518f (diff)
[sanitizers] introduce a common run-time option dedup_token_length to help with report deduplication, off by default for now. See https://github.com/google/sanitizers/issues/684
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271085 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc b/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
index f66fa79f1..59ca927fa 100644
--- a/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
@@ -25,6 +25,8 @@ void StackTrace::Print() const {
return;
}
InternalScopedString frame_desc(GetPageSizeCached() * 2);
+ InternalScopedString dedup_token(GetPageSizeCached());
+ int dedup_frames = common_flags()->dedup_token_length;
uptr frame_num = 0;
for (uptr i = 0; i < size && trace[i]; i++) {
// PCs in stack traces are actually the return addresses, that is,
@@ -38,11 +40,18 @@ void StackTrace::Print() const {
cur->info, common_flags()->symbolize_vs_style,
common_flags()->strip_path_prefix);
Printf("%s\n", frame_desc.data());
+ if (dedup_frames-- > 0) {
+ if (dedup_token.length())
+ dedup_token.append("--");
+ dedup_token.append(cur->info.function);
+ }
}
frames->ClearAll();
}
// Always print a trailing empty line after stack trace.
Printf("\n");
+ if (dedup_token.length())
+ Printf("DEDUP_TOKEN: %s\n", dedup_token.data());
}
void BufferedStackTrace::Unwind(u32 max_depth, uptr pc, uptr bp, void *context,