summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2024-02-14 03:34:49 -0500
committerGlenn Smith <glenn@vector35.com>2024-02-14 03:34:49 -0500
commit4826632608322848890494094005797859535746 (patch)
treed3c33bc7f63caa63d874833272dcbc9cd27c01ac /rust/src
parent3924284900606187048979320293633442046226 (diff)
Rust API: Add common LLIL::Instruction::address()
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/llil/instruction.rs9
1 files changed, 9 insertions, 0 deletions
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<V>> {
use binaryninjacore_sys::BNLowLevelILOperation::*;