Added propper pause messages in gui for pause & breakpoint

This commit is contained in:
WebFreak001 2016-02-09 15:50:01 +01:00
commit 438e474cf7
2 changed files with 19 additions and 5 deletions

View file

@ -92,14 +92,19 @@ export class MI2 extends EventEmitter implements IBackend {
if (record.asyncClass == "running") if (record.asyncClass == "running")
this.emit("running", parsed); this.emit("running", parsed);
else if (record.asyncClass == "stopped") { else if (record.asyncClass == "stopped") {
if (parsed.record("reason") == "breakpoint-hit") let reason = parsed.record("reason");
if (reason == "breakpoint-hit")
this.emit("breakpoint", parsed); this.emit("breakpoint", parsed);
else if (parsed.record("reason") == "end-stepping-range") else if (reason == "end-stepping-range")
this.emit("step-end", parsed); this.emit("step-end", parsed);
else if (parsed.record("reason") == "function-finished") else if (reason == "function-finished")
this.emit("step-out-end", parsed); this.emit("step-out-end", parsed);
else else if (reason == "signal-received")
this.emit("signal-stop", parsed);
else {
this.log("console", "Not implemented stop reason (assuming exception): " + reason);
this.emit("stopped", parsed); this.emit("stopped", parsed);
}
} else } else
this.log("log", JSON.stringify(parsed)); this.log("log", JSON.stringify(parsed));
} }

View file

@ -38,9 +38,10 @@ class MI2DebugSession extends DebugSession {
this.gdbDebugger.on("quit", this.quitEvent.bind(this)); this.gdbDebugger.on("quit", this.quitEvent.bind(this));
this.gdbDebugger.on("stopped", this.stopEvent.bind(this)); this.gdbDebugger.on("stopped", this.stopEvent.bind(this));
this.gdbDebugger.on("msg", this.handleMsg.bind(this)); this.gdbDebugger.on("msg", this.handleMsg.bind(this));
this.gdbDebugger.on("breakpoint", this.handleBreak.bind(this)); this.gdbDebugger.on("breakpoint", this.handleBreakpoint.bind(this));
this.gdbDebugger.on("step-end", this.handleBreak.bind(this)); this.gdbDebugger.on("step-end", this.handleBreak.bind(this));
this.gdbDebugger.on("step-out-end", this.handleBreak.bind(this)); this.gdbDebugger.on("step-out-end", this.handleBreak.bind(this));
this.gdbDebugger.on("signal-stop", this.handlePause.bind(this));
this.sendEvent(new InitializedEvent()); this.sendEvent(new InitializedEvent());
} }
@ -52,10 +53,18 @@ class MI2DebugSession extends DebugSession {
this.sendEvent(new OutputEvent(msg, type)); this.sendEvent(new OutputEvent(msg, type));
} }
private handleBreakpoint(info: MINode) {
this.sendEvent(new StoppedEvent("breakpoint", MI2DebugSession.THREAD_ID));
}
private handleBreak(info: MINode) { private handleBreak(info: MINode) {
this.sendEvent(new StoppedEvent("step", MI2DebugSession.THREAD_ID)); this.sendEvent(new StoppedEvent("step", MI2DebugSession.THREAD_ID));
} }
private handlePause(info: MINode) {
this.sendEvent(new StoppedEvent("user request", MI2DebugSession.THREAD_ID));
}
private stopEvent(info: MINode) { private stopEvent(info: MINode) {
if (!this.quit) if (!this.quit)
this.sendEvent(new StoppedEvent("exception", MI2DebugSession.THREAD_ID)); this.sendEvent(new StoppedEvent("exception", MI2DebugSession.THREAD_ID));