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/hlil/instruction.rs | 7 +++++-- rust/src/hlil/lift.rs | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'rust/src/hlil') diff --git a/rust/src/hlil/instruction.rs b/rust/src/hlil/instruction.rs index 159652f1..9bffadaf 100644 --- a/rust/src/hlil/instruction.rs +++ b/rust/src/hlil/instruction.rs @@ -15,6 +15,7 @@ use super::{HighLevelILFunction, HighLevelILLiftedInstruction, HighLevelILLifted pub struct HighLevelILInstruction { pub function: Ref, pub address: u64, + pub index: usize, pub kind: HighLevelILInstructionKind, } @@ -144,8 +145,8 @@ pub enum HighLevelILInstructionKind { DoWhileSsa(WhileSsa), } impl HighLevelILInstruction { - pub(crate) fn new(function: Ref, idx: usize) -> Self { - let op = unsafe { BNGetHighLevelILByIndex(function.handle, idx, function.full_ast) }; + pub(crate) fn new(function: Ref, index: usize) -> Self { + let op = unsafe { BNGetHighLevelILByIndex(function.handle, index, function.full_ast) }; use BNHighLevelILOperation::*; use HighLevelILInstructionKind as Op; let kind = match op.operation { @@ -627,6 +628,7 @@ impl HighLevelILInstruction { Self { function, address: op.address, + index, kind, } } @@ -875,6 +877,7 @@ impl HighLevelILInstruction { HighLevelILLiftedInstruction { function: self.function.clone(), address: self.address, + index: self.index, kind, } } diff --git a/rust/src/hlil/lift.rs b/rust/src/hlil/lift.rs index 20f8800b..74ae0c64 100644 --- a/rust/src/hlil/lift.rs +++ b/rust/src/hlil/lift.rs @@ -23,6 +23,7 @@ pub enum HighLevelILLiftedOperand { pub struct HighLevelILLiftedInstruction { pub function: Ref, pub address: u64, + pub index: usize, pub kind: HighLevelILLiftedInstructionKind, } -- cgit v1.3.1