From 7119b57a9d112e8bca42a4b0089439179bbc2aeb Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Mon, 18 Sep 2017 07:36:32 +0000 Subject: [PATCH] [sanitizer] Move StartReportDeadlySignal into sanitizer_common_libcdep llvm-svn: 313518 --- .../lib/sanitizer_common/sanitizer_common_libcdep.cc | 8 ++++++++ .../lib/sanitizer_common/sanitizer_posix_libcdep.cc | 8 -------- compiler-rt/lib/sanitizer_common/sanitizer_win.cc | 4 ---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc index 4f26a2227993..d96890ff576a 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc @@ -148,6 +148,14 @@ void BackgroundThread(void *arg) { #endif #if !SANITIZER_GO +void StartReportDeadlySignal() { + // Write the first message using fd=2, just in case. + // It may actually fail to write in case stderr is closed. + CatastrophicErrorWrite(SanitizerToolName, internal_strlen(SanitizerToolName)); + static const char kDeadlySignal[] = ":DEADLYSIGNAL\n"; + CatastrophicErrorWrite(kDeadlySignal, sizeof(kDeadlySignal) - 1); +} + static void MaybeReportNonExecRegion(uptr pc) { #if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD MemoryMappingLayout proc_maps(/*cache_enabled*/ true); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc index 309fe1df6c4f..4214d91c5356 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc @@ -261,14 +261,6 @@ bool SignalContext::IsStackOverflow() const { (si->si_code == si_SEGV_MAPERR || si->si_code == si_SEGV_ACCERR); } -void StartReportDeadlySignal() { - // Write the first message using fd=2, just in case. - // It may actually fail to write in case stderr is closed. - internal_write(2, SanitizerToolName, internal_strlen(SanitizerToolName)); - static const char kDeadlySignal[] = ":DEADLYSIGNAL\n"; - internal_write(2, kDeadlySignal, sizeof(kDeadlySignal) - 1); -} - #endif // SANITIZER_GO bool IsAccessibleMemoryRange(uptr beg, uptr size) { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc index 5a78b64c6f15..4d68f56100f4 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc @@ -858,10 +858,6 @@ void InstallDeadlySignalHandlers(SignalHandlerType handler) { // FIXME: Decide what to do on Windows. } -void StartReportDeadlySignal() { - // FIXME: Decide what to do on Windows. -} - HandleSignalMode GetHandleSignalMode(int signum) { // FIXME: Decide what to do on Windows. return kHandleSignalNo;