diff options
| author | Mason Reed <mason@vector35.com> | 2025-07-06 16:45:05 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-07-06 16:46:56 -0400 |
| commit | ecb8f071ca5f6e414e127e85ab660a4af052bebf (patch) | |
| tree | 8276061cbdf181a70599d8f181f8fa14520bfb4a /plugins/warp/src/convert.rs | |
| parent | 796b8ac0e6cc2c0d6f2c3ac968f2578af4c608c7 (diff) | |
[WARP] Recover register variables and re-add tags to matched functions
Diffstat (limited to 'plugins/warp/src/convert.rs')
| -rw-r--r-- | plugins/warp/src/convert.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/warp/src/convert.rs b/plugins/warp/src/convert.rs index 8272768b..bacf0024 100644 --- a/plugins/warp/src/convert.rs +++ b/plugins/warp/src/convert.rs @@ -5,11 +5,31 @@ use binaryninja::function::Comment as BNComment; use binaryninja::function::Function as BNFunction; use binaryninja::platform::Platform; use binaryninja::rc::Ref; +use binaryninja::variable::{Variable as BNVariable, VariableSourceType}; pub use symbol::*; pub use types::*; +use warp::r#type::class::function::{Location, RegisterLocation, StackLocation}; use warp::signature::comment::FunctionComment; use warp::target::Target; +pub fn bn_var_to_location(bn_variable: BNVariable) -> Option<Location> { + match bn_variable.ty { + VariableSourceType::StackVariableSourceType => { + let stack_loc = StackLocation { + offset: bn_variable.storage, + }; + Some(Location::Stack(stack_loc)) + } + VariableSourceType::RegisterVariableSourceType => { + let reg_loc = RegisterLocation { + id: bn_variable.storage as u64, + }; + Some(Location::Register(reg_loc)) + } + VariableSourceType::FlagVariableSourceType => None, + } +} + pub fn bn_comment_to_comment(func: &BNFunction, bn_comment: BNComment) -> FunctionComment { let offset = (bn_comment.addr as i64) - (func.start() as i64); FunctionComment { |
