[sanitizer-coverage] remove more unused code

llvm-svn: 300780
This commit is contained in:
Kostya Serebryany 2017-04-19 23:05:53 +00:00
parent d341c93268
commit 1838561dfe
5 changed files with 0 additions and 97 deletions

View File

@ -35,14 +35,6 @@ extern "C" {
// Get the number of unique covered blocks (or edges).
// This can be useful for coverage-directed in-process fuzzers.
uintptr_t __sanitizer_get_total_unique_coverage();
// Reset the basic-block (edge) coverage to the initial state.
// Useful for in-process fuzzing to start collecting coverage from scratch.
// Experimental, will likely not work for multi-threaded process.
void __sanitizer_reset_coverage();
// Set *data to the array of covered PCs and return the size of that array.
// Some of the entries in *data will be zero.
uintptr_t __sanitizer_get_coverage_guards(uintptr_t **data);
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -285,14 +285,8 @@ fun:__sanitizer_cov_module_init=uninstrumented
fun:__sanitizer_cov_module_init=discard
fun:__sanitizer_cov_with_check=uninstrumented
fun:__sanitizer_cov_with_check=discard
fun:__sanitizer_reset_coverage=uninstrumented
fun:__sanitizer_reset_coverage=discard
fun:__sanitizer_set_death_callback=uninstrumented
fun:__sanitizer_set_death_callback=discard
fun:__sanitizer_get_coverage_guards=uninstrumented
fun:__sanitizer_get_coverage_guards=discard
fun:__sanitizer_get_total_unique_coverage=uninstrumented
fun:__sanitizer_get_total_unique_coverage=discard
fun:__sanitizer_get_total_unique_coverage=uninstrumented
fun:__sanitizer_get_total_unique_coverage=discard
fun:__sanitizer_update_counter_bitset_and_clear_counters=uninstrumented

View File

@ -15,10 +15,8 @@ INTERFACE_FUNCTION(__sanitizer_cov_module_init)
INTERFACE_FUNCTION(__sanitizer_cov_with_check)
INTERFACE_FUNCTION(__sanitizer_dump_coverage)
INTERFACE_FUNCTION(__sanitizer_dump_trace_pc_guard_coverage)
INTERFACE_FUNCTION(__sanitizer_get_coverage_guards)
INTERFACE_FUNCTION(__sanitizer_get_total_unique_coverage)
INTERFACE_FUNCTION(__sanitizer_maybe_open_cov_file)
INTERFACE_FUNCTION(__sanitizer_reset_coverage)
INTERFACE_WEAK_FUNCTION(__sancov_default_options)
INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_cmp)
INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_cmp1)

View File

@ -58,10 +58,6 @@ static atomic_uint32_t dump_once_guard; // Ensure that CovDump runs only once.
static atomic_uintptr_t coverage_counter;
static void ResetGlobalCounters() {
return atomic_store(&coverage_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).
@ -674,20 +670,6 @@ uptr __sanitizer_get_total_unique_coverage() {
return atomic_load(&coverage_counter, memory_order_relaxed);
}
SANITIZER_INTERFACE_ATTRIBUTE
void __sanitizer_reset_coverage() {
ResetGlobalCounters();
coverage_data.ReinitializeGuards();
internal_bzero_aligned16(
coverage_data.data(),
RoundUpTo(coverage_data.size() * sizeof(coverage_data.data()[0]), 16));
}
SANITIZER_INTERFACE_ATTRIBUTE
uptr __sanitizer_get_coverage_guards(uptr **data) {
*data = coverage_data.data();
return coverage_data.size();
}
// Default empty implementations (weak). Users should redefine them.
SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_cov_trace_cmp, void) {}
SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_cov_trace_cmp1, void) {}

View File

@ -1,63 +0,0 @@
// Test __sanitizer_reset_coverage().
// RUN: %clangxx_asan -fsanitize-coverage=func %s -o %t
// RUN: %env_asan_opts=coverage=1 %run %t
// https://github.com/google/sanitizers/issues/618
// UNSUPPORTED: android
#include <sanitizer/coverage_interface.h>
#include <stdio.h>
#include <assert.h>
static volatile int sink;
__attribute__((noinline)) void bar() { sink = 2; }
__attribute__((noinline)) void foo() { sink = 1; }
// In MSVC 2015, printf is an inline function, which causes this test to fail as
// it introduces an extra coverage point. Define away printf on that platform to
// avoid the issue.
#if _MSC_VER >= 1900
# define printf(arg, ...)
#endif
#define GET_AND_PRINT_COVERAGE() \
bitset = 0; \
for (size_t i = 0; i < n_guards; i++) \
if (guards[i]) bitset |= 1U << i; \
printf("line %d: bitset %zd total: %zd\n", __LINE__, bitset, \
__sanitizer_get_total_unique_coverage());
#define IS_POWER_OF_TWO(a) ((a & ((a) - 1)) == 0)
int main() {
size_t *guards = 0;
size_t bitset;
size_t n_guards = __sanitizer_get_coverage_guards(&guards);
GET_AND_PRINT_COVERAGE();
size_t main_bit = bitset;
assert(IS_POWER_OF_TWO(main_bit));
foo();
GET_AND_PRINT_COVERAGE();
size_t foo_bit = bitset & ~main_bit;
assert(IS_POWER_OF_TWO(foo_bit));
bar();
GET_AND_PRINT_COVERAGE();
size_t bar_bit = bitset & ~(main_bit | foo_bit);
assert(IS_POWER_OF_TWO(bar_bit));
__sanitizer_reset_coverage();
assert(__sanitizer_get_total_unique_coverage() == 0);
GET_AND_PRINT_COVERAGE();
assert(bitset == 0);
foo();
GET_AND_PRINT_COVERAGE();
assert(bitset == foo_bit);
bar();
GET_AND_PRINT_COVERAGE();
assert(bitset == (foo_bit | bar_bit));
}