From 3fcb9a74e0bedbe65edd04845c0b1451b18e9217 Mon Sep 17 00:00:00 2001 From: Alwin Berger Date: Mon, 25 Sep 2023 12:14:23 +0200 Subject: [PATCH] add graph printing --- fuzzers/FRET/src/systemstate/graph.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/fuzzers/FRET/src/systemstate/graph.rs b/fuzzers/FRET/src/systemstate/graph.rs index 5e72d7b2cd..81a628918e 100644 --- a/fuzzers/FRET/src/systemstate/graph.rs +++ b/fuzzers/FRET/src/systemstate/graph.rs @@ -110,6 +110,15 @@ impl SysGraphNode { pub fn get_input_counts(&self) -> Vec { self.variants.iter().map(|x| x.input_counter).collect() } + pub fn pretty_print(&self) -> String { + let mut ret = String::new(); + ret.push_str(&format!("{}#{}",&self.base.current_task.0.task_name,&self.base.current_task.1)); + ret.push_str("\nRl:"); + for i in &self.base.delay_list_after { + ret.push_str(&format!("\n{}#{}",i.0.task_name,i.1)); + } + ret + } } impl PartialEq for SysGraphNode { fn eq(&self, other: &SysGraphNode) -> bool { @@ -156,7 +165,7 @@ pub type GraphMaximizerCorpusScheduler = //============================= Graph Feedback /// Improved System State Graph -#[derive(Serialize, Deserialize, Clone, Debug, Default, SerdeAny)] +#[derive(Serialize, Deserialize, Clone, Debug, SerdeAny)] pub struct SysGraphFeedbackState { pub graph: DiGraph, @@ -233,6 +242,11 @@ impl Named for SysGraphFeedbackState &self.name } } +impl Default for SysGraphFeedbackState { + fn default() -> Self { + Self::new() + } +} impl SysGraphFeedbackState { fn reset(&mut self) -> Result<(), Error> {