[sanitizer-coverage] remove stale code, second attempt after failed r282994
authorKostya Serebryany <kcc@google.com>
Tue, 4 Oct 2016 04:18:30 +0000 (04:18 +0000)
committerKostya Serebryany <kcc@google.com>
Tue, 4 Oct 2016 04:18:30 +0000 (04:18 +0000)
llvm-svn: 283185

compiler-rt/include/sanitizer/coverage_interface.h
compiler-rt/lib/asan/asan_win_dll_thunk.cc
compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
compiler-rt/test/asan/TestCases/coverage-pc-buffer.cc [deleted file]

index 72ac843fa18587f5afa89fe812518a8fbbf230ef..ecbc50287ec86d5bb397629970f0b4955f5d0ef3 100644 (file)
@@ -59,14 +59,6 @@ extern "C" {
   uintptr_t
   __sanitizer_update_counter_bitset_and_clear_counters(uint8_t *bitset);
 
-  // EXPERIMENTAL API
-  // Set allocated buffer to record new coverage PCs as they are executed.
-  // Buffer length is specified in uptrs.
-  void __sanitizer_set_coverage_pc_buffer(uintptr_t *buffer, uintptr_t length);
-  // Number of pcs recorded in the buffer.
-  // Reset by __sanitizer_reset_coverage();
-  uintptr_t __sanitizer_get_coverage_pc_buffer_pos();
-
 #ifdef __cplusplus
 }  // extern "C"
 #endif
index 607af703b5a14cf23aa14aa8168ee913ae6ab03a..364d00d8979a2fdcbe5f54570fddcd6470d96c7c 100644 (file)
@@ -326,7 +326,6 @@ INTERFACE_FUNCTION(__sanitizer_cov_trace_func_enter)
 INTERFACE_FUNCTION(__sanitizer_cov_with_check)
 INTERFACE_FUNCTION(__sanitizer_get_allocated_size)
 INTERFACE_FUNCTION(__sanitizer_get_coverage_guards)
-INTERFACE_FUNCTION(__sanitizer_get_coverage_pc_buffer_pos)
 INTERFACE_FUNCTION(__sanitizer_get_current_allocated_bytes)
 INTERFACE_FUNCTION(__sanitizer_get_estimated_allocated_size)
 INTERFACE_FUNCTION(__sanitizer_get_free_bytes)
@@ -346,7 +345,6 @@ INTERFACE_FUNCTION(__sanitizer_reset_coverage)
 INTERFACE_FUNCTION(__sanitizer_get_number_of_counters)
 INTERFACE_FUNCTION(__sanitizer_update_counter_bitset_and_clear_counters)
 INTERFACE_FUNCTION(__sanitizer_sandbox_on_notify)
-INTERFACE_FUNCTION(__sanitizer_set_coverage_pc_buffer)
 INTERFACE_FUNCTION(__sanitizer_set_death_callback)
 INTERFACE_FUNCTION(__sanitizer_set_report_path)
 INTERFACE_FUNCTION(__sanitizer_set_report_fd)
index efa7db9bd0f7749292f75b16bb61e3db9d60ff9c..0661e5ff5e0ce519c9be3ea59a5f6e4ad4548db8 100644 (file)
@@ -113,8 +113,6 @@ class CoverageData {
   uptr *data();
   uptr size() const;
 
-  void SetPcBuffer(uptr* data, uptr length);
-
  private:
   struct NamedPcRange {
     const char *copied_module_name;
@@ -145,9 +143,6 @@ class CoverageData {
   // Descriptor of the file mapped pc array.
   fd_t pc_fd;
 
-  uptr *pc_buffer;
-  uptr pc_buffer_len;
-
   // Vector of coverage guard arrays, protected by mu.
   InternalMmapVectorNoCtor<s32*> guard_array_vec;
 
@@ -219,9 +214,6 @@ void CoverageData::Enable() {
     atomic_store(&pc_array_size, kPcArrayMaxSize, memory_order_relaxed);
   }
 
-  pc_buffer = nullptr;
-  pc_buffer_len = 0;
-
   cc_array = reinterpret_cast<uptr **>(MmapNoReserveOrDie(
       sizeof(uptr *) * kCcArrayMaxSize, "CovInit::cc_array"));
   atomic_store(&cc_array_size, kCcArrayMaxSize, memory_order_relaxed);
@@ -427,7 +419,6 @@ void CoverageData::Add(uptr pc, u32 *guard) {
            atomic_load(&pc_array_size, memory_order_acquire));
   uptr counter = atomic_fetch_add(&coverage_counter, 1, memory_order_relaxed);
   pc_array[idx] = BundlePcAndCounter(pc, counter);
-  if (pc_buffer && counter < pc_buffer_len) pc_buffer[counter] = pc;
 }
 
 // Registers a pair caller=>callee.
@@ -881,11 +872,6 @@ void CoverageData::DumpAll() {
   DumpCallerCalleePairs();
 }
 
-void CoverageData::SetPcBuffer(uptr* data, uptr length) {
-  pc_buffer = data;
-  pc_buffer_len = length;
-}
-
 void CovPrepareForSandboxing(__sanitizer_sandbox_arguments *args) {
   if (!args) return;
   if (!coverage_enabled) return;
@@ -1020,16 +1006,6 @@ uptr __sanitizer_get_coverage_guards(uptr **data) {
   return coverage_data.size();
 }
 
-SANITIZER_INTERFACE_ATTRIBUTE
-void __sanitizer_set_coverage_pc_buffer(uptr *data, uptr length) {
-  coverage_data.SetPcBuffer(data, length);
-}
-
-SANITIZER_INTERFACE_ATTRIBUTE
-uptr __sanitizer_get_coverage_pc_buffer_pos() {
-  return __sanitizer_get_total_unique_coverage();
-}
-
 SANITIZER_INTERFACE_ATTRIBUTE
 uptr __sanitizer_get_number_of_counters() {
   return coverage_data.GetNumberOf8bitCounters();
diff --git a/compiler-rt/test/asan/TestCases/coverage-pc-buffer.cc b/compiler-rt/test/asan/TestCases/coverage-pc-buffer.cc
deleted file mode 100644 (file)
index dd9beaf..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// Test __sanitizer_coverage_pc_buffer().
-
-// RUN: %clangxx_asan -fsanitize-coverage=edge %stdcxx11 %s -O3 -o %t && %run %t
-
-// UNSUPPORTED: android
-
-#include <assert.h>
-#include <memory>
-#include <sanitizer/coverage_interface.h>
-#include <stdint.h>
-#include <stdio.h>
-
-static volatile int sink;
-__attribute__((noinline)) void foo() { sink = 1; }
-
-void assertNotZeroPcs(uintptr_t *buf, uintptr_t size) {
-  assert(buf);
-  for (uintptr_t i = 0; i < size; ++i)
-    assert(buf[i]);
-}
-
-int main() {
-  uintptr_t buf_size = 1 << 20;
-  std::unique_ptr<uintptr_t[]> buf(new uintptr_t[buf_size]);
-  __sanitizer_set_coverage_pc_buffer(buf.get(), buf_size);
-
-  {
-    uintptr_t sz = __sanitizer_get_coverage_pc_buffer_pos();
-    assertNotZeroPcs(buf.get(), sz);
-    assert(sz);
-  }
-
-  {
-    uintptr_t sz = __sanitizer_get_coverage_pc_buffer_pos();
-    foo();
-    uintptr_t sz1 = __sanitizer_get_coverage_pc_buffer_pos();
-    assertNotZeroPcs(buf.get(), sz1);
-    assert(sz1 > sz);
-  }
-
-  {
-    uintptr_t sz = __sanitizer_get_coverage_pc_buffer_pos();
-    // reset coverage to 0.
-    __sanitizer_reset_coverage();
-    uintptr_t sz1 = __sanitizer_get_coverage_pc_buffer_pos();
-    assertNotZeroPcs(buf.get(), sz1);
-    assert(sz1 < sz);
-  }
-}