diff options
author | Vitaly Buka <vitalybuka@google.com> | 2017-09-13 06:24:59 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2017-09-13 06:24:59 +0000 |
commit | a2354569bf5883206577a8299c38449391cce3e6 (patch) | |
tree | 026f0f7ab95e0db33ed5f266102e670ec99bc5bb /lib/asan | |
parent | 79b583e7f43a4d411a5b32f5da5eb3c50d1c735b (diff) |
[compiler-rt] Move dump_instruction_bytes and dump_registers into sanitizer_common
Summary: Part of https://github.com/google/sanitizers/issues/637
Reviewers: eugenis, alekseyshl
Subscribers: kubamracek, llvm-commits, dberris
Differential Revision: https://reviews.llvm.org/D37766
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313117 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan')
-rw-r--r-- | lib/asan/asan_descriptions.h | 1 | ||||
-rw-r--r-- | lib/asan/asan_errors.cc | 31 | ||||
-rw-r--r-- | lib/asan/asan_flags.inc | 5 |
3 files changed, 0 insertions, 37 deletions
diff --git a/lib/asan/asan_descriptions.h b/lib/asan/asan_descriptions.h index 5161715df..006a240ac 100644 --- a/lib/asan/asan_descriptions.h +++ b/lib/asan/asan_descriptions.h @@ -69,7 +69,6 @@ class Decorator : public __sanitizer::SanitizerCommonDecorator { return Default(); } } - const char *MemoryByte() { return Magenta(); } }; enum ShadowKind : u8 { diff --git a/lib/asan/asan_errors.cc b/lib/asan/asan_errors.cc index 0f2a9e26f..c9cf8f70b 100644 --- a/lib/asan/asan_errors.cc +++ b/lib/asan/asan_errors.cc @@ -38,37 +38,6 @@ void ErrorStackOverflow::Print() { ReportErrorSummary(scariness.GetDescription(), &stack); } -static void MaybeDumpInstructionBytes(uptr pc) { - if (!flags()->dump_instruction_bytes || (pc < GetPageSizeCached())) return; - InternalScopedString str(1024); - str.append("First 16 instruction bytes at pc: "); - if (IsAccessibleMemoryRange(pc, 16)) { - for (int i = 0; i < 16; ++i) { - PrintMemoryByte(&str, "", ((u8 *)pc)[i], /*in_shadow*/ false, " "); - } - str.append("\n"); - } else { - str.append("unaccessible\n"); - } - Report("%s", str.data()); -} - -static void MaybeDumpRegisters(void *context) { - if (!flags()->dump_registers) return; - SignalContext::DumpAllRegisters(context); -} - -static void MaybeReportNonExecRegion(uptr pc) { -#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD - MemoryMappingLayout proc_maps(/*cache_enabled*/ true); - MemoryMappedSegment segment; - while (proc_maps.Next(&segment)) { - if (pc >= segment.start && pc < segment.end && !segment.IsExecutable()) - Report("Hint: PC is at a non-executable region. Maybe a wild jump?\n"); - } -#endif -} - void ErrorDeadlySignal::Print() { Decorator d; Printf("%s", d.Warning()); diff --git a/lib/asan/asan_flags.inc b/lib/asan/asan_flags.inc index 19ebc696e..00071d39f 100644 --- a/lib/asan/asan_flags.inc +++ b/lib/asan/asan_flags.inc @@ -147,11 +147,6 @@ ASAN_FLAG(int, detect_odr_violation, 2, "If >=2, detect violation of One-Definition-Rule (ODR); " "If ==1, detect ODR-violation only if the two variables " "have different sizes") -ASAN_FLAG(bool, dump_instruction_bytes, false, - "If true, dump 16 bytes starting at the instruction that caused SEGV") -ASAN_FLAG(bool, dump_registers, true, - "If true, dump values of CPU registers when SEGV happens. Only " - "available on OS X for now.") ASAN_FLAG(const char *, suppressions, "", "Suppressions file name.") ASAN_FLAG(bool, halt_on_error, true, "Crash the program after printing the first error report " |