debugger disable memory breakpoint before calling membp.trigger()

This commit is contained in:
Clement Rouault
2016-07-18 16:30:17 +02:00
parent 3184cbdeab
commit 13f231d6ad
+10 -1
View File
@@ -461,7 +461,8 @@ class Debugger(object):
self._pass_memory_breakpoint(bp, original_prot, fault_page)
return DBG_CONTINUE
continue_flag = mem_bp.trigger(self, exception)
with self.DisabledMemoryBreakpoint()
continue_flag = mem_bp.trigger(self, exception)
self._explicit_single_step[self.current_thread.tid] = self.current_thread.context.EEFlags.TF
# If BP has not been removed in trigger, pas it
if fault_page in cp_watch_page and mem_bp in cp_watch_page[fault_page].bps:
@@ -716,6 +717,14 @@ class Debugger(object):
target.virtual_protect(page_addr, PAGE_SIZE, protection, None)
return
@contextmanager
def DisabledMemoryBreakpoint(self, target=None):
data = self.disable_all_memory_breakpoints(target)
try:
yield
finally:
self.restore_all_memory_breakpoints(data, target)
# Public callback
def on_exception(self, exception):
"""Called on exception event other that known breakpoint or requested single step. ``exception`` is one of the following type: