diff options
author | Kostya Serebryany <kcc@google.com> | 2015-11-11 22:44:25 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2015-11-11 22:44:25 +0000 |
commit | eec91b23c2e7772e509955dda5e04aa1e707a669 (patch) | |
tree | d49a68c04844e3e00b582a858b891b28902d19c3 /lib/sanitizer_common/sanitizer_coverage_libcdep.cc | |
parent | 33dc9108c2f3d9fd3344d7eb7301509b678e8986 (diff) |
[sanitizer coverage] reset global counters in __sanitizer_reset_coverage
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@252815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_coverage_libcdep.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_coverage_libcdep.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc b/lib/sanitizer_common/sanitizer_coverage_libcdep.cc index f052f2672..251331720 100644 --- a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc +++ b/lib/sanitizer_common/sanitizer_coverage_libcdep.cc @@ -55,6 +55,11 @@ static atomic_uint32_t dump_once_guard; // Ensure that CovDump runs only once. static atomic_uintptr_t coverage_counter; static atomic_uintptr_t caller_callee_counter; +static void ResetGlobalCounters() { + return atomic_store(&coverage_counter, 0, memory_order_relaxed); + return atomic_store(&caller_callee_counter, 0, memory_order_relaxed); +} + // pc_array is the array containing the covered PCs. // To make the pc_array thread- and async-signal-safe it has to be large enough. // 128M counters "ought to be enough for anybody" (4M on 32-bit). @@ -924,6 +929,7 @@ void __sanitizer_cov_trace_basic_block(s32 *id) { } SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_reset_coverage() { + ResetGlobalCounters(); coverage_data.ReinitializeGuards(); internal_bzero_aligned16( coverage_data.data(), |