From a38d13f32326b72e59503a8280f610c52e018366 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 28 Oct 2024 21:20:03 -0400 Subject: Refactor WARP to use a module workflow for matching Also flush caches on view destruction and improve performance --- plugins/warp/src/plugin/create.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'plugins/warp/src/plugin/create.rs') diff --git a/plugins/warp/src/plugin/create.rs b/plugins/warp/src/plugin/create.rs index b404ae1c..966c69ca 100644 --- a/plugins/warp/src/plugin/create.rs +++ b/plugins/warp/src/plugin/create.rs @@ -1,5 +1,6 @@ use crate::cache::cached_function; use crate::convert::from_bn_type; +use crate::matcher::invalidate_function_matcher_cache; use binaryninja::binaryview::{BinaryView, BinaryViewExt}; use binaryninja::command::Command; use rayon::prelude::*; @@ -15,7 +16,6 @@ pub struct CreateSignatureFile; impl Command for CreateSignatureFile { fn action(&self, view: &BinaryView) { let mut signature_dir = binaryninja::user_directory().unwrap().join("signatures/"); - // TODO: This needs to split out each platform into its own bucket... if let Some(default_plat) = view.default_platform() { // If there is a default platform, put the signature in there. signature_dir.push(default_plat.name().to_string()); @@ -53,7 +53,11 @@ impl Command for CreateSignatureFile { // TODO: Should we overwrite? Prompt user. if let Ok(mut file) = std::fs::File::create(&save_file) { match file.write_all(&data.to_bytes()) { - Ok(_) => log::info!("Signature file saved successfully."), + Ok(_) => { + log::info!("Signature file saved successfully."); + // Force rebuild platform matcher. + invalidate_function_matcher_cache(); + } Err(e) => log::error!("Failed to write data to signature file: {:?}", e), } } else { -- cgit v1.3.1