diff options
| author | Kostya Serebryany <kcc@google.com> | 2013-11-29 14:49:32 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2013-11-29 14:49:32 +0000 |
| commit | dc5809021372a8cba1e085b80d263bc101b49a70 (patch) | |
| tree | 8e9b237c3f0211db014acfbe6de8374e65f34aaf | |
| parent | 5774faf5b0cdef120e387a4ecc6e76fd138e37f5 (diff) | |
| download | bcm5719-llvm-dc5809021372a8cba1e085b80d263bc101b49a70.tar.gz bcm5719-llvm-dc5809021372a8cba1e085b80d263bc101b49a70.zip | |
[asan] dump coverage even if asan has reported an error
llvm-svn: 195959
| -rw-r--r-- | compiler-rt/lib/asan/asan_rtl.cc | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/lit_tests/TestCases/Linux/coverage.cc | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc index a1b9fd542ac..25cafc8dcab 100644 --- a/compiler-rt/lib/asan/asan_rtl.cc +++ b/compiler-rt/lib/asan/asan_rtl.cc @@ -51,6 +51,8 @@ static void AsanDie() { UnmapOrDie((void*)kLowShadowBeg, kHighShadowEnd - kLowShadowBeg); } } + if (flags()->coverage) + __sanitizer_cov_dump(); if (death_callback) death_callback(); if (flags()->abort_on_error) diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/Linux/coverage.cc b/compiler-rt/lib/asan/lit_tests/TestCases/Linux/coverage.cc index 4373e9b13c6..f8a1234751b 100644 --- a/compiler-rt/lib/asan/lit_tests/TestCases/Linux/coverage.cc +++ b/compiler-rt/lib/asan/lit_tests/TestCases/Linux/coverage.cc @@ -5,6 +5,7 @@ // RUN: %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-foo // RUN: %t bar 2>&1 | FileCheck %s --check-prefix=CHECK-bar // RUN: %t foo bar 2>&1 | FileCheck %s --check-prefix=CHECK-foo-bar +// RUN: not %t foo bar 1 2 2>&1 | FileCheck %s --check-prefix=CHECK-report #include <stdio.h> #include <string.h> @@ -17,6 +18,8 @@ __attribute__((noinline)) void foo() { printf("foo\n"); } extern void bar(); +int G[4]; + int main(int argc, char **argv) { fprintf(stderr, "PID: %d\n", getpid()); for (int i = 1; i < argc; i++) { @@ -25,6 +28,7 @@ int main(int argc, char **argv) { if (!strcmp(argv[i], "bar")) bar(); } + return G[argc]; // Buffer overflow if argc >= 4. } #endif @@ -43,3 +47,6 @@ int main(int argc, char **argv) { // CHECK-foo-bar: PID: [[PID:[0-9]+]] // CHECK-foo-bar: [[PID]].sancov: 2 PCs written // CHECK-foo-bar: so.[[PID]].sancov: 1 PCs written +// +// CHECK-report: AddressSanitizer: global-buffer-overflow +// CHECK-report: PCs written |

