pub trait Stage<E, EM, Z>: UsesStatewhere
E: UsesState<State = Self::State>,
EM: UsesState<State = Self::State>,
Z: UsesState<State = Self::State>,{
// Required methods
fn should_restart(&mut self, state: &mut Self::State) -> Result<bool, Error>;
fn clear_progress(&mut self, state: &mut Self::State) -> Result<(), Error>;
fn perform(
&mut self,
fuzzer: &mut Z,
executor: &mut E,
state: &mut Self::State,
manager: &mut EM,
) -> Result<(), Error>;
// Provided method
fn perform_restartable(
&mut self,
fuzzer: &mut Z,
executor: &mut E,
state: &mut Self::State,
manager: &mut EM,
) -> Result<(), Error> { ... }
}
Expand description
A stage is one step in the fuzzing process. Multiple stages will be scheduled one by one for each input.
Required Methods§
sourcefn should_restart(&mut self, state: &mut Self::State) -> Result<bool, Error>
fn should_restart(&mut self, state: &mut Self::State) -> Result<bool, Error>
This method will be called before every call to Stage::perform
.
Initialize the restart tracking for this stage, if it is not yet initialized.
On restart, this will be called again.
As long as Stage::clear_progress
, all subsequent calls happen on restart.
Returns true
, if the stage’s Stage::perform
method should run, else false
.
sourcefn clear_progress(&mut self, state: &mut Self::State) -> Result<(), Error>
fn clear_progress(&mut self, state: &mut Self::State) -> Result<(), Error>
Clear the current status tracking of the associated stage
sourcefn perform(
&mut self,
fuzzer: &mut Z,
executor: &mut E,
state: &mut Self::State,
manager: &mut EM,
) -> Result<(), Error>
fn perform( &mut self, fuzzer: &mut Z, executor: &mut E, state: &mut Self::State, manager: &mut EM, ) -> Result<(), Error>
Run the stage.
Before a call to perform, Stage::should_restart
will be (must be!) called.
After returning (so non-target crash or timeout in a restarting case), Stage::clear_progress
gets called.
A call to Stage::perform_restartable
will do these things implicitly.
DON’T call this function directly except from preform_restartable
!!
Provided Methods§
sourcefn perform_restartable(
&mut self,
fuzzer: &mut Z,
executor: &mut E,
state: &mut Self::State,
manager: &mut EM,
) -> Result<(), Error>
fn perform_restartable( &mut self, fuzzer: &mut Z, executor: &mut E, state: &mut Self::State, manager: &mut EM, ) -> Result<(), Error>
Run the stage, calling Stage::should_restart
and Stage::clear_progress
appropriately