summaryrefslogtreecommitdiff
path: root/plugins/warp/src/lib.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-08-26 23:43:32 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-09-03 21:19:03 +0000
commit47e0f1f685119ebffecbb99d2cce35c53a384738 (patch)
tree4c2f2a012ecf324fd0f56d3f06987d14c412103a /plugins/warp/src/lib.rs
parentb157aa0a337dc89d6817f2a26d2c3dd1e44efc9a (diff)
[WARP] Fix generating lifted IL when function GUID is already cached
We do not need to consult the lifted IL if we have already cached the function GUID in the function metadata
Diffstat (limited to 'plugins/warp/src/lib.rs')
-rw-r--r--plugins/warp/src/lib.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/warp/src/lib.rs b/plugins/warp/src/lib.rs
index be6f8bc3..56915983 100644
--- a/plugins/warp/src/lib.rs
+++ b/plugins/warp/src/lib.rs
@@ -106,13 +106,18 @@ pub fn build_variables(func: &BNFunction) -> Vec<FunctionVariable> {
}
// TODO: Get rid of the minimal bool.
+/// Build the WARP [`Function`] from the Binary Ninja [`BNFunction`].
+///
+/// The `lifted_il_accessor` is passed in such that a function with a guid already cached will not
+/// require us to regenerate the IL. This is important in the event of someone generating signatures
+/// off of an existing BNDB or when the IL is no longer present.
pub fn build_function<M: FunctionMutability>(
func: &BNFunction,
- lifted_il: &LowLevelILFunction<M, NonSSA>,
+ lifted_il_accessor: impl Fn() -> Option<BNRef<LowLevelILFunction<M, NonSSA>>>,
minimal: bool,
-) -> Function {
+) -> Option<Function> {
let mut function = Function {
- guid: cached_function_guid(func, lifted_il),
+ guid: cached_function_guid(func, lifted_il_accessor)?,
symbol: from_bn_symbol(&func.symbol()),
// NOTE: Adding adjacent only works if analysis is complete.
// NOTE: We do not filter out adjacent functions here.
@@ -123,7 +128,7 @@ pub fn build_function<M: FunctionMutability>(
};
if minimal {
- return function;
+ return Some(function);
}
// Currently we only store the type if its a user type.
@@ -142,7 +147,7 @@ pub fn build_function<M: FunctionMutability>(
.map(|c| bn_comment_to_comment(func, c))
.collect();
function.variables = build_variables(func);
- function
+ Some(function)
}
/// Basic blocks sorted from high to low.