[asan] make sure coverage is dumped even if leaks are reported

llvm-svn: 219946
This commit is contained in:
Kostya Serebryany 2014-10-16 18:59:07 +00:00
parent 15558914ab
commit 87b70fc823
2 changed files with 24 additions and 1 deletions

View File

@ -451,9 +451,12 @@ void DoLeakCheck() {
PrintMatchedSuppressions();
if (unsuppressed_count > 0) {
param.leak_report.PrintSummary();
if (flags()->exitcode)
if (flags()->exitcode) {
if (common_flags()->coverage)
__sanitizer_cov_dump();
internal__exit(flags()->exitcode);
}
}
}
static Suppression *GetSuppressionForAddr(uptr addr) {

View File

@ -0,0 +1,20 @@
// Make sure coverage is dumped even if there are reported leaks.
//
// RUN: %clangxx_asan -mllvm -asan-coverage=1 %s -o %t
//
// RUN: rm -rf %T/coverage-and-lsan
//
// RUN: mkdir -p %T/coverage-and-lsan/normal
// RUN: ASAN_OPTIONS=coverage=1:coverage_dir=%T/coverage-and-lsan:verbosity=1 not %run %t 2>&1 | FileCheck %s
// RUN: %sancov print %T/coverage-and-lsan/*.sancov 2>&1
//
// REQUIRES: asan-64-bits
int *g = new int;
int main(int argc, char **argv) {
g = 0;
return 0;
}
// CHECK: LeakSanitizer: detected memory leaks
// CHECK: CovDump: