summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-11-01 17:23:22 +0000
committerAlexey Samsonov <samsonov@google.com>2013-11-01 17:23:22 +0000
commit7f80655d8283dbdf77bfee4a849eed4d59e95c7a (patch)
treed593a2d514e7e236cc8b9d4ec0d4b72dc8ff8e1c /lib/sanitizer_common
parent2fb08720b11b4c339e191b90d85477c6a2dd74db (diff)
downloadcompiler-rt-7f80655d8283dbdf77bfee4a849eed4d59e95c7a.tar.gz
compiler-rt-7f80655d8283dbdf77bfee4a849eed4d59e95c7a.tar.bz2
compiler-rt-7f80655d8283dbdf77bfee4a849eed4d59e95c7a.tar.xz
[ASan] Kill use_stack_depot runtime flag and stack trace compression routines.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193868 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common')
-rw-r--r--lib/sanitizer_common/sanitizer_stacktrace.cc105
-rw-r--r--lib/sanitizer_common/sanitizer_stacktrace.h5
2 files changed, 0 insertions, 110 deletions
diff --git a/lib/sanitizer_common/sanitizer_stacktrace.cc b/lib/sanitizer_common/sanitizer_stacktrace.cc
index d01e26b0..a110774e 100644
--- a/lib/sanitizer_common/sanitizer_stacktrace.cc
+++ b/lib/sanitizer_common/sanitizer_stacktrace.cc
@@ -147,109 +147,4 @@ void StackTrace::PopStackFrames(uptr count) {
}
}
-// On 32-bits we don't compress stack traces.
-// On 64-bits we compress stack traces: if a given pc differes slightly from
-// the previous one, we record a 31-bit offset instead of the full pc.
-uptr StackTrace::CompressStack(StackTrace *stack, u32 *compressed, uptr size) {
-#if SANITIZER_WORDSIZE == 32
- // Don't compress, just copy.
- uptr res = 0;
- for (uptr i = 0; i < stack->size && i < size; i++) {
- compressed[i] = stack->trace[i];
- res++;
- }
- if (stack->size < size)
- compressed[stack->size] = 0;
-#else // 64 bits, compress.
- uptr prev_pc = 0;
- const uptr kMaxOffset = (1ULL << 30) - 1;
- uptr c_index = 0;
- uptr res = 0;
- for (uptr i = 0, n = stack->size; i < n; i++) {
- uptr pc = stack->trace[i];
- if (!pc) break;
- if ((s64)pc < 0) break;
- // Printf("C pc[%zu] %zx\n", i, pc);
- if (prev_pc - pc < kMaxOffset || pc - prev_pc < kMaxOffset) {
- uptr offset = (s64)(pc - prev_pc);
- offset |= (1U << 31);
- if (c_index >= size) break;
- // Printf("C co[%zu] offset %zx\n", i, offset);
- compressed[c_index++] = offset;
- } else {
- uptr hi = pc >> 32;
- uptr lo = (pc << 32) >> 32;
- CHECK_EQ((hi & (1 << 31)), 0);
- if (c_index + 1 >= size) break;
- // Printf("C co[%zu] hi/lo: %zx %zx\n", c_index, hi, lo);
- compressed[c_index++] = hi;
- compressed[c_index++] = lo;
- }
- res++;
- prev_pc = pc;
- }
- if (c_index < size)
- compressed[c_index] = 0;
- if (c_index + 1 < size)
- compressed[c_index + 1] = 0;
-#endif // SANITIZER_WORDSIZE
-
- // debug-only code
-#if 0
- StackTrace check_stack;
- UncompressStack(&check_stack, compressed, size);
- if (res < check_stack.size) {
- Printf("res %zu check_stack.size %zu; c_size %zu\n", res,
- check_stack.size, size);
- }
- // |res| may be greater than check_stack.size, because
- // UncompressStack(CompressStack(stack)) eliminates the 0x0 frames.
- CHECK(res >= check_stack.size);
- CHECK_EQ(0, REAL(memcmp)(check_stack.trace, stack->trace,
- check_stack.size * sizeof(uptr)));
-#endif
-
- return res;
-}
-
-void StackTrace::UncompressStack(StackTrace *stack,
- u32 *compressed, uptr size) {
-#if SANITIZER_WORDSIZE == 32
- // Don't uncompress, just copy.
- stack->size = 0;
- for (uptr i = 0; i < size && i < kStackTraceMax; i++) {
- if (!compressed[i]) break;
- stack->size++;
- stack->trace[i] = compressed[i];
- }
-#else // 64 bits, uncompress
- uptr prev_pc = 0;
- stack->size = 0;
- for (uptr i = 0; i < size && stack->size < kStackTraceMax; i++) {
- u32 x = compressed[i];
- uptr pc = 0;
- if (x & (1U << 31)) {
- // Printf("U co[%zu] offset: %x\n", i, x);
- // this is an offset
- s32 offset = x;
- offset = (offset << 1) >> 1; // remove the 31-byte and sign-extend.
- pc = prev_pc + offset;
- CHECK(pc);
- } else {
- // CHECK(i + 1 < size);
- if (i + 1 >= size) break;
- uptr hi = x;
- uptr lo = compressed[i+1];
- // Printf("U co[%zu] hi/lo: %zx %zx\n", i, hi, lo);
- i++;
- pc = (hi << 32) | lo;
- if (!pc) break;
- }
- // Printf("U pc[%zu] %zx\n", stack->size, pc);
- stack->trace[stack->size++] = pc;
- prev_pc = pc;
- }
-#endif // SANITIZER_WORDSIZE
-}
-
} // namespace __sanitizer
diff --git a/lib/sanitizer_common/sanitizer_stacktrace.h b/lib/sanitizer_common/sanitizer_stacktrace.h
index 8c55397f..7c6a25cc 100644
--- a/lib/sanitizer_common/sanitizer_stacktrace.h
+++ b/lib/sanitizer_common/sanitizer_stacktrace.h
@@ -56,11 +56,6 @@ struct StackTrace {
static uptr GetCurrentPc();
static uptr GetPreviousInstructionPc(uptr pc);
-
- static uptr CompressStack(StackTrace *stack,
- u32 *compressed, uptr size);
- static void UncompressStack(StackTrace *stack,
- u32 *compressed, uptr size);
};
} // namespace __sanitizer