From a6b48153b64a227c3492d77a96e679b8c469034c Mon Sep 17 00:00:00 2001 From: Michael Krasnitski Date: Wed, 20 Mar 2024 14:57:23 -0400 Subject: Add index field to IL instructions --- rust/src/mlil/instruction.rs | 7 +++++-- rust/src/mlil/lift.rs | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'rust/src/mlil') diff --git a/rust/src/mlil/instruction.rs b/rust/src/mlil/instruction.rs index e457c93e..3b5dcfb4 100644 --- a/rust/src/mlil/instruction.rs +++ b/rust/src/mlil/instruction.rs @@ -17,6 +17,7 @@ use super::MediumLevelILFunction; pub struct MediumLevelILInstruction { pub function: Ref, pub address: u64, + pub index: usize, pub kind: MediumLevelILInstructionKind, } @@ -166,8 +167,8 @@ impl core::fmt::Debug for MediumLevelILInstruction { } impl MediumLevelILInstruction { - pub(crate) fn new(function: Ref, idx: usize) -> Self { - let op = unsafe { BNGetMediumLevelILByIndex(function.handle, idx) }; + pub(crate) fn new(function: Ref, index: usize) -> Self { + let op = unsafe { BNGetMediumLevelILByIndex(function.handle, index) }; use BNMediumLevelILOperation::*; use MediumLevelILInstructionKind as Op; let kind = match op.operation { @@ -711,6 +712,7 @@ impl MediumLevelILInstruction { Self { function, address: op.address, + index, kind, } } @@ -1019,6 +1021,7 @@ impl MediumLevelILInstruction { MediumLevelILLiftedInstruction { function: self.function.clone(), address: self.address, + index: self.index, kind, } } diff --git a/rust/src/mlil/lift.rs b/rust/src/mlil/lift.rs index db91a8d8..39e8e983 100644 --- a/rust/src/mlil/lift.rs +++ b/rust/src/mlil/lift.rs @@ -26,6 +26,7 @@ pub enum MediumLevelILLiftedOperand { pub struct MediumLevelILLiftedInstruction { pub function: Ref, pub address: u64, + pub index: usize, pub kind: MediumLevelILLiftedInstructionKind, } -- cgit v1.3.1