about summary refs log tree commit diff stats
path: root/example/ida
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2017-10-03 17:20:38 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2018-03-15 14:46:36 +0100
commit1b534d9ad543473f12ddcb631e0cddb0cbd54ff4 (patch)
tree5d5248ceb9358a1f497f4830e821e50afb340dba /example/ida
parentedabfcda0fa8c0dd8ab3017853b375b1ee24b754 (diff)
downloadmiasm-1b534d9ad543473f12ddcb631e0cddb0cbd54ff4.tar.gz
miasm-1b534d9ad543473f12ddcb631e0cddb0cbd54ff4.zip
Symbexec: use hashtable for mem symbols
Diffstat (limited to 'example/ida')
-rw-r--r--example/ida/ctype_propagation.py8
-rw-r--r--example/ida/symbol_exec.py14
2 files changed, 7 insertions, 15 deletions
diff --git a/example/ida/ctype_propagation.py b/example/ida/ctype_propagation.py
index 54b23516..b2c7d5ab 100644
--- a/example/ida/ctype_propagation.py
+++ b/example/ida/ctype_propagation.py
@@ -106,7 +106,7 @@ class SymbExecCTypeFix(SymbExecCType):
 
         self.cst_propag_link = cst_propag_link
 
-    def emulbloc(self, irb, step=False):
+    def eval_updt_irblock(self, irb, step=False):
         """
         Symbolic execution of the @irb on the current state
         @irb: irblock instance
@@ -142,7 +142,7 @@ class SymbExecCTypeFix(SymbExecCType):
                     offset2cmt.setdefault(instr.offset, set()).add(
                         "\n%s: %s\n%s" % (expr, c_str, c_type))
 
-            self.eval_ir(assignblk)
+            self.eval_updt_assignblk(assignblk)
         for offset, value in offset2cmt.iteritems():
             idc.MakeComm(offset, '\n'.join(value))
             print "%x\n" % offset, '\n'.join(value)
@@ -260,7 +260,7 @@ def analyse_function():
             continue
 
         symbexec_engine = TypePropagationEngine(ir_arch, types_mngr, state)
-        addr = symbexec_engine.emul_ir_block(lbl)
+        addr = symbexec_engine.run_block_at(lbl)
         symbexec_engine.del_mem_above_stack(ir_arch.sp)
 
         ir_arch._graph = None
@@ -273,7 +273,7 @@ def analyse_function():
         if lbl not in ir_arch.blocks:
             continue
         symbexec_engine = CTypeEngineFixer(ir_arch, types_mngr, state, cst_propag_link)
-        addr = symbexec_engine.emul_ir_block(lbl)
+        addr = symbexec_engine.run_block_at(lbl)
         symbexec_engine.del_mem_above_stack(ir_arch.sp)
 
 
diff --git a/example/ida/symbol_exec.py b/example/ida/symbol_exec.py
index b65b97a1..f019f77d 100644
--- a/example/ida/symbol_exec.py
+++ b/example/ida/symbol_exec.py
@@ -133,19 +133,11 @@ def symbolic_exec():
 
     print "Run symbolic execution..."
     sb = SymbolicExecutionEngine(ira, machine.mn.regs.regs_init)
-    sb.emul_ir_blocks(start)
-
+    sb.run_at(start)
     modified = {}
-    for ident in sb.symbols.symbols_id:
-        if ident in sb.ir_arch.arch.regs.regs_init and \
-                ident in sb.symbols.symbols_id and \
-                sb.symbols.symbols_id[ident] == sb.ir_arch.arch.regs.regs_init[ident]:
-            continue
-        modified[ident] = sb.symbols.symbols_id[ident]
-
-    for ident in sb.symbols.symbols_mem:
-        modified[sb.symbols.symbols_mem[ident][0]] = sb.symbols.symbols_mem[ident][1]
 
+    for dst, src in sb.modified(init_state=machine.mn.regs.regs_init):
+        modified[dst] = src
 
     view = symbolicexec_t()
     all_views.append(view)