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 restart_progress_should_run(
&mut self,
state: &mut Self::State
) -> Result<bool, Error>;
fn clear_restart_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 restart_progress_should_run(
&mut self,
state: &mut Self::State
) -> Result<bool, Error>
fn restart_progress_should_run( &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_restart_progress
, all subsequent calls happen on restart.
Returns true
, if the stage’s Stage::perform
method should run, else false
.
sourcefn clear_restart_progress(
&mut self,
state: &mut Self::State
) -> Result<(), Error>
fn clear_restart_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::restart_progress_should_run
will be (must be!) called.
After returning (so non-target crash or timeout in a restarting case), Stage::clear_restart_progress
gets called.
A call to Stage::perform_restartable
will do these things implicitly.
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::restart_progress_should_run
and Stage::clear_restart_progress
appropriately