diff options
Diffstat (limited to 'plugins/warp/src/plugin/debug.rs')
| -rw-r--r-- | plugins/warp/src/plugin/debug.rs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/plugins/warp/src/plugin/debug.rs b/plugins/warp/src/plugin/debug.rs new file mode 100644 index 00000000..fc4e5817 --- /dev/null +++ b/plugins/warp/src/plugin/debug.rs @@ -0,0 +1,48 @@ +use crate::cache::container::for_cached_containers; +use crate::{build_function, cache}; +use binaryninja::binary_view::BinaryView; +use binaryninja::command::{Command, FunctionCommand}; +use binaryninja::function::Function; +use binaryninja::ObjectDestructor; + +pub struct DebugFunction; + +impl FunctionCommand for DebugFunction { + fn action(&self, _view: &BinaryView, func: &Function) { + if let Ok(lifted_il) = func.lifted_il() { + log::info!("{:#?}", build_function(func, &lifted_il)); + } + } + + fn valid(&self, _view: &BinaryView, _func: &Function) -> bool { + true + } +} + +pub struct DebugCache; + +impl Command for DebugCache { + fn action(&self, _view: &BinaryView) { + for_cached_containers(|c| { + log::info!("Container: {:#?}", c); + }); + } + + fn valid(&self, _view: &BinaryView) -> bool { + true + } +} + +pub struct DebugInvalidateCache; + +impl Command for DebugInvalidateCache { + fn action(&self, view: &BinaryView) { + let destructor = cache::CacheDestructor {}; + destructor.destruct_view(view); + log::info!("Invalidated all WARP caches..."); + } + + fn valid(&self, _view: &BinaryView) -> bool { + true + } +} |
