about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2015-11-16 08:43:52 +0100
committerCamille Mougey <commial@gmail.com>2015-11-16 08:43:52 +0100
commit3eed941e88361f811496311014079c172e058a68 (patch)
treed35aaf3f8a52333ce7694dbd9bb8d035083d02d4
parentedc62e38321f05c91bc0bb577710a871575ed892 (diff)
parent3e80f047414f97d81bddccb393990c69e1bc348c (diff)
downloadmiasm-3eed941e88361f811496311014079c172e058a68.tar.gz
miasm-3eed941e88361f811496311014079c172e058a68.zip
Merge pull request #271 from serpilliere/fix_single_step
Fix single step
-rw-r--r--miasm2/analysis/debugging.py4
-rw-r--r--miasm2/jitter/jitcore.py6
-rw-r--r--miasm2/jitter/jitload.py5
3 files changed, 13 insertions, 2 deletions
diff --git a/miasm2/analysis/debugging.py b/miasm2/analysis/debugging.py
index 74551a72..d970f848 100644
--- a/miasm2/analysis/debugging.py
+++ b/miasm2/analysis/debugging.py
@@ -167,8 +167,8 @@ class Debugguer(object):
         "Step in jit"
 
         self.myjit.jit.set_options(jit_maxline=1)
-        self.myjit.jit.addr_mod = interval([(self.myjit.pc, self.myjit.pc)])
-        self.myjit.jit.updt_automod_code(self.myjit.vm)
+        # Reset all jitted blocks
+        self.myjit.jit.clear_jitted_blocks()
 
         res = self.myjit.continue_run(step=True)
         self.handle_exception(res)
diff --git a/miasm2/jitter/jitcore.py b/miasm2/jitter/jitcore.py
index 46451520..02a0b7c1 100644
--- a/miasm2/jitter/jitcore.py
+++ b/miasm2/jitter/jitcore.py
@@ -61,6 +61,12 @@ class JitCore(object):
 
         self.options.update(kwargs)
 
+    def clear_jitted_blocks(self):
+        "Reset all jitted blocks"
+        self.lbl2jitbloc.clear()
+        self.lbl2bloc.clear()
+        self.blocs_mem_interval = interval()
+
     def add_disassembly_splits(self, *args):
         """The disassembly engine will stop on address in args if they
         are not at the block beginning"""
diff --git a/miasm2/jitter/jitload.py b/miasm2/jitter/jitload.py
index 7213d73c..a035445b 100644
--- a/miasm2/jitter/jitload.py
+++ b/miasm2/jitter/jitload.py
@@ -8,6 +8,7 @@ from miasm2.jitter.csts import *
 from miasm2.core.utils import *
 from miasm2.core.bin_stream import bin_stream_vm
 from miasm2.ir.ir2C import init_arch_C
+from miasm2.core.interval import interval
 
 hnd = logging.StreamHandler()
 hnd.setFormatter(logging.Formatter("[%(levelname)s]: %(message)s"))
@@ -261,6 +262,10 @@ class jitter:
         """
         self.breakpoints_handler.add_callback(addr, callback)
         self.jit.add_disassembly_splits(addr)
+        # De-jit previously jitted blocks
+        self.jit.addr_mod = interval([(addr, addr)])
+        self.jit.updt_automod_code(self.vm)
+
 
     def set_breakpoint(self, addr, *args):
         """Set callbacks associated with addr.