Keeps track of the global coverage seen across the input corpus.
| 10 | |
| 11 | /// Keeps track of the global coverage seen across the input corpus. |
| 12 | pub trait Coverage { |
| 13 | /// Get a estimate of the global coverage. |
| 14 | fn count(&self) -> u64; |
| 15 | |
| 16 | /// Return a reference to the bits in the coverage map. |
| 17 | fn get_bits<'a>(&self, vm: &'a mut Vm) -> &'a [u64]; |
| 18 | |
| 19 | /// Return the the index of any newly hit bits in the current coverage map. |
| 20 | fn new_bits(&mut self, vm: &mut Vm) -> Vec<u32>; |
| 21 | |
| 22 | /// Merge the local coverage state with the global state, returning true if coverage increased. |
| 23 | fn merge(&mut self, vm: &mut Vm) -> bool; |
| 24 | |
| 25 | fn serialize(&self, _vm: &mut Vm, _out: &mut String) {} |
| 26 | |
| 27 | /// Called at the very start of execution. Note: typically `restore_local` is used for |
| 28 | /// resetting testcases between testcase executions. |
| 29 | fn reset(&mut self, vm: &mut Vm); |
| 30 | |
| 31 | /// Create a snapshot of the (local) coverage state that can be later restored. |
| 32 | fn snapshot_local(&mut self, vm: &mut Vm) -> Box<dyn Any>; |
| 33 | |
| 34 | /// Restore the (local) coverage state to a previously saved snapshot. |
| 35 | fn restore_local(&mut self, vm: &mut Vm, snapshot: &Box<dyn Any>); |
| 36 | } |
| 37 | |
| 38 | pub trait CoverageAny: Coverage { |
| 39 | fn as_any(&self) -> &dyn std::any::Any; |
nothing calls this directly
no outgoing calls
no test coverage detected