Skip to content

Commit

Permalink
Allow fetching target instruction index in LLIL branches from the Rus…
Browse files Browse the repository at this point in the history
…t API
  • Loading branch information
D0ntPanic committed Apr 30, 2024
1 parent 7c04b4b commit 2cd83c7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions rust/src/llil/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ pub struct Syscall;
pub struct Intrinsic;

impl<'func, A, M, V> Operation<'func, A, M, NonSSA<V>, 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<A::Intrinsic> {
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2cd83c7

Please sign in to comment.