Added check for crash on startup (fix #38)
This commit is contained in:
parent
b81a7bc1c2
commit
4b12e2ad52
1 changed files with 13 additions and 1 deletions
14
src/gdb.ts
14
src/gdb.ts
|
|
@ -39,6 +39,8 @@ class MI2DebugSession extends DebugSession {
|
||||||
private isSSH: boolean;
|
private isSSH: boolean;
|
||||||
private trimCWD: string;
|
private trimCWD: string;
|
||||||
private switchCWD: string;
|
private switchCWD: string;
|
||||||
|
private started: boolean;
|
||||||
|
private crashed: boolean;
|
||||||
|
|
||||||
public constructor(debuggerLinesStartAt1: boolean, isServer: boolean = false) {
|
public constructor(debuggerLinesStartAt1: boolean, isServer: boolean = false) {
|
||||||
super(debuggerLinesStartAt1, isServer);
|
super(debuggerLinesStartAt1, isServer);
|
||||||
|
|
@ -82,6 +84,8 @@ class MI2DebugSession extends DebugSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
private stopEvent(info: MINode) {
|
private stopEvent(info: MINode) {
|
||||||
|
if (!this.started)
|
||||||
|
this.crashed = true;
|
||||||
if (!this.quit)
|
if (!this.quit)
|
||||||
this.sendEvent(new StoppedEvent("exception", MI2DebugSession.THREAD_ID));
|
this.sendEvent(new StoppedEvent("exception", MI2DebugSession.THREAD_ID));
|
||||||
}
|
}
|
||||||
|
|
@ -96,6 +100,8 @@ class MI2DebugSession extends DebugSession {
|
||||||
this.attached = false;
|
this.attached = false;
|
||||||
this.needContinue = false;
|
this.needContinue = false;
|
||||||
this.isSSH = false;
|
this.isSSH = false;
|
||||||
|
this.started = false;
|
||||||
|
this.crashed = false;
|
||||||
this.gdbDebugger.printCalls = !!args.printCalls;
|
this.gdbDebugger.printCalls = !!args.printCalls;
|
||||||
if (args.ssh !== undefined) {
|
if (args.ssh !== undefined) {
|
||||||
if (args.ssh.forwardX11 === undefined)
|
if (args.ssh.forwardX11 === undefined)
|
||||||
|
|
@ -117,7 +123,10 @@ class MI2DebugSession extends DebugSession {
|
||||||
this.gdbDebugger.sendUserInput(command);
|
this.gdbDebugger.sendUserInput(command);
|
||||||
});
|
});
|
||||||
this.gdbDebugger.start().then(() => {
|
this.gdbDebugger.start().then(() => {
|
||||||
|
this.started = true;
|
||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
|
if (this.crashed)
|
||||||
|
this.handlePause(undefined);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +137,10 @@ class MI2DebugSession extends DebugSession {
|
||||||
this.gdbDebugger.sendUserInput(command);
|
this.gdbDebugger.sendUserInput(command);
|
||||||
});
|
});
|
||||||
this.gdbDebugger.start().then(() => {
|
this.gdbDebugger.start().then(() => {
|
||||||
|
this.started = true;
|
||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
|
if (this.crashed)
|
||||||
|
this.handlePause(undefined);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -296,7 +308,7 @@ class MI2DebugSession extends DebugSession {
|
||||||
else {
|
else {
|
||||||
// Variable members
|
// Variable members
|
||||||
this.gdbDebugger.evalExpression(JSON.stringify(id)).then(variable => {
|
this.gdbDebugger.evalExpression(JSON.stringify(id)).then(variable => {
|
||||||
let expanded = expandValue(createVariable, variable.result("value"));
|
let expanded = expandValue(createVariable, variable.result("value"), id);
|
||||||
if (!expanded)
|
if (!expanded)
|
||||||
this.sendEvent(new OutputEvent("Could not expand " + variable.result("value") + "\n", "stderr"));
|
this.sendEvent(new OutputEvent("Could not expand " + variable.result("value") + "\n", "stderr"));
|
||||||
else if (typeof expanded[0] == "string")
|
else if (typeof expanded[0] == "string")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue