From 4d8d7e01c63c7d3ae502bc1f9caa3368d951112f Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 19 Oct 2015 17:17:53 +0200 Subject: Debugging: propagate status on breakpoint stop --- miasm2/analysis/debugging.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'miasm2/analysis/debugging.py') diff --git a/miasm2/analysis/debugging.py b/miasm2/analysis/debugging.py index 4e6982b3..592e21ff 100644 --- a/miasm2/analysis/debugging.py +++ b/miasm2/analysis/debugging.py @@ -149,6 +149,9 @@ class Debugguer(object): else: raise NotImplementedError("type res") + # Repropagate res + return res + def step(self): "Step in jit" @@ -165,9 +168,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" -- cgit 1.4.1 From 449999fe65bbf500574d92d7ebf55304ba725e67 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 19 Oct 2015 17:18:22 +0200 Subject: Debugging: handle breakpoint stop with a proper state --- miasm2/analysis/debugging.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'miasm2/analysis/debugging.py') diff --git a/miasm2/analysis/debugging.py b/miasm2/analysis/debugging.py index 592e21ff..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 -- cgit 1.4.1