diff options
| author | Mason Reed <mason@vector35.com> | 2024-06-20 08:27:36 -0400 |
|---|---|---|
| committer | mason <35282038+emesare@users.noreply.github.com> | 2024-07-01 12:36:19 +0000 |
| commit | bd34931330858810a881b110f6b03ef198cb3664 (patch) | |
| tree | 03cb86916a01a18d7ddb4d7f9ffa591f102b327d /rust/src | |
| parent | c7d90297d41af6c178dbed4b8c389567aa4a4d06 (diff) | |
Create ExpressionBuilder from Expression
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/llil/lifting.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/rust/src/llil/lifting.rs b/rust/src/llil/lifting.rs index e6226070..f8b8257e 100644 --- a/rust/src/llil/lifting.rs +++ b/rust/src/llil/lifting.rs @@ -607,6 +607,26 @@ where A: 'a + Architecture, R: ExpressionResultType, { + pub fn from_expr(expr: Expression<'a, A, Mutable, NonSSA<LiftedNonSSA>, R>) -> Self { + use binaryninjacore_sys::BNGetLowLevelILByIndex; + + let instr = unsafe { + BNGetLowLevelILByIndex(expr.function.handle, expr.expr_idx) + }; + + ExpressionBuilder { + function: expr.function, + op: instr.operation, + size: instr.size, + flags: instr.flags, + op1: instr.operands[0], + op2: instr.operands[1], + op3: instr.operands[2], + op4: instr.operands[3], + _ty: PhantomData + } + } + pub fn with_flag_write(mut self, flag_write: A::FlagWrite) -> Self { // TODO verify valid id self.flags = flag_write.id(); |
