about summary refs log tree commit diff stats
path: root/miasm2/analysis/depgraph.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2015-04-27 21:51:36 +0200
committerAjax <commial@gmail.com>2015-04-27 21:51:36 +0200
commit9615e4fea41bd6d4bf73529e9007b47a7ac849be (patch)
tree86fc5386be39f28e67af7fac31c30ae3277155bb /miasm2/analysis/depgraph.py
parent4c16d4925c780242f99f693740a4eb6b34f7cf74 (diff)
downloadmiasm-9615e4fea41bd6d4bf73529e9007b47a7ac849be.tar.gz
miasm-9615e4fea41bd6d4bf73529e9007b47a7ac849be.zip
DepGraphResult: Add an initial context option
Diffstat (limited to 'miasm2/analysis/depgraph.py')
-rw-r--r--miasm2/analysis/depgraph.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/miasm2/analysis/depgraph.py b/miasm2/analysis/depgraph.py
index b92b3fd7..efe79acd 100644
--- a/miasm2/analysis/depgraph.py
+++ b/miasm2/analysis/depgraph.py
@@ -346,13 +346,18 @@ class DependencyResult(object):
     def input(self):
         return self._input_depnodes
 
-    def emul(self, step=False):
+    def emul(self, ctx=None, step=False):
         """Symbolic execution of relevant nodes according to the history
         Return the values of input nodes' elements
+        @ctx: (optional) Initial context as dictionnary
+        @step: (optional) Verbose execution
 
         /!\ The emulation is not safe if there is a loop in the relevant labels
         """
         # Init
+        ctx_init = self._ira.arch.regs.regs_init
+        if ctx is not None:
+            ctx_init.update(ctx)
         depnodes = self.relevant_nodes
         affects = []
 
@@ -366,7 +371,7 @@ class DependencyResult(object):
 
         # Eval the block
         temp_label = asm_label("Temp")
-        sb = symbexec(self._ira, self._ira.arch.regs.regs_init)
+        sb = symbexec(self._ira, ctx_init)
         sb.emulbloc(irbloc(temp_label, affects), step=step)
 
         # Return only inputs values (others could be wrongs)