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)
promises.push(this.sendCommand("gdb-set new-console on"))
Promise.all(promises).then(() => {
this.emit("debug-ready")
this.emit("debug-ready");
resolve();
}, reject);
}
@ -55,14 +55,14 @@ export class MI2 extends EventEmitter implements IBackend {
linuxTerm.spawnTerminalEmulator(separateConsole).then(tty => {
promises.push(this.sendCommand("inferior-tty-set " + tty));
Promise.all(promises).then(() => {
this.emit("debug-ready")
this.emit("debug-ready");
resolve();
}, reject);
});
}
else {
Promise.all(promises).then(() => {
this.emit("debug-ready")
this.emit("debug-ready");
resolve();
}, reject);
}
@ -75,8 +75,8 @@ export class MI2 extends EventEmitter implements IBackend {
this.isSSH = true;
this.sshReady = false;
this.sshConn = new Client();
if(separateConsole !== undefined)
if (separateConsole !== undefined)
this.log("stderr", "WARNING: Output to terminal emulators are not supported over SSH");
if (args.forwardX11) {
@ -286,13 +286,15 @@ export class MI2 extends EventEmitter implements IBackend {
start(): Thenable<boolean> {
return new Promise((resolve, reject) => {
this.log("console", "Running executable");
this.sendCommand("exec-run").then((info) => {
if (info.resultRecords.resultClass == "running")
resolve();
else
reject();
}, reject);
this.once("ui-break-done", () => {
this.log("console", "Running executable");
this.sendCommand("exec-run").then((info) => {
if (info.resultRecords.resultClass == "running")
resolve();
else
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 }));
});
Promise.all(all).then(brkpoints => {
let finalBrks = [];
brkpoints.forEach(brkp => {
if (brkp[0])
finalBrks.push({ line: brkp[1].line });
});
response.body = {
breakpoints: brkpoints
breakpoints: finalBrks
};
setTimeout(() => {
this.gdbDebugger.emit("ui-break-done");
}, 50);
this.sendResponse(response);
});
});
@ -277,6 +285,12 @@ class MI2DebugSession extends DebugSession {
variables: variables
};
this.sendResponse(response);
}, err => {
this.handleMsg("stderr", "Could not expand variable\n");
response.body = {
variables: []
};
this.sendResponse(response);
});
}
else {
@ -297,6 +311,12 @@ class MI2DebugSession extends DebugSession {
variables: expanded
};
this.sendResponse(response);
}, err => {
this.handleMsg("stderr", "Could not expand variable\n");
response.body = {
variables: []
};
this.sendResponse(response);
});
}
}