diff options
Diffstat (limited to 'miasm2')
| -rw-r--r-- | miasm2/ir/ir.py | 12 | ||||
| -rw-r--r-- | miasm2/ir/symbexec.py | 7 |
2 files changed, 18 insertions, 1 deletions
diff --git a/miasm2/ir/ir.py b/miasm2/ir/ir.py index e5f0c8db..8154d4da 100644 --- a/miasm2/ir/ir.py +++ b/miasm2/ir/ir.py @@ -33,7 +33,13 @@ class AssignBlock(object): EAX = EBX EBX = EAX - Also provides common manipulation on this assignments + -> Exchange between EBX and EAX + + AssignBlock can be seen as a dictionnary where keys are the destinations + (ExprId or ExprMem), and values their corresponding sources. + + Also provides common manipulation on this assignments. + """ __slots__ = ["_assigns", "_instr"] @@ -124,6 +130,10 @@ class AssignBlock(object): args = [expr for (expr, _, _) in args] new_src = m2_expr.ExprCompose(*args) + # Sanity check + if not isinstance(new_dst, (m2_expr.ExprId, m2_expr.ExprMem)): + raise TypeError("Destination cannot be a %s" % type(new_dst)) + self._assigns[new_dst] = new_src def __setitem__(self, dst, src): diff --git a/miasm2/ir/symbexec.py b/miasm2/ir/symbexec.py index 33d0f8bd..f9444424 100644 --- a/miasm2/ir/symbexec.py +++ b/miasm2/ir/symbexec.py @@ -504,6 +504,13 @@ class SymbolicExecutionEngine(object): return ret + def as_assignblock(self): + """Return the current state as an AssignBlock""" + return AssignBlock({ + dst: self.symbols[dst] for dst in self.modified() + }) + + class symbexec(SymbolicExecutionEngine): """ DEPRECATED object |