diff options
| -rw-r--r-- | miasm2/arch/mips32/sem.py | 1 | ||||
| -rw-r--r-- | miasm2/core/sembuilder.py | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/miasm2/arch/mips32/sem.py b/miasm2/arch/mips32/sem.py index 9589eb1e..ca368883 100644 --- a/miasm2/arch/mips32/sem.py +++ b/miasm2/arch/mips32/sem.py @@ -10,7 +10,6 @@ ctx = {"R_LO": R_LO, "R_HI": R_HI, "PC": PC, "RA": RA} -ctx.update(m2_expr.__dict__) sbuild = SemBuilder(ctx) diff --git a/miasm2/core/sembuilder.py b/miasm2/core/sembuilder.py index ba9d9d80..ddf1cb32 100644 --- a/miasm2/core/sembuilder.py +++ b/miasm2/core/sembuilder.py @@ -4,6 +4,9 @@ import inspect import ast import re +import miasm2.expression.expression as m2_expr +from miasm2.ir.ir import irbloc + class MiasmTransformer(ast.NodeTransformer): """AST visitor translating DSL to Miasm expression @@ -99,8 +102,14 @@ class SemBuilder(object): """Create a SemBuilder @ctx: context dictionnary used during parsing """ - self.ctx = dict(ctx) + # Init self.transformer = MiasmTransformer() + self.ctx = dict(m2_expr.__dict__) + self.ctx["irbloc"] = irbloc + + # Update context + self.ctx.update(ctx) + def parse(self, func): """Function decorator, returning a correct method from a pseudo-Python |