From ebae4d3ce80412ea7d0daaa8da3b7f4ed393c058 Mon Sep 17 00:00:00 2001 From: Patrick Gersch Date: Mon, 29 Aug 2022 14:43:00 +0200 Subject: [PATCH] MapFeedback: Adding support for with_name() (#752) * Adding support for with_name() * Adding with_name() function description --- libafl/src/feedbacks/map.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libafl/src/feedbacks/map.rs b/libafl/src/feedbacks/map.rs index fec1132bb8..9458003ed3 100644 --- a/libafl/src/feedbacks/map.rs +++ b/libafl/src/feedbacks/map.rs @@ -633,6 +633,21 @@ where } } + /// Creating a new `MapFeedback` with a specific name. This is usefully whenever the same + /// feedback is needed twice, but with a different history. Using `new()` always results in the + /// same name and therefore also the same history. + #[must_use] + pub fn with_name(name: &'static str, map_observer: &O) -> Self { + Self { + indexes: None, + novelties: None, + name: name.to_string(), + observer_name: map_observer.name().to_string(), + stats_name: create_stats_name(name), + phantom: PhantomData, + } + } + /// Create new `MapFeedback` specifying if it must track indexes of used entries and/or novelties #[must_use] pub fn with_names_tracking(