about summary refs log tree commit diff stats
path: root/example/expression/solve_condition_stp.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2015-03-27 14:50:11 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2015-04-01 23:47:37 +0200
commitb148652ebd8e8b02aa9514cc3d21098c7002d694 (patch)
tree7dfa95414e79b5d84c2c89d25d96ea6dfdca1182 /example/expression/solve_condition_stp.py
parentf9c49e92dada2aa51ca594f435f962617796c116 (diff)
downloadfocaccia-miasm-b148652ebd8e8b02aa9514cc3d21098c7002d694.tar.gz
focaccia-miasm-b148652ebd8e8b02aa9514cc3d21098c7002d694.zip
Parse_asm: generate asm_label on symbol parsing
For an unknown symbol, instead of generating ExprId('toto'), it will generate
ExprId(asm_label('toto')). As label is generated in the architecture, this label
must be catched in the parse_asm module to be inserted in the current
symbol_pool.
Diffstat (limited to 'example/expression/solve_condition_stp.py')
-rw-r--r--example/expression/solve_condition_stp.py11
1 files changed, 6 insertions, 5 deletions
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)