This commit is contained in:
WebFreak001 2017-04-14 18:11:36 +02:00
commit 656ef0d2c0
3 changed files with 11 additions and 0 deletions

View file

@ -41,6 +41,7 @@ export class MI2 extends EventEmitter implements IBackend {
this.process.stdout.on("data", this.stdout.bind(this));
this.process.stderr.on("data", this.stderr.bind(this));
this.process.on("exit", (() => { this.emit("quit"); }).bind(this));
this.process.on("error", ((err) => { this.emit("launcherror", err); }).bind(this));
let promises = this.initCommands(target, cwd);
if (procArgs && procArgs.length)
promises.push(this.sendCommand("exec-arguments " + procArgs));
@ -196,6 +197,7 @@ export class MI2 extends EventEmitter implements IBackend {
this.process.stdout.on("data", this.stdout.bind(this));
this.process.stderr.on("data", this.stderr.bind(this));
this.process.on("exit", (() => { this.emit("quit"); }).bind(this));
this.process.on("error", ((err) => { this.emit("launcherror", err); }).bind(this));
var commands = [
this.sendCommand("gdb-set target-async on"),
this.sendCommand("environment-directory \"" + escape(cwd) + "\"")
@ -224,6 +226,7 @@ export class MI2 extends EventEmitter implements IBackend {
this.process.stdout.on("data", this.stdout.bind(this));
this.process.stderr.on("data", this.stderr.bind(this));
this.process.on("exit", (() => { this.emit("quit"); }).bind(this));
this.process.on("error", ((err) => { this.emit("launcherror", err); }).bind(this));
Promise.all([
this.sendCommand("gdb-set target-async on"),
this.sendCommand("environment-directory \"" + escape(cwd) + "\""),

View file

@ -29,6 +29,7 @@ export class MI2_LLDB extends MI2 {
this.process.stdout.on("data", this.stdout.bind(this));
this.process.stderr.on("data", this.stderr.bind(this));
this.process.on("exit", (() => { this.emit("quit"); }).bind(this));
this.process.on("error", ((err) => { this.emit("launcherror", err); }).bind(this));
Promise.all([
this.sendCommand("gdb-set target-async on"),
this.sendCommand("file-exec-and-symbols \"" + escape(executable) + "\""),

View file

@ -39,6 +39,7 @@ export class MI2DebugSession extends DebugSession {
}
protected initDebugger() {
this.miDebugger.on("launcherror", this.launchError.bind(this));
this.miDebugger.on("quit", this.quitEvent.bind(this));
this.miDebugger.on("exited-normally", this.quitEvent.bind(this));
this.miDebugger.on("stopped", this.stopEvent.bind(this));
@ -109,6 +110,12 @@ export class MI2DebugSession extends DebugSession {
this.sendEvent(new TerminatedEvent());
}
protected launchError(err: any) {
this.handleMsg("stderr", "Could not start debugger process, does the program exist in filesystem?\n");
this.handleMsg("stderr", err.toString() + "\n");
this.quitEvent();
}
protected disconnectRequest(response: DebugProtocol.DisconnectResponse, args: DebugProtocol.DisconnectArguments): void {
if (this.attached)
this.miDebugger.detach();