diff --git a/libafl/Cargo.toml b/libafl/Cargo.toml index e872e2e8f1..18b737bc89 100644 --- a/libafl/Cargo.toml +++ b/libafl/Cargo.toml @@ -163,7 +163,7 @@ nix = { version = "0.29", optional = true } regex = { version = "1", optional = true } uuid = { version = "1.4", optional = true, features = ["serde", "v4"] } libm = "0.2.2" -ratatui = { version = "0.23.0", default-features = false, features = ['crossterm'], optional = true } # Commandline rendering, for TUI Monitor +ratatui = { version = "0.26.3", default-features = false, features = ['crossterm'], optional = true } # Commandline rendering, for TUI Monitor crossterm = { version = "0.27.0", optional = true } prometheus-client = { version = "0.22", optional = true } # For the prometheus monitor diff --git a/libafl/src/monitors/tui/ui.rs b/libafl/src/monitors/tui/ui.rs index 5790b63bf4..1a2dc47c93 100644 --- a/libafl/src/monitors/tui/ui.rs +++ b/libafl/src/monitors/tui/ui.rs @@ -5,7 +5,6 @@ use std::{ }; use ratatui::{ - backend::Backend, layout::{Alignment, Constraint, Direction, Layout, Rect}, style::{Color, Modifier, Style}, symbols, @@ -94,10 +93,7 @@ impl TuiUI { } } - pub fn draw(&mut self, f: &mut Frame, app: &Arc>) - where - B: Backend, - { + pub fn draw(&mut self, f: &mut Frame, app: &Arc>) { self.clients = app.read().unwrap().clients_num; let body = Layout::default() @@ -134,10 +130,7 @@ impl TuiUI { } #[allow(clippy::too_many_lines)] - fn draw_overall_ui(&mut self, f: &mut Frame, app: &Arc>, area: Rect) - where - B: Backend, - { + fn draw_overall_ui(&mut self, f: &mut Frame, app: &Arc>, area: Rect) { let top_layout = Layout::default() .direction(Direction::Vertical) .constraints([Constraint::Length(16), Constraint::Min(0)].as_ref()) @@ -252,10 +245,7 @@ impl TuiUI { self.draw_overall_generic_text(f, app, bottom_layout); } - fn draw_client_ui(&mut self, f: &mut Frame, app: &Arc>, area: Rect) - where - B: Backend, - { + fn draw_client_ui(&mut self, f: &mut Frame, app: &Arc>, area: Rect) { let client_block = Block::default() .title(Span::styled( format!("client #{} (l/r arrows to switch)", self.clients_idx), @@ -304,16 +294,14 @@ impl TuiUI { } #[allow(clippy::too_many_lines, clippy::cast_precision_loss)] - fn draw_time_chart( + fn draw_time_chart( &mut self, title: &str, y_name: &str, - f: &mut Frame, + f: &mut Frame, area: Rect, stats: &TimedStats, - ) where - B: Backend, - { + ) { if stats.series.is_empty() { return; } @@ -430,15 +418,13 @@ impl TuiUI { f.render_widget(chart, area); } - fn draw_item_geometry_text( + fn draw_item_geometry_text( &mut self, - f: &mut Frame, + f: &mut Frame, app: &Arc>, area: Rect, is_overall: bool, - ) where - B: Backend, - { + ) { let item_geometry: ItemGeometry = if is_overall { app.read().unwrap().total_item_geometry.clone() } else if self.clients < 2 { @@ -486,7 +472,8 @@ impl TuiUI { ) .split(area); - let table = Table::new(items) + let table = Table::default() + .rows(items) .block( Block::default() .title(Span::styled( @@ -497,19 +484,17 @@ impl TuiUI { )) .borders(Borders::ALL), ) - .widths(&[Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]); + .widths([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]); f.render_widget(table, chunks[0]); } - fn draw_process_timing_text( + fn draw_process_timing_text( &mut self, - f: &mut Frame, + f: &mut Frame, app: &Arc>, area: Rect, is_overall: bool, - ) where - B: Backend, - { + ) { let tup: (Duration, ProcessTiming) = if is_overall { let tui_context = app.read().unwrap(); ( @@ -560,7 +545,8 @@ impl TuiUI { ) .split(area); - let table = Table::new(items) + let table = Table::default() + .rows(items) .block( Block::default() .title(Span::styled( @@ -571,18 +557,16 @@ impl TuiUI { )) .borders(Borders::ALL), ) - .widths(&[Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]); + .widths([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]); f.render_widget(table, chunks[0]); } - fn draw_overall_generic_text( + fn draw_overall_generic_text( &mut self, - f: &mut Frame, + f: &mut Frame, app: &Arc>, area: Rect, - ) where - B: Backend, - { + ) { let items = { let app = app.read().unwrap(); vec![ @@ -609,7 +593,8 @@ impl TuiUI { .constraints([Constraint::Percentage(100)].as_ref()) .split(area); - let table = Table::new(items) + let table = Table::default() + .rows(items) .block( Block::default() .title(Span::styled( @@ -620,7 +605,7 @@ impl TuiUI { )) .borders(Borders::ALL), ) - .widths(&[ + .widths([ Constraint::Percentage(15), Constraint::Percentage(16), Constraint::Percentage(15), @@ -631,14 +616,12 @@ impl TuiUI { f.render_widget(table, chunks[0]); } - fn draw_client_results_text( + fn draw_client_results_text( &mut self, - f: &mut Frame, + f: &mut Frame, app: &Arc>, area: Rect, - ) where - B: Backend, - { + ) { let items = { let app = app.read().unwrap(); vec![ @@ -667,7 +650,8 @@ impl TuiUI { .constraints([Constraint::Percentage(100)].as_ref()) .split(area); - let table = Table::new(items) + let table = Table::default() + .rows(items) .block( Block::default() .title(Span::styled( @@ -678,18 +662,16 @@ impl TuiUI { )) .borders(Borders::ALL), ) - .widths(&[Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]); + .widths([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]); f.render_widget(table, chunks[0]); } - fn draw_client_generic_text( + fn draw_client_generic_text( &mut self, - f: &mut Frame, + f: &mut Frame, app: &Arc>, area: Rect, - ) where - B: Backend, - { + ) { let items = { let app = app.read().unwrap(); vec![ @@ -724,7 +706,8 @@ impl TuiUI { .constraints([Constraint::Percentage(100)].as_ref()) .split(area); - let table = Table::new(items) + let table = Table::default() + .rows(items) .block( Block::default() .title(Span::styled( @@ -735,19 +718,17 @@ impl TuiUI { )) .borders(Borders::ALL), ) - .widths(&[Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]); + .widths([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]); f.render_widget(table, chunks[0]); } #[cfg(feature = "introspection")] - fn draw_introspection_text( + fn draw_introspection_text( &mut self, - f: &mut Frame, + f: &mut Frame, app: &Arc>, area: Rect, - ) where - B: Backend, - { + ) { let mut items = vec![]; { let ctx = app.read().unwrap(); @@ -786,7 +767,8 @@ impl TuiUI { }; } - let table = Table::new(items) + let table = Table::default() + .rows(items) .block( Block::default() .title(Span::styled( @@ -797,14 +779,11 @@ impl TuiUI { )) .borders(Borders::ALL), ) - .widths(&[Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]); + .widths([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]); f.render_widget(table, area); } #[allow(clippy::unused_self)] - fn draw_logs(&mut self, f: &mut Frame, app: &Arc>, area: Rect) - where - B: Backend, - { + fn draw_logs(&mut self, f: &mut Frame, app: &Arc>, area: Rect) { let app = app.read().unwrap(); let logs: Vec = app .client_logs diff --git a/libafl_cc/build.rs b/libafl_cc/build.rs index 57e83e3ec8..1b44657b13 100644 --- a/libafl_cc/build.rs +++ b/libafl_cc/build.rs @@ -203,22 +203,22 @@ fn build_pass( Ok(s) => { if !s.success() { if optional { - println!("cargo:warning=Skipping src/{src_file}"); + println!("cargo:warning=Skipping src/{src_file} - Exit status: {s}"); } else { - panic!("Failed to compile {src_file}"); + panic!("Failed to compile {src_file} - Exit status: {s}"); } } } - Err(_) => { + Err(err) => { if optional { - println!("cargo:warning=Skipping src/{src_file}"); + println!("cargo:warning=Skipping src/{src_file} - {err}"); } else { - panic!("Failed to compile {src_file}"); + panic!("Failed to compile {src_file} - {err}"); } } }, None => { - println!("cargo:warning=Skipping src/{src_file}"); + println!("cargo:warning=Skipping src/{src_file} - Only supported on Windows or *nix."); } } }