From 8c9cdd38c3302280087c9e6d94f7f57083885edd Mon Sep 17 00:00:00 2001 From: Rubens Brandao Date: Sat, 18 Nov 2023 15:58:33 -0300 Subject: add mlil to rust --- rust/src/function.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'rust/src/function.rs') 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, ()> { + 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>, ()> { unsafe { let llil = BNGetFunctionLowLevelIL(self.handle); -- cgit v1.3.1