{ StdMutational(SM, PhantomData
),
PowerMutational(P, PhantomData MutationalStage
where
- SM: MutationalStage Named for SupportedMutationalStages
where
- SM: Named,
P: Named,
+ SM: Named,
{
fn name(&self) -> &Cow<'static, str> {
match self {
@@ -57,10 +57,10 @@ where
}
}
-impl
where
- SM: Stage Restartable
+where
+ P: Restartable MutationalStage for SupportedMutationalStages for SupportedMutationalStages,
P: MutationalStage,
+ SM: MutationalStage,
{
type Mutator = SM::Mutator;
/// The mutator, added to this stage
@@ -44,10 +44,10 @@ where
}
}
-impl for SupportedMutationalStages,
+ SM: Restartable,
+{
fn should_restart(&mut self, state: &mut S) -> Result for AflStatsStage for CalibrationStage for ColorizationStage for ConcolicTracingStage<'_, EM, I, TE, S, Z>
+where
+ S: HasMetadata + HasNamedMetadata + HasCurrentCorpusId,
+{
fn should_restart(&mut self, state: &mut S) -> Result for SimpleConcolicMutationalStage
+where
+ S: HasMetadata + HasNamedMetadata + HasCurrentCorpusId,
+{
#[inline]
fn should_restart(&mut self, state: &mut S) -> Result
+ for DumpToDiskStage for GeneralizationStage(state, &self.name)
}
+}
+impl for GenStage(state: &mut S, _stage: &ST) -> Result(state: &mut S, _stage: &ST) -> Result<(), Error>
where
- S: HasNestedStageStatus,
+ S: HasNestedStage,
{
state.exit_inner_stage()?;
Ok(())
@@ -41,7 +42,7 @@ impl for WhileStage for IfStage for IfElseStage for OptionalStage {
+ phantom: PhantomData,
+ }
+ #[derive(Debug)]
+ pub struct ResumeFailedStage {
+ completed: Rc,
+ }
+ #[derive(Serialize, Deserialize, Debug)]
+ pub struct TestProgress {
+ count: usize,
+ }
+
+ impl_serdeany!(TestProgress);
+
+ impl TestProgress {
+ #[expect(clippy::unnecessary_wraps)]
+ fn should_restart(state: &mut S, _stage: &ST) -> Result(state: &mut S, _stage: &ST) -> Result<(), Error>
+ where
+ S: HasMetadata,
+ {
+ if state.remove_metadata::
+ where
+ S: HasMetadata,
+ {
+ fn perform(
+ &mut self,
+ _fuzzer: &mut Z,
+ _executor: &mut E,
+ state: &mut S,
+ _manager: &mut EM,
+ ) -> Result<(), Error> {
+ // metadata is attached by the status
+ let meta = state.metadata_mut:: Restartable for ResumeSucceededStage
+ where
+ S: HasMetadata,
+ {
+ fn should_restart(&mut self, state: &mut S) -> Result
+ where
+ S: HasMetadata,
+ {
+ fn perform(
+ &mut self,
+ _fuzzer: &mut Z,
+ _executor: &mut E,
+ state: &mut S,
+ _manager: &mut EM,
+ ) -> Result<(), Error> {
+ // metadata is attached by the status
+ let meta = state.metadata_mut:: Restartable for ResumeFailedStage
+ where
+ S: HasMetadata,
+ {
+ fn should_restart(&mut self, state: &mut S) -> Result() -> (
+ Rc, ResumeFailedStage),
+ ) {
+ let completed = Rc::new(RefCell::new(false));
+ (
+ completed.clone(),
+ tuple_list!(
+ ResumeSucceededStage {
+ phantom: PhantomData
+ },
+ ResumeFailedStage {
+ completed,
+ phantom: PhantomData
+ },
+ ),
+ )
+ }
+
+ pub fn test_resume {
+ phantom: PhantomData,
+ }
+ impl PanicStage {
+ pub fn new() -> Self {
+ Self {
+ phantom: PhantomData,
+ }
+ }
+ }
+ impl {
+ fn perform(
+ &mut self,
+ _fuzzer: &mut Z,
+ _executor: &mut E,
+ _state: &mut S,
+ _manager: &mut EM,
+ ) -> Result<(), Error> {
+ panic!("Test failed; panic stage should never be executed.");
+ }
+ }
+
+ impl Restartable for PanicStage {
+ fn should_restart(&mut self, _state: &mut S) -> Result {
+ /// 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 [`Restartable::clear_progress`], all subsequent calls happen on restart.
+ /// Returns `true`, if the stage's [`Stage::perform`] method should run, else `false`.
+ fn should_restart(&mut self, state: &mut S) -> Result,
Tail: StagesTuple {
+ fn perform_restartable(
+ &mut self,
+ fuzzer: &mut Z,
+ executor: &mut E,
+ state: &mut S,
+ manager: &mut EM,
+ ) -> Result<(), Error>;
+}
+
+impl,
+{
+ /// Run the stage, calling [`Stage::should_restart`] and [`Stage::clear_progress`] appropriately
+ fn perform_restartable(
+ &mut self,
+ fuzzer: &mut Z,
+ executor: &mut E,
+ state: &mut S,
+ manager: &mut EM,
+ ) -> Result<(), Error> {
+ if self.should_restart(state)? {
+ self.perform(fuzzer, executor, state, manager)?;
+ }
+ self.clear_progress(state)
+ }
+}
+
+impl for ClosureStage