From b148652ebd8e8b02aa9514cc3d21098c7002d694 Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Fri, 27 Mar 2015 14:50:11 +0100 Subject: 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. --- example/expression/solve_condition_stp.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'example') 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) -- cgit 1.4.1