diff options
Diffstat (limited to 'miasm2/analysis/debugging.py')
| -rw-r--r-- | miasm2/analysis/debugging.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/miasm2/analysis/debugging.py b/miasm2/analysis/debugging.py index 4e6982b3..3fffbf66 100644 --- a/miasm2/analysis/debugging.py +++ b/miasm2/analysis/debugging.py @@ -22,6 +22,16 @@ class DebugBreakpointSoft(DebugBreakpoint): return "Soft BP @0x%08x" % self.addr +class DebugBreakpointTerminate(DebugBreakpoint): + "Stand for an execution termination" + + def __init__(self, status): + self.status = status + + def __str__(self): + return "Terminate with %s" % self.status + + class DebugBreakpointMemory(DebugBreakpoint): "Stand for memory breakpoint" @@ -131,8 +141,9 @@ class Debugguer(object): self.myjit.jit.log_newbloc = newbloc def handle_exception(self, res): - if res is None: - return + if not res: + # A breakpoint has stopped the execution + return DebugBreakpointTerminate(res) if isinstance(res, DebugBreakpointSoft): print "Breakpoint reached @0x%08x" % res.addr @@ -149,6 +160,9 @@ class Debugguer(object): else: raise NotImplementedError("type res") + # Repropagate res + return res + def step(self): "Step in jit" @@ -165,9 +179,8 @@ class Debugguer(object): return res def run(self): - res = self.myjit.continue_run() - self.handle_exception(res) - return res + status = self.myjit.continue_run() + return self.handle_exception(status) def get_mem(self, addr, size=0xF): "hexdump @addr, size" |