about summary refs log tree commit diff stats
path: root/test/core/sembuilder.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2015-04-22 14:01:23 +0200
committerAjax <commial@gmail.com>2015-04-22 17:59:32 +0200
commitad022737ed50c1b206a34b4875bc04f0635bbe90 (patch)
treef15aac711bf8e31cf817c1e010077701f1289484 /test/core/sembuilder.py
parent9039f508b2e2d407495d1ab6f74cc78cc891f822 (diff)
downloadfocaccia-miasm-ad022737ed50c1b206a34b4875bc04f0635bbe90.tar.gz
focaccia-miasm-ad022737ed50c1b206a34b4875bc04f0635bbe90.zip
Core: Introduce SemBuilder, a helper for building semantics side effects
Diffstat (limited to 'test/core/sembuilder.py')
-rw-r--r--test/core/sembuilder.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/core/sembuilder.py b/test/core/sembuilder.py
new file mode 100644
index 00000000..1854fc58
--- /dev/null
+++ b/test/core/sembuilder.py
@@ -0,0 +1,22 @@
+import inspect
+
+from miasm2.core.sembuilder import SemBuilder
+import miasm2.expression.expression as m2_expr
+
+sb = SemBuilder(m2_expr.__dict__)
+
+@sb.parse
+def test(Arg1, Arg2, Arg3):
+    "Test docstring"
+    Arg1 = Arg2
+    mem32[Arg1] = Arg2
+    mem32[Arg2] = Arg3  + i32(4) - mem32[Arg1]
+    Arg3 = Arg3 if Arg2 else i32(0)
+
+a = m2_expr.ExprId('A')
+b = m2_expr.ExprId('B')
+c = m2_expr.ExprId('C')
+ir = None
+instr = None
+print test(ir, instr, a, b, c)
+print test.__doc__