Skip to content

Commit 9377356

Browse files
committed
Delay terminate, 0.4.8-pre2
1 parent cc3b23e commit 9377356

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.4.8-pre1",
2+
"version": "0.4.8-pre2",
33
"activationEvents": [
44
"onDebugResolve:cortex-debug"
55
],

src/gdb.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ export class GDBDebugSession extends DebugSession {
961961

962962
private waitForServerExitAndRespond(response: DebugProtocol.DisconnectResponse) {
963963
if (!this.server.isExternal()) {
964-
let nTimes = 10;
964+
let nTimes = 60;
965965
let to = setInterval(() => {
966966
if ((nTimes === 0) || this.quit) {
967967
// We waited long enough so try to nuke the server and send VSCode a response
@@ -974,7 +974,7 @@ export class GDBDebugSession extends DebugSession {
974974
} else {
975975
nTimes--;
976976
}
977-
}, 60);
977+
}, 10);
978978
this.server.once('exit', () => {
979979
if (to) {
980980
clearInterval(to);
@@ -1272,11 +1272,18 @@ export class GDBDebugSession extends DebugSession {
12721272
this.handleMsg('log', '**** quit event\n');
12731273
}
12741274
if (this.server) {
1275+
// A gdb quit may be happening with VSCode asking us to finish or a crash or user doing something
12751276
ServerConsoleLog('quitEvent: Killing server');
12761277
this.server.exit();
12771278
}
12781279
this.quit = true;
1279-
this.sendEvent(new TerminatedEvent());
1280+
setTimeout (() => {
1281+
// In case GDB quit because of normal processing, let that process finish. Wait for,\
1282+
// a disconnect reponse to be sent before we send a TerminatedEvent();. Note that we could
1283+
// also be here because the server crashed/quit on us before gdb-did
1284+
ServerConsoleLog('quitEvent: sending VSCode TerminatedEvent');
1285+
this.sendEvent(new TerminatedEvent());
1286+
}, 10);
12801287
}
12811288

12821289
protected launchError(err: any) {

0 commit comments

Comments
 (0)