about summary refs log tree commit diff stats
path: root/example/expression
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2015-04-02 16:10:11 +0200
committerCamille Mougey <commial@gmail.com>2015-04-02 16:10:11 +0200
commit55c00f729101259e2706a171a5bff4106bb7efdd (patch)
tree6475c9e483c7d2115d26fc0c81a724c5ade93494 /example/expression
parentc16ed5171a455535d2e4ec9eaccd50b5c3d1b440 (diff)
parent945f985aba4d957241899e56c26211a88977eca0 (diff)
downloadmiasm-55c00f729101259e2706a171a5bff4106bb7efdd.tar.gz
miasm-55c00f729101259e2706a171a5bff4106bb7efdd.zip
Merge pull request #137 from serpilliere/clean_group_bloc
Clean asmbloc
Diffstat (limited to 'example/expression')
-rw-r--r--example/expression/asm_to_ir.py9
-rw-r--r--example/expression/solve_condition_stp.py11
2 files changed, 7 insertions, 13 deletions
diff --git a/example/expression/asm_to_ir.py b/example/expression/asm_to_ir.py
index cec32c06..942e5e19 100644
--- a/example/expression/asm_to_ir.py
+++ b/example/expression/asm_to_ir.py
@@ -7,13 +7,6 @@ from miasm2.arch.x86.ira import ir_a_x86_32
 from pdb import pm
 
 
-def my_ast_int2expr(a):
-    return ExprInt32(a)
-
-my_var_parser = parse_ast(ast_id2expr, my_ast_int2expr)
-base_expr.setParseAction(my_var_parser)
-
-
 # First, asm code
 blocs, symbol_pool = parse_asm.parse_txt(mn_x86, 32, '''
 main:
@@ -39,7 +32,7 @@ for b in blocs:
 
 print "symbols:"
 print symbol_pool
-resolved_b, patches = asmbloc.asm_resolve_final(mn_x86, blocs, symbol_pool)
+patches = asmbloc.asm_resolve_final(mn_x86, blocs, symbol_pool)
 
 # Translate to IR
 ir_arch = ir_a_x86_32(symbol_pool)
diff --git a/example/expression/solve_condition_stp.py b/example/expression/solve_condition_stp.py
index 659124d1..a25a7072 100644
--- a/example/expression/solve_condition_stp.py
+++ b/example/expression/solve_condition_stp.py
@@ -138,12 +138,13 @@ if __name__ == '__main__':
     def my_ast_int2expr(a):
         return ExprInt32(a)
 
-    def my_ast_id2expr(t):
-        if t in reg_and_id:
-            r = reg_and_id[t]
+    # Modifify parser to avoid label creation in PUSH argc
+    def my_ast_id2expr(string_parsed):
+        if string_parsed in reg_and_id:
+            return reg_and_id[string_parsed]
         else:
-            r = ExprId(t, size=32)
-        return r
+            return ExprId(string_parsed, size=32)
+
     my_var_parser = parse_ast(my_ast_id2expr, my_ast_int2expr)
     base_expr.setParseAction(my_var_parser)