summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-10-22 22:06:41 +0000
committerKostya Serebryany <kcc@google.com>2015-10-22 22:06:41 +0000
commit8c96149e30058ce6c86e9db5537cfbde6b7bc838 (patch)
tree69f34922691bf67271d20caff3d0823a232a26ca /lib/sanitizer_common/sanitizer_coverage_libcdep.cc
parentd777b798868bcaa646cd676bae64a1bba0d19406 (diff)
[sanitizer-coverage] introduce __sanitizer_get_total_unique_caller_callee_pairs
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@251071 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_coverage_libcdep.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_coverage_libcdep.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc b/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
index 4775bd296..9098cec91 100644
--- a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
@@ -53,6 +53,7 @@ static const u64 kMagic32 = 0xC0BFFFFFFFFFFF32ULL;
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;
// 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.
@@ -435,7 +436,7 @@ void CoverageData::IndirCall(uptr caller, uptr callee, uptr callee_cache[],
uptr was = 0;
if (atomic_compare_exchange_strong(&atomic_callee_cache[i], &was, callee,
memory_order_seq_cst)) {
- atomic_fetch_add(&coverage_counter, 1, memory_order_relaxed);
+ atomic_fetch_add(&caller_callee_counter, 1, memory_order_relaxed);
return;
}
if (was == callee) // Already have this callee.
@@ -908,6 +909,11 @@ uptr __sanitizer_get_total_unique_coverage() {
}
SANITIZER_INTERFACE_ATTRIBUTE
+uptr __sanitizer_get_total_unique_caller_callee_pairs() {
+ return atomic_load(&caller_callee_counter, memory_order_relaxed);
+}
+
+SANITIZER_INTERFACE_ATTRIBUTE
void __sanitizer_cov_trace_func_enter(s32 *id) {
coverage_data.TraceBasicBlock(id);
}