diff options
| author | Josh Watson <josh@trailofbits.com> | 2019-04-24 14:10:39 -0700 |
|---|---|---|
| committer | plafosse <peter@vector35.com> | 2019-05-08 15:14:16 -0400 |
| commit | 2d731fed5b1942143fd3991fd3b60667707a47a5 (patch) | |
| tree | 5cb31f0bd5502b36ba274dd1448335352e835216 /python/lowlevelil.py | |
| parent | bb6497eb98a6877e5e71987bf17cc2c3290e0f34 (diff) | |
Add LowLevelILFunction.replace_expr method
Expose the BNReplaceLowLevelILExpr core API via a new method on LowLevelILFunction, replace_expr
Diffstat (limited to 'python/lowlevelil.py')
| -rw-r--r-- | python/lowlevelil.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py index efa92a7a..9435fd5c 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -939,6 +939,19 @@ class LowLevelILFunction(object): flags = 0 return LowLevelILExpr(core.BNLowLevelILAddExpr(self.handle, operation, size, flags, a, b, c, d)) + def replace_expr(self, original, new): + if isinstance(original, LowLevelILInstruction): + original = original.expr_index + elif isinstance(original, LowLevelILExpr): + original = original.index + + if isinstance(new, LowLevelILInstruction): + new = new.expr_index + elif isinstance(new, LowLevelILExpr): + new = new.index + + core.BNReplaceLowLevelILExpr(self.handle, original, new) + def append(self, expr): """ ``append`` adds the LowLevelILExpr ``expr`` to the current LowLevelILFunction. |
