From 2cd83c7221f8587975bcfc7582eb5b8c73f1653e Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Fri, 26 Apr 2024 18:24:46 -0400 Subject: Allow fetching target instruction index in LLIL branches from the Rust API --- rust/src/llil/operation.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'rust/src') diff --git a/rust/src/llil/operation.rs b/rust/src/llil/operation.rs index 3c40f207..3ba4fa78 100644 --- a/rust/src/llil/operation.rs +++ b/rust/src/llil/operation.rs @@ -89,10 +89,10 @@ pub struct Syscall; pub struct Intrinsic; impl<'func, A, M, V> Operation<'func, A, M, NonSSA, Intrinsic> - where - A: 'func + Architecture, - M: FunctionMutability, - V: NonSSAVariant, +where + A: 'func + Architecture, + M: FunctionMutability, + V: NonSSAVariant, { // TODO: Support register and expression lists pub fn intrinsic(&self) -> Option { @@ -382,12 +382,20 @@ where } } + pub fn true_target_idx(&self) -> usize { + self.op.operands[1] as usize + } + pub fn false_target(&self) -> Instruction<'func, A, M, F> { Instruction { function: self.function, instr_idx: self.op.operands[2] as usize, } } + + pub fn false_target_idx(&self) -> usize { + self.op.operands[2] as usize + } } // LLIL_GOTO @@ -405,6 +413,10 @@ where instr_idx: self.op.operands[0] as usize, } } + + pub fn target_idx(&self) -> usize { + self.op.operands[0] as usize + } } // LLIL_FLAG_COND -- cgit v1.3.1