Skip to content

Commit 656ef0d

Browse files
author
WebFreak001
committed
Fix #102
1 parent f766a9f commit 656ef0d

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/backend/mi2/mi2.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class MI2 extends EventEmitter implements IBackend {
4141
this.process.stdout.on("data", this.stdout.bind(this));
4242
this.process.stderr.on("data", this.stderr.bind(this));
4343
this.process.on("exit", (() => { this.emit("quit"); }).bind(this));
44+
this.process.on("error", ((err) => { this.emit("launcherror", err); }).bind(this));
4445
let promises = this.initCommands(target, cwd);
4546
if (procArgs && procArgs.length)
4647
promises.push(this.sendCommand("exec-arguments " + procArgs));
@@ -196,6 +197,7 @@ export class MI2 extends EventEmitter implements IBackend {
196197
this.process.stdout.on("data", this.stdout.bind(this));
197198
this.process.stderr.on("data", this.stderr.bind(this));
198199
this.process.on("exit", (() => { this.emit("quit"); }).bind(this));
200+
this.process.on("error", ((err) => { this.emit("launcherror", err); }).bind(this));
199201
var commands = [
200202
this.sendCommand("gdb-set target-async on"),
201203
this.sendCommand("environment-directory \"" + escape(cwd) + "\"")
@@ -224,6 +226,7 @@ export class MI2 extends EventEmitter implements IBackend {
224226
this.process.stdout.on("data", this.stdout.bind(this));
225227
this.process.stderr.on("data", this.stderr.bind(this));
226228
this.process.on("exit", (() => { this.emit("quit"); }).bind(this));
229+
this.process.on("error", ((err) => { this.emit("launcherror", err); }).bind(this));
227230
Promise.all([
228231
this.sendCommand("gdb-set target-async on"),
229232
this.sendCommand("environment-directory \"" + escape(cwd) + "\""),

src/backend/mi2/mi2lldb.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class MI2_LLDB extends MI2 {
2929
this.process.stdout.on("data", this.stdout.bind(this));
3030
this.process.stderr.on("data", this.stderr.bind(this));
3131
this.process.on("exit", (() => { this.emit("quit"); }).bind(this));
32+
this.process.on("error", ((err) => { this.emit("launcherror", err); }).bind(this));
3233
Promise.all([
3334
this.sendCommand("gdb-set target-async on"),
3435
this.sendCommand("file-exec-and-symbols \"" + escape(executable) + "\""),

src/mibase.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class MI2DebugSession extends DebugSession {
3939
}
4040

4141
protected initDebugger() {
42+
this.miDebugger.on("launcherror", this.launchError.bind(this));
4243
this.miDebugger.on("quit", this.quitEvent.bind(this));
4344
this.miDebugger.on("exited-normally", this.quitEvent.bind(this));
4445
this.miDebugger.on("stopped", this.stopEvent.bind(this));
@@ -109,6 +110,12 @@ export class MI2DebugSession extends DebugSession {
109110
this.sendEvent(new TerminatedEvent());
110111
}
111112

113+
protected launchError(err: any) {
114+
this.handleMsg("stderr", "Could not start debugger process, does the program exist in filesystem?\n");
115+
this.handleMsg("stderr", err.toString() + "\n");
116+
this.quitEvent();
117+
}
118+
112119
protected disconnectRequest(response: DebugProtocol.DisconnectResponse, args: DebugProtocol.DisconnectArguments): void {
113120
if (this.attached)
114121
this.miDebugger.detach();

0 commit comments

Comments
 (0)