started observers
This commit is contained in:
parent
07bb8ae183
commit
ac4e71390a
@ -1 +1,8 @@
|
|||||||
pub trait Feedback {}
|
use crate::corpus::Testcase;
|
||||||
|
use crate::executors::Executor;
|
||||||
|
|
||||||
|
pub trait Feedback {
|
||||||
|
|
||||||
|
fn is_interesting(&mut self, executor: &dyn Executor, entry: &dyn Testcase) -> f64;
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use crate::AflError;
|
use crate::AflError;
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
pub trait Observer {
|
pub trait Observer {
|
||||||
fn flush(&mut self) -> Result<(), AflError> {
|
fn flush(&mut self) -> Result<(), AflError> {
|
||||||
@ -11,3 +12,41 @@ pub trait Observer {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait MapObserver<MapT>: Observer {
|
||||||
|
|
||||||
|
// TODO: Rust
|
||||||
|
fn get_map(&self) -> &RefCell<Vec<MapT>>;
|
||||||
|
//fn get_map_mut(&mut self) -> &mut Vec<MapT>;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct U8MapObserver {
|
||||||
|
|
||||||
|
map: RefCell<Vec<u8>>,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Observer for U8MapObserver {
|
||||||
|
fn reset(&mut self) -> Result<(), AflError> {
|
||||||
|
|
||||||
|
// TODO: Clear
|
||||||
|
Err(AflError::Unknown)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MapObserver<u8> for U8MapObserver {
|
||||||
|
|
||||||
|
fn get_map(&self) -> &RefCell<Vec<u8>> {
|
||||||
|
// TODO: Rust this better
|
||||||
|
return &self.map;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl U8MapObserver {
|
||||||
|
pub fn new(map: RefCell<Vec<u8>>) -> Self {
|
||||||
|
U8MapObserver{map: map}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user