about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2018-05-14 15:48:05 +0200
committerGitHub <noreply@github.com>2018-05-14 15:48:05 +0200
commitf72b8f272267b65abf075d9d5f729936a83c180d (patch)
treea5fe4962ba0f485709b1201d6cae261208fded6d
parentd7c7527fbc4dea0f340402b62e7146b1d1916d2a (diff)
parentf72b3eaee44315ecd5905e56c55b7fad094e39ef (diff)
downloadmiasm-f72b8f272267b65abf075d9d5f729936a83c180d.tar.gz
miasm-f72b8f272267b65abf075d9d5f729936a83c180d.zip
Merge pull request #737 from commial/feature/dse_attach_from_breakpoint
DSE: update doc on attachment in a breakpoint
-rw-r--r--miasm2/analysis/dse.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/miasm2/analysis/dse.py b/miasm2/analysis/dse.py
index 0a5445a6..427a8bd0 100644
--- a/miasm2/analysis/dse.py
+++ b/miasm2/analysis/dse.py
@@ -192,7 +192,25 @@ class DSEEngine(object):
 
     def attach(self, emulator):
         """Attach the DSE to @emulator
-        @emulator: jitload (or API equivalent) instance"""
+        @emulator: jitload (or API equivalent) instance
+
+        To attach *DURING A BREAKPOINT*, one may consider using the following snippet:
+
+        def breakpoint(self, jitter):
+            ...
+            dse.attach(jitter)
+            dse.update...
+            ...
+            # Additionnal call to the exec callback is necessary, as breakpoints are
+            # honored AFTER exec callback
+            jitter.exec_cb(jitter)
+
+            return True
+
+        Without it, one may encounteer a DriftException error due to a
+        "desynchronization" between jitter and dse states. Indeed, on 'handle'
+        call, the jitter must be one instruction AFTER the dse.
+        """
         self.jitter = emulator
         self.prepare()