From 4826632608322848890494094005797859535746 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 14 Feb 2024 03:34:49 -0500 Subject: Rust API: Add common LLIL::Instruction::address() --- rust/src/llil/instruction.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'rust/src') diff --git a/rust/src/llil/instruction.rs b/rust/src/llil/instruction.rs index 9f2ad9b2..04673ab0 100644 --- a/rust/src/llil/instruction.rs +++ b/rust/src/llil/instruction.rs @@ -95,6 +95,15 @@ where M: FunctionMutability, V: NonSSAVariant, { + pub fn address(&self) -> u64 { + use binaryninjacore_sys::BNLowLevelILOperation::*; + + let expr_idx = + unsafe { BNGetLowLevelILIndexForInstruction(self.function.handle, self.instr_idx) }; + let op = unsafe { BNGetLowLevelILByIndex(self.function.handle, expr_idx) }; + return op.address; + } + pub fn info(&self) -> InstrInfo<'func, A, M, NonSSA> { use binaryninjacore_sys::BNLowLevelILOperation::*; -- cgit v1.3.1