about summary refs log tree commit diff stats
path: root/test/arch/x86/sem.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2017-12-11 14:26:23 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2018-06-08 17:35:05 +0200
commita2637cdf0b40df074865d23a7fd71f082ad7f40a (patch)
treef6c958ca8481e6e29760078e5d1bdc2d2b64da53 /test/arch/x86/sem.py
parentdadfaabc3fff5edb9bf4ef7e7e8c4cfc4baccb94 (diff)
downloadmiasm-a2637cdf0b40df074865d23a7fd71f082ad7f40a.tar.gz
miasm-a2637cdf0b40df074865d23a7fd71f082ad7f40a.zip
Expr: Add new word ExprLoc
This word represents a location in the binary.
Thus, the hack of ExprId containing an AsmLabel ends here.
Diffstat (limited to 'test/arch/x86/sem.py')
-rwxr-xr-xtest/arch/x86/sem.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/arch/x86/sem.py b/test/arch/x86/sem.py
index b3b7e940..78cbc243 100755
--- a/test/arch/x86/sem.py
+++ b/test/arch/x86/sem.py
@@ -25,11 +25,11 @@ symbol_pool = AsmSymbolPool()
 m32 = 32
 m64 = 64
 
-def symb_exec(interm, inputstate, debug):
+def symb_exec(lbl, interm, inputstate, debug):
     sympool = dict(regs_init)
     sympool.update(inputstate)
     symexec = SymbolicExecutionEngine(interm, sympool)
-    symexec.run_at(0)
+    symexec.run_at(lbl)
     if debug:
         for k, v in symexec.symbols.items():
             if regs_init.get(k, None) != v:
@@ -43,8 +43,8 @@ def compute(ir, mode, asm, inputstate={}, debug=False):
     instr = mn.dis(code, mode)
     instr.offset = inputstate.get(EIP, 0)
     interm = ir()
-    interm.add_instr(instr)
-    return symb_exec(interm, inputstate, debug)
+    lbl = interm.add_instr(instr)
+    return symb_exec(lbl, interm, inputstate, debug)
 
 
 def compute_txt(ir, mode, txt, inputstate={}, debug=False):
@@ -52,9 +52,10 @@ def compute_txt(ir, mode, txt, inputstate={}, debug=False):
     symbol_pool.set_offset(symbol_pool.getby_name("main"), 0x0)
     patches = asmblock.asm_resolve_final(mn, blocks, symbol_pool)
     interm = ir(symbol_pool)
+    lbl = symbol_pool.getby_name("main")
     for bbl in blocks:
         interm.add_block(bbl)
-    return symb_exec(interm, inputstate, debug)
+    return symb_exec(lbl, interm, inputstate, debug)
 
 op_add = lambda a, b: a+b
 op_sub = lambda a, b: a-b