* c-c++-common/ubsan/sanitize-recover-7.c (dg-options): Add -w.
[official-gcc.git] / libsanitizer / include / sanitizer / coverage_interface.h
blobffb956c39db59327e421919320d0181ea4351c73
1 //===-- sanitizer/coverage_interface.h --------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // Public interface for sanitizer coverage.
9 //===----------------------------------------------------------------------===//
11 #ifndef SANITIZER_COVERAG_INTERFACE_H
12 #define SANITIZER_COVERAG_INTERFACE_H
14 #include <sanitizer/common_interface_defs.h>
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
20 // Initialize coverage.
21 void __sanitizer_cov_init();
22 // Record and dump coverage info.
23 void __sanitizer_cov_dump();
24 // Open <name>.sancov.packed in the coverage directory and return the file
25 // descriptor. Returns -1 on failure, or if coverage dumping is disabled.
26 // This is intended for use by sandboxing code.
27 intptr_t __sanitizer_maybe_open_cov_file(const char *name);
28 // Get the number of unique covered blocks (or edges).
29 // This can be useful for coverage-directed in-process fuzzers.
30 uintptr_t __sanitizer_get_total_unique_coverage();
31 // Get the number of unique indirect caller-callee pairs.
32 uintptr_t __sanitizer_get_total_unique_caller_callee_pairs();
34 // Reset the basic-block (edge) coverage to the initial state.
35 // Useful for in-process fuzzing to start collecting coverage from scratch.
36 // Experimental, will likely not work for multi-threaded process.
37 void __sanitizer_reset_coverage();
38 // Set *data to the array of covered PCs and return the size of that array.
39 // Some of the entries in *data will be zero.
40 uintptr_t __sanitizer_get_coverage_guards(uintptr_t **data);
42 // The coverage instrumentation may optionally provide imprecise counters.
43 // Rather than exposing the counter values to the user we instead map
44 // the counters to a bitset.
45 // Every counter is associated with 8 bits in the bitset.
46 // We define 8 value ranges: 1, 2, 3, 4-7, 8-15, 16-31, 32-127, 128+
47 // The i-th bit is set to 1 if the counter value is in the i-th range.
48 // This counter-based coverage implementation is *not* thread-safe.
50 // Returns the number of registered coverage counters.
51 uintptr_t __sanitizer_get_number_of_counters();
52 // Updates the counter 'bitset', clears the counters and returns the number of
53 // new bits in 'bitset'.
54 // If 'bitset' is nullptr, only clears the counters.
55 // Otherwise 'bitset' should be at least
56 // __sanitizer_get_number_of_counters bytes long and 8-aligned.
57 uintptr_t
58 __sanitizer_update_counter_bitset_and_clear_counters(uint8_t *bitset);
60 #ifdef __cplusplus
61 } // extern "C"
62 #endif
64 #endif // SANITIZER_COVERAG_INTERFACE_H