[compiler-rt] r245890 - [Sanitizer] Dump coverage if we're killing the program with __sanitizer::Die().
Alexey Samsonov via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 15:21:48 PDT 2015
Author: samsonov
Date: Mon Aug 24 17:21:47 2015
New Revision: 245890
URL: http://llvm.org/viewvc/llvm-project?rev=245890&view=rev
Log:
[Sanitizer] Dump coverage if we're killing the program with __sanitizer::Die().
Previously we had to call __sanitizer_cov_dump() from tool-specific
callbacks - instead, let sanitizer_common library handle this in a
single place.
This is a re-application of r245770, with slightly different approach
taken.
Modified:
compiler-rt/trunk/lib/asan/asan_rtl.cc
compiler-rt/trunk/lib/lsan/lsan_common.cc
compiler-rt/trunk/lib/msan/msan.cc
compiler-rt/trunk/lib/msan/msan.h
compiler-rt/trunk/lib/msan/msan_linux.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=245890&r1=245889&r2=245890&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Mon Aug 24 17:21:47 2015
@@ -56,8 +56,6 @@ static void AsanDie() {
UnmapOrDie((void*)kLowShadowBeg, kHighShadowEnd - kLowShadowBeg);
}
}
- if (common_flags()->coverage)
- __sanitizer_cov_dump();
if (flags()->abort_on_error)
Abort();
}
Modified: compiler-rt/trunk/lib/lsan/lsan_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.cc?rev=245890&r1=245889&r2=245890&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Mon Aug 24 17:21:47 2015
@@ -445,8 +445,6 @@ void DoLeakCheck() {
return;
}
if (common_flags()->exitcode) {
- if (common_flags()->coverage)
- __sanitizer_cov_dump();
Die();
}
}
Modified: compiler-rt/trunk/lib/msan/msan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=245890&r1=245889&r2=245890&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.cc (original)
+++ compiler-rt/trunk/lib/msan/msan.cc Mon Aug 24 17:21:47 2015
@@ -375,7 +375,6 @@ void __msan_init() {
msan_init_is_running = 1;
SanitizerToolName = "MemorySanitizer";
- AddDieCallback(MsanDie);
InitTlsSize();
CacheBinaryName();
Modified: compiler-rt/trunk/lib/msan/msan.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.h?rev=245890&r1=245889&r2=245890&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.h (original)
+++ compiler-rt/trunk/lib/msan/msan.h Mon Aug 24 17:21:47 2015
@@ -167,7 +167,6 @@ struct SymbolizerScope {
~SymbolizerScope() { ExitSymbolizer(); }
};
-void MsanDie();
void PrintWarning(uptr pc, uptr bp);
void PrintWarningWithOrigin(uptr pc, uptr bp, u32 origin);
Modified: compiler-rt/trunk/lib/msan/msan_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_linux.cc?rev=245890&r1=245889&r2=245890&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_linux.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_linux.cc Mon Aug 24 17:21:47 2015
@@ -151,11 +151,6 @@ bool InitShadow(bool init_origins) {
return true;
}
-void MsanDie() {
- if (common_flags()->coverage)
- __sanitizer_cov_dump();
-}
-
static void MsanAtExit(void) {
if (flags()->print_stats && (flags()->atexit || msan_report_count > 0))
ReportStats();
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc?rev=245890&r1=245889&r2=245890&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc Mon Aug 24 17:21:47 2015
@@ -832,6 +832,11 @@ void CovAfterFork(int child_pid) {
coverage_data.AfterFork(child_pid);
}
+static void MaybeDumpCoverage() {
+ if (common_flags()->coverage)
+ __sanitizer_cov_dump();
+}
+
void InitializeCoverage(bool enabled, const char *dir) {
if (coverage_enabled)
return; // May happen if two sanitizer enable coverage in the same process.
@@ -840,6 +845,7 @@ void InitializeCoverage(bool enabled, co
coverage_data.Init();
if (enabled) coverage_data.Enable();
if (!common_flags()->coverage_direct) Atexit(__sanitizer_cov_dump);
+ AddDieCallback(MaybeDumpCoverage);
}
void ReInitializeCoverage(bool enabled, const char *dir) {
More information about the llvm-commits
mailing list