Skip to content

Commit bd34931

Browse files
committed
Create ExpressionBuilder from Expression
1 parent c7d9029 commit bd34931

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

rust/src/llil/lifting.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,26 @@ where
607607
A: 'a + Architecture,
608608
R: ExpressionResultType,
609609
{
610+
pub fn from_expr(expr: Expression<'a, A, Mutable, NonSSA<LiftedNonSSA>, R>) -> Self {
611+
use binaryninjacore_sys::BNGetLowLevelILByIndex;
612+
613+
let instr = unsafe {
614+
BNGetLowLevelILByIndex(expr.function.handle, expr.expr_idx)
615+
};
616+
617+
ExpressionBuilder {
618+
function: expr.function,
619+
op: instr.operation,
620+
size: instr.size,
621+
flags: instr.flags,
622+
op1: instr.operands[0],
623+
op2: instr.operands[1],
624+
op3: instr.operands[2],
625+
op4: instr.operands[3],
626+
_ty: PhantomData
627+
}
628+
}
629+
610630
pub fn with_flag_write(mut self, flag_write: A::FlagWrite) -> Self {
611631
// TODO verify valid id
612632
self.flags = flag_write.id();

0 commit comments

Comments
 (0)