pub trait CanTrack {
type WithIndexTracking: CanTrack;
type WithNoveltiesTracking: CanTrack;
const INDICES: bool;
const NOVELTIES: bool;
// Required methods
fn track_indices(self) -> Self::WithIndexTracking;
fn track_novelties(self) -> Self::WithNoveltiesTracking;
}
Expand description
Trait marker which indicates that this MapObserver
is tracked for indices or novelties.
Implementors of feedbacks similar to crate::feedbacks::MapFeedback
may wish to use this to
ensure that edge metadata is recorded as is appropriate for the provided observer.
If you get a type constraint failure for your map due to this type being unfulfilled, you must
call CanTrack::track_indices
or CanTrack::track_novelties
at
the initialisation site of your map.
This trait allows various components which interact with map metadata to ensure that the
information they need is actually recorded by the map feedback.
For example, if you are using crate::schedulers::MinimizerScheduler
:
use libafl::feedbacks::MaxMapFeedback;
use libafl::observers::{StdMapObserver, CanTrack};
use libafl::schedulers::{IndexesLenTimeMinimizerScheduler, QueueScheduler};
use libafl_bolts::ownedref::OwnedMutSlice;
// initialise your map as necessary
let edges_observer = StdMapObserver::from_ownedref("edges", OwnedMutSlice::from(vec![0u8; 16]));
// inform the feedback to track indices (required by IndexesLenTimeMinimizerScheduler), but not novelties
// this *MUST* be done before it is passed to MaxMapFeedback!
let edges_observer = edges_observer.track_indices();
// init the feedback
let mut feedback = MaxMapFeedback::new(&edges_observer);
let scheduler = IndexesLenTimeMinimizerScheduler::new(&edges_observer, QueueScheduler::new());
MapObserver
implementors: see StdMapObserver
for an example implementation.
Required Associated Types§
sourcetype WithIndexTracking: CanTrack
type WithIndexTracking: CanTrack
The resulting type of enabling index tracking.
sourcetype WithNoveltiesTracking: CanTrack
type WithNoveltiesTracking: CanTrack
The resulting type of enabling novelty tracking.
Required Associated Constants§
sourceconst INDICES: bool
const INDICES: bool
Whether indices should be tracked for this MapObserver
.
sourceconst NOVELTIES: bool
const NOVELTIES: bool
Whether novelties should be tracked for this MapObserver
.
Required Methods§
sourcefn track_indices(self) -> Self::WithIndexTracking
fn track_indices(self) -> Self::WithIndexTracking
Convert this map observer into one that tracks indices.
sourcefn track_novelties(self) -> Self::WithNoveltiesTracking
fn track_novelties(self) -> Self::WithNoveltiesTracking
Convert this map observer into one that tracks novelties.