[compiler-rt] r228017 - [sanitizer] move the coverage interface into a separate header, <sanitizer/coverage_interface.h>. NFC, except for the header name change. This may break existing users, but in this case it's better this way (not too many users so far)

Kostya Serebryany kcc at google.com
Tue Feb 3 11:40:53 PST 2015


Author: kcc
Date: Tue Feb  3 13:40:53 2015
New Revision: 228017

URL: http://llvm.org/viewvc/llvm-project?rev=228017&view=rev
Log:
[sanitizer] move the coverage interface into a separate header, <sanitizer/coverage_interface.h>. NFC, except for the header name change. This may break existing users, but in this case it's better this way (not too many users so far) 

Added:
    compiler-rt/trunk/include/sanitizer/coverage_interface.h
Modified:
    compiler-rt/trunk/include/CMakeLists.txt
    compiler-rt/trunk/include/sanitizer/common_interface_defs.h
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-maybe-open-file.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-reset.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-sandboxing.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage.cc

Modified: compiler-rt/trunk/include/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/CMakeLists.txt?rev=228017&r1=228016&r2=228017&view=diff
==============================================================================
--- compiler-rt/trunk/include/CMakeLists.txt (original)
+++ compiler-rt/trunk/include/CMakeLists.txt Tue Feb  3 13:40:53 2015
@@ -2,6 +2,7 @@ set(SANITIZER_HEADERS
   sanitizer/allocator_interface.h
   sanitizer/asan_interface.h
   sanitizer/common_interface_defs.h
+  sanitizer/coverage_interface.h
   sanitizer/dfsan_interface.h
   sanitizer/linux_syscall_hooks.h
   sanitizer/lsan_interface.h

Modified: compiler-rt/trunk/include/sanitizer/common_interface_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/common_interface_defs.h?rev=228017&r1=228016&r2=228017&view=diff
==============================================================================
--- compiler-rt/trunk/include/sanitizer/common_interface_defs.h (original)
+++ compiler-rt/trunk/include/sanitizer/common_interface_defs.h Tue Feb  3 13:40:53 2015
@@ -62,26 +62,6 @@ extern "C" {
   void __sanitizer_unaligned_store32(void *p, uint32_t x);
   void __sanitizer_unaligned_store64(void *p, uint64_t x);
 
-  // Initialize coverage.
-  void __sanitizer_cov_init();
-  // Record and dump coverage info.
-  void __sanitizer_cov_dump();
-  // Open <name>.sancov.packed in the coverage directory and return the file
-  // descriptor. Returns -1 on failure, or if coverage dumping is disabled.
-  // This is intended for use by sandboxing code.
-  intptr_t __sanitizer_maybe_open_cov_file(const char *name);
-  // Get the number of total unique covered entities (blocks, edges, calls).
-  // 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);
-
   // Annotate the current state of a contiguous container, such as
   // std::vector, std::string or similar.
   // A contiguous container is a container that keeps all of its elements

Added: compiler-rt/trunk/include/sanitizer/coverage_interface.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/coverage_interface.h?rev=228017&view=auto
==============================================================================
--- compiler-rt/trunk/include/sanitizer/coverage_interface.h (added)
+++ compiler-rt/trunk/include/sanitizer/coverage_interface.h Tue Feb  3 13:40:53 2015
@@ -0,0 +1,46 @@
+//===-- sanitizer/coverage_interface.h --------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Public interface for sanitizer coverage.
+//===----------------------------------------------------------------------===//
+
+#ifndef SANITIZER_COVERAG_INTERFACE_H
+#define SANITIZER_COVERAG_INTERFACE_H
+
+#include <sanitizer/common_interface_defs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+  // Initialize coverage.
+  void __sanitizer_cov_init();
+  // Record and dump coverage info.
+  void __sanitizer_cov_dump();
+  // Open <name>.sancov.packed in the coverage directory and return the file
+  // descriptor. Returns -1 on failure, or if coverage dumping is disabled.
+  // This is intended for use by sandboxing code.
+  intptr_t __sanitizer_maybe_open_cov_file(const char *name);
+  // Get the number of total unique covered entities (blocks, edges, calls).
+  // 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
+
+#endif  // SANITIZER_COVERAG_INTERFACE_H

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc?rev=228017&r1=228016&r2=228017&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc Tue Feb  3 13:40:53 2015
@@ -6,7 +6,7 @@
 //
 // REQUIRES: asan-64-bits
 
-#include <sanitizer/common_interface_defs.h>
+#include <sanitizer/coverage_interface.h>
 #include <stdio.h>
 #include <assert.h>
 int P = 0;

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-maybe-open-file.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-maybe-open-file.cc?rev=228017&r1=228016&r2=228017&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-maybe-open-file.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-maybe-open-file.cc Tue Feb  3 13:40:53 2015
@@ -13,7 +13,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <sanitizer/common_interface_defs.h>
+#include <sanitizer/coverage_interface.h>
 
 int main(int argc, char **argv) {
   int fd = __sanitizer_maybe_open_cov_file("test");

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-reset.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-reset.cc?rev=228017&r1=228016&r2=228017&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-reset.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-reset.cc Tue Feb  3 13:40:53 2015
@@ -3,7 +3,7 @@
 // RUN: %clangxx_asan -fsanitize-coverage=1 %s -o %t
 // RUN: ASAN_OPTIONS=coverage=1 %run %t
 
-#include <sanitizer/common_interface_defs.h>
+#include <sanitizer/coverage_interface.h>
 #include <stdio.h>
 #include <assert.h>
 static volatile int sink;

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-sandboxing.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-sandboxing.cc?rev=228017&r1=228016&r2=228017&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-sandboxing.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-sandboxing.cc Tue Feb  3 13:40:53 2015
@@ -27,7 +27,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <sanitizer/common_interface_defs.h>
+#include <sanitizer/coverage_interface.h>
 
 #define bb0(n)                        \
   case n:                             \

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/coverage.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage.cc?rev=228017&r1=228016&r2=228017&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage.cc Tue Feb  3 13:40:53 2015
@@ -13,7 +13,7 @@
 // https://code.google.com/p/address-sanitizer/issues/detail?id=263
 // XFAIL: android
 
-#include "sanitizer/common_interface_defs.h"
+#include <sanitizer/coverage_interface.h>
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>





More information about the llvm-commits mailing list