Update exec counts in objective (#1945)
* fix * fix * update exec count
This commit is contained in:
parent
5cc0180835
commit
e30ff57456
@ -303,10 +303,15 @@ where
|
||||
// Correctly handled the event
|
||||
Ok(BrokerEventResult::Handled)
|
||||
}
|
||||
Event::Objective { objective_size } => {
|
||||
Event::Objective {
|
||||
objective_size,
|
||||
executions,
|
||||
time,
|
||||
} => {
|
||||
monitor.client_stats_insert(client_id);
|
||||
let client = monitor.client_stats_mut_for(client_id);
|
||||
client.update_objective_size(*objective_size as u64);
|
||||
client.update_executions(*executions, *time);
|
||||
monitor.display(event.name(), client_id);
|
||||
Ok(BrokerEventResult::Handled)
|
||||
}
|
||||
|
@ -338,6 +338,10 @@ where
|
||||
Objective {
|
||||
/// Objective corpus size
|
||||
objective_size: usize,
|
||||
/// The total number of executions when this objective is found
|
||||
executions: u64,
|
||||
/// The time when this event was created
|
||||
time: Duration,
|
||||
},
|
||||
/// Write a new log
|
||||
Log {
|
||||
|
@ -262,11 +262,18 @@ where
|
||||
monitor.display(event.name(), ClientId(0));
|
||||
Ok(BrokerEventResult::Handled)
|
||||
}
|
||||
Event::Objective { objective_size } => {
|
||||
Event::Objective {
|
||||
objective_size,
|
||||
executions,
|
||||
time,
|
||||
} => {
|
||||
monitor.client_stats_insert(ClientId(0));
|
||||
monitor
|
||||
.client_stats_mut_for(ClientId(0))
|
||||
.update_objective_size(*objective_size as u64);
|
||||
monitor
|
||||
.client_stats_mut_for(ClientId(0))
|
||||
.update_executions(*executions, *time);
|
||||
monitor.display(event.name(), ClientId(0));
|
||||
Ok(BrokerEventResult::Handled)
|
||||
}
|
||||
|
@ -386,10 +386,15 @@ where
|
||||
// Correctly handled the event
|
||||
Ok(BrokerEventResult::Handled)
|
||||
}
|
||||
Event::Objective { objective_size } => {
|
||||
Event::Objective {
|
||||
objective_size,
|
||||
executions,
|
||||
time,
|
||||
} => {
|
||||
monitor.client_stats_insert(client_id);
|
||||
let client = monitor.client_stats_mut_for(client_id);
|
||||
client.update_objective_size(*objective_size as u64);
|
||||
client.update_executions(*executions, *time);
|
||||
monitor.display(event.name(), client_id);
|
||||
Ok(BrokerEventResult::Handled)
|
||||
}
|
||||
|
@ -450,7 +450,8 @@ pub fn run_observers_and_save_state<E, EM, OF, Z>(
|
||||
.expect("In run_observers_and_save_state objective failure.");
|
||||
|
||||
if interesting {
|
||||
let mut new_testcase = Testcase::with_executions(input.clone(), *state.executions());
|
||||
let executions = *state.executions();
|
||||
let mut new_testcase = Testcase::with_executions(input.clone(), executions);
|
||||
new_testcase.add_metadata(exitkind);
|
||||
new_testcase.set_parent_id_optional(*state.corpus().current());
|
||||
fuzzer
|
||||
@ -466,6 +467,8 @@ pub fn run_observers_and_save_state<E, EM, OF, Z>(
|
||||
state,
|
||||
Event::Objective {
|
||||
objective_size: state.solutions().count(),
|
||||
executions,
|
||||
time: libafl_bolts::current_time(),
|
||||
},
|
||||
)
|
||||
.expect("Could not save state in run_observers_and_save_state");
|
||||
|
@ -415,8 +415,9 @@ where
|
||||
// Not interesting
|
||||
self.feedback_mut().discard_metadata(state, &input)?;
|
||||
|
||||
let executions = *state.executions();
|
||||
// The input is a solution, add it to the respective corpus
|
||||
let mut testcase = Testcase::with_executions(input, *state.executions());
|
||||
let mut testcase = Testcase::with_executions(input, executions);
|
||||
testcase.set_parent_id_optional(*state.corpus().current());
|
||||
self.objective_mut()
|
||||
.append_metadata(state, manager, observers, &mut testcase)?;
|
||||
@ -427,6 +428,8 @@ where
|
||||
state,
|
||||
Event::Objective {
|
||||
objective_size: state.solutions().count(),
|
||||
executions,
|
||||
time: current_time(),
|
||||
},
|
||||
)?;
|
||||
}
|
||||
@ -520,10 +523,13 @@ where
|
||||
.append_metadata(state, manager, observers, &mut testcase)?;
|
||||
let idx = state.solutions_mut().add(testcase)?;
|
||||
|
||||
let executions = *state.executions();
|
||||
manager.fire(
|
||||
state,
|
||||
Event::Objective {
|
||||
objective_size: state.solutions().count(),
|
||||
executions,
|
||||
time: current_time(),
|
||||
},
|
||||
)?;
|
||||
return Ok(idx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user