about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2019-02-21 10:55:51 +0100
committerAjax <commial@gmail.com>2019-02-21 10:55:51 +0100
commit6ee7509a6816b747fc2bca9150008761795eb075 (patch)
treed1127d1eb9b47965946b345830c4653f7ef6d32f
parent787817bd0428b6be475cea3e90b4413981579a5a (diff)
downloadmiasm-6ee7509a6816b747fc2bca9150008761795eb075.tar.gz
miasm-6ee7509a6816b747fc2bca9150008761795eb075.zip
Add a "remove_breakpoints_by_address" capability to jitter
Diffstat (limited to '')
-rw-r--r--miasm2/jitter/jitload.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/miasm2/jitter/jitload.py b/miasm2/jitter/jitload.py
index 89f5bada..7dc72d62 100644
--- a/miasm2/jitter/jitload.py
+++ b/miasm2/jitter/jitload.py
@@ -104,6 +104,12 @@ class CallbackHandler(object):
     def has_callbacks(self, name):
         return name in self.callbacks
 
+    def remove_name(self, name):
+        """Remove and return all callbacks associated to @name"""
+        callbacks = self.callbacks.get(name, [])
+        del self.callbacks[name]
+        return callbacks
+
     def call_callbacks(self, name, *args):
         """Call callbacks associated to key 'name' with arguments args. While
         callbacks return True, continue with next callback.
@@ -299,6 +305,14 @@ class Jitter(object):
         for key in empty_keys:
             self.jit.remove_disassembly_splits(key)
 
+    def remove_breakpoints_by_address(self, address):
+        """Remove all breakpoints associated with @address.
+        @address: address of breakpoints to remove
+        """
+        callbacks = self.breakpoints_handler.remove_name(address)
+        if callbacks:
+            self.jit.remove_disassembly_splits(address)
+
     def add_exception_handler(self, flag, callback):
         """Add a callback associated with an exception flag.
         @flag: bitflag