summaryrefslogtreecommitdiff
path: root/rust/src/function.rs
diff options
context:
space:
mode:
authorRubens Brandao <git@rubens.io>2023-11-18 15:58:33 -0300
committerKyle Martin <krm504@nyu.edu>2023-11-21 15:18:50 -0500
commit8c9cdd38c3302280087c9e6d94f7f57083885edd (patch)
tree8bccf380b4470e0de8ac11c23b164e0acf6ffbb0 /rust/src/function.rs
parentb040fcfce48db861600eeb122cd0e2ff802fac96 (diff)
add mlil to rust
Diffstat (limited to 'rust/src/function.rs')
-rw-r--r--rust/src/function.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/rust/src/function.rs b/rust/src/function.rs
index ab504bb7..0a01f337 100644
--- a/rust/src/function.rs
+++ b/rust/src/function.rs
@@ -16,11 +16,12 @@ use binaryninjacore_sys::*;
use crate::rc::*;
use crate::string::*;
+use crate::types::Variable;
use crate::{
architecture::CoreArchitecture,
basicblock::{BasicBlock, BlockContext},
binaryview::{BinaryView, BinaryViewExt},
- llil,
+ llil, mlil,
platform::Platform,
symbol::Symbol,
types::{Conf, NamedTypedVariable, Type},
@@ -216,6 +217,26 @@ impl Function {
}
}
+ pub fn get_variable_name(&self, var: &Variable) -> BnString {
+ unsafe {
+ let raw_var = var.raw();
+ let raw_name = BNGetVariableName(self.handle, &raw_var);
+ BnString::from_raw(raw_name)
+ }
+ }
+
+ pub fn medium_level_il(&self) -> Result<Ref<mlil::MediumLevelILFunction>, ()> {
+ unsafe {
+ let mlil = BNGetFunctionMediumLevelIL(self.handle);
+
+ if mlil.is_null() {
+ return Err(());
+ }
+
+ Ok(Ref::new(mlil::MediumLevelILFunction::from_raw(mlil)))
+ }
+ }
+
pub fn low_level_il(&self) -> Result<Ref<llil::RegularFunction<CoreArchitecture>>, ()> {
unsafe {
let llil = BNGetFunctionLowLevelIL(self.handle);