Fixed breakpoints on fast starting executables & fixed loading circle

This commit is contained in:
WebFreak001 2016-02-27 19:36:43 +01:00
commit 1b7dba5a50
2 changed files with 35 additions and 13 deletions

View file

@ -46,7 +46,7 @@ export class MI2 extends EventEmitter implements IBackend {
if (separateConsole !== undefined) if (separateConsole !== undefined)
promises.push(this.sendCommand("gdb-set new-console on")) promises.push(this.sendCommand("gdb-set new-console on"))
Promise.all(promises).then(() => { Promise.all(promises).then(() => {
this.emit("debug-ready") this.emit("debug-ready");
resolve(); resolve();
}, reject); }, reject);
} }
@ -55,14 +55,14 @@ export class MI2 extends EventEmitter implements IBackend {
linuxTerm.spawnTerminalEmulator(separateConsole).then(tty => { linuxTerm.spawnTerminalEmulator(separateConsole).then(tty => {
promises.push(this.sendCommand("inferior-tty-set " + tty)); promises.push(this.sendCommand("inferior-tty-set " + tty));
Promise.all(promises).then(() => { Promise.all(promises).then(() => {
this.emit("debug-ready") this.emit("debug-ready");
resolve(); resolve();
}, reject); }, reject);
}); });
} }
else { else {
Promise.all(promises).then(() => { Promise.all(promises).then(() => {
this.emit("debug-ready") this.emit("debug-ready");
resolve(); resolve();
}, reject); }, reject);
} }
@ -75,8 +75,8 @@ export class MI2 extends EventEmitter implements IBackend {
this.isSSH = true; this.isSSH = true;
this.sshReady = false; this.sshReady = false;
this.sshConn = new Client(); this.sshConn = new Client();
if(separateConsole !== undefined) if (separateConsole !== undefined)
this.log("stderr", "WARNING: Output to terminal emulators are not supported over SSH"); this.log("stderr", "WARNING: Output to terminal emulators are not supported over SSH");
if (args.forwardX11) { if (args.forwardX11) {
@ -286,13 +286,15 @@ export class MI2 extends EventEmitter implements IBackend {
start(): Thenable<boolean> { start(): Thenable<boolean> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.log("console", "Running executable"); this.once("ui-break-done", () => {
this.sendCommand("exec-run").then((info) => { this.log("console", "Running executable");
if (info.resultRecords.resultClass == "running") this.sendCommand("exec-run").then((info) => {
resolve(); if (info.resultRecords.resultClass == "running")
else resolve();
reject(); else
}, reject); reject();
}, reject);
});
}); });
} }

View file

@ -181,9 +181,17 @@ class MI2DebugSession extends DebugSession {
all.push(this.gdbDebugger.addBreakPoint({ file: path, line: brk.line, condition: brk.condition })); all.push(this.gdbDebugger.addBreakPoint({ file: path, line: brk.line, condition: brk.condition }));
}); });
Promise.all(all).then(brkpoints => { Promise.all(all).then(brkpoints => {
let finalBrks = [];
brkpoints.forEach(brkp => {
if (brkp[0])
finalBrks.push({ line: brkp[1].line });
});
response.body = { response.body = {
breakpoints: brkpoints breakpoints: finalBrks
}; };
setTimeout(() => {
this.gdbDebugger.emit("ui-break-done");
}, 50);
this.sendResponse(response); this.sendResponse(response);
}); });
}); });
@ -277,6 +285,12 @@ class MI2DebugSession extends DebugSession {
variables: variables variables: variables
}; };
this.sendResponse(response); this.sendResponse(response);
}, err => {
this.handleMsg("stderr", "Could not expand variable\n");
response.body = {
variables: []
};
this.sendResponse(response);
}); });
} }
else { else {
@ -297,6 +311,12 @@ class MI2DebugSession extends DebugSession {
variables: expanded variables: expanded
}; };
this.sendResponse(response); this.sendResponse(response);
}, err => {
this.handleMsg("stderr", "Could not expand variable\n");
response.body = {
variables: []
};
this.sendResponse(response);
}); });
} }
} }