diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2015-10-20 10:43:59 +0200 |
|---|---|---|
| committer | serpilliere <serpilliere@users.noreply.github.com> | 2015-10-20 10:43:59 +0200 |
| commit | cc98370ff37b53ce3524273f708a17faff99661c (patch) | |
| tree | 736dcaa79cb1c050199d9817d58f7ae11949c828 /miasm2/analysis/debugging.py | |
| parent | 861e0dc047b3a6675aa8a9b131a53cb6d4dd033f (diff) | |
| parent | a2a309511b162c3b1c28307274f2451d029f19f8 (diff) | |
| download | miasm-cc98370ff37b53ce3524273f708a17faff99661c.tar.gz miasm-cc98370ff37b53ce3524273f708a17faff99661c.zip | |
Merge pull request #230 from commial/fix_gdbserver
Fix gdbserver
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" |