diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2024-04-26 18:22:50 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2024-04-30 13:12:21 -0400 |
| commit | 7c04b4b1f27d1d388bfc6bb793f076d38366b849 (patch) | |
| tree | 7f24fa19ea17b883a9080514e941855232422f81 /rust/src/function.rs | |
| parent | e88d386127b751d17b9005b2e374150473f42729 (diff) | |
Add parameter_variables API to Function in Rust
Diffstat (limited to 'rust/src/function.rs')
| -rw-r--r-- | rust/src/function.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/rust/src/function.rs b/rust/src/function.rs index 273a0861..7f900a25 100644 --- a/rust/src/function.rs +++ b/rust/src/function.rs @@ -30,7 +30,6 @@ pub use binaryninjacore_sys::BNAnalysisSkipReason as AnalysisSkipReason; pub use binaryninjacore_sys::BNFunctionAnalysisSkipOverride as FunctionAnalysisSkipOverride; pub use binaryninjacore_sys::BNFunctionUpdateType as FunctionUpdateType; - use std::hash::Hash; use std::{fmt, mem}; @@ -315,6 +314,22 @@ impl Function { } } + pub fn parameter_variables(&self) -> Conf<Vec<Variable>> { + unsafe { + let mut variables = BNGetFunctionParameterVariables(self.handle); + let mut result = Vec::with_capacity(variables.count); + let confidence = variables.confidence; + let vars = std::slice::from_raw_parts(variables.vars, variables.count); + + for i in 0..variables.count { + result.push(Variable::from_raw(vars[i])); + } + + BNFreeParameterVariables(&mut variables); + Conf::new(result, confidence) + } + } + pub fn apply_imported_types(&self, sym: &Symbol, t: Option<&Type>) { unsafe { BNApplyImportedTypes( |
