1 //===-- sanitizer/coverage_interface.h --------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // Public interface for sanitizer coverage. 11 //===----------------------------------------------------------------------===// 12 13 #ifndef SANITIZER_COVERAG_INTERFACE_H 14 #define SANITIZER_COVERAG_INTERFACE_H 15 16 #include <sanitizer/common_interface_defs.h> 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 // Initialize coverage. 23 void __sanitizer_cov_init(); 24 // Record and dump coverage info. 25 void __sanitizer_cov_dump(); 26 27 // Dump collected coverage info. Sorts pcs by module into individual 28 // .sancov files. 29 void __sanitizer_dump_coverage(const uintptr_t *pcs, uintptr_t len); 30 31 // Open <name>.sancov.packed in the coverage directory and return the file 32 // descriptor. Returns -1 on failure, or if coverage dumping is disabled. 33 // This is intended for use by sandboxing code. 34 intptr_t __sanitizer_maybe_open_cov_file(const char *name); 35 // Get the number of unique covered blocks (or edges). 36 // This can be useful for coverage-directed in-process fuzzers. 37 uintptr_t __sanitizer_get_total_unique_coverage(); 38 39 // Reset the basic-block (edge) coverage to the initial state. 40 // Useful for in-process fuzzing to start collecting coverage from scratch. 41 // Experimental, will likely not work for multi-threaded process. 42 void __sanitizer_reset_coverage(); 43 // Set *data to the array of covered PCs and return the size of that array. 44 // Some of the entries in *data will be zero. 45 uintptr_t __sanitizer_get_coverage_guards(uintptr_t **data); 46 #ifdef __cplusplus 47 } // extern "C" 48 #endif 49 50 #endif // SANITIZER_COVERAG_INTERFACE_H 51