Skip to content

Commit f5fa3ce

Browse files
committed
Re-factor debugSession & CP UI
We want to dispose of checkpoint UI data when debug session is closed.
1 parent cfca20e commit f5fa3ce

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

modules/gdb-dap/debugSession.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class MidasDAPSession extends DebugAdapter.DebugSession {
224224
/** @type {import("../terminalInterface").TerminalInterface} */
225225
#terminal;
226226

227-
// The Checkpoints UI
227+
/** @type {import("../ui/checkpoints/checkpoints").CheckpointsViewProvider }*/
228228
#checkpointsUI;
229229
#defaultLogger = (output) => {
230230
console.log(output);
@@ -244,7 +244,6 @@ class MidasDAPSession extends DebugAdapter.DebugSession {
244244
this.setDebuggerColumnsStartAt1(true);
245245
this.gdb = new Gdb(spawnConfig.path, spawnConfig.options ?? []);
246246
this.#terminal = terminal;
247-
248247
this.gdb.response_connect((response) => {
249248
if(!response.success) {
250249
const err = (response.body.error ?? { stacktrace: "No stack trace info" }).stacktrace;
@@ -279,7 +278,7 @@ class MidasDAPSession extends DebugAdapter.DebugSession {
279278
});
280279

281280
this.on("exit", (evt) => {
282-
this.disposeTerminal();
281+
this.dispose();
283282
});
284283

285284
this.on("error", (event) => {
@@ -288,6 +287,12 @@ class MidasDAPSession extends DebugAdapter.DebugSession {
288287

289288
}
290289

290+
dispose() {
291+
this.#checkpointsUI.tearDown();
292+
this.disposeTerminal();
293+
super.dispose();
294+
}
295+
291296
atExitCleanUp(signal) {
292297
this.gdb.gdb.kill(signal);
293298
if (this.#spawnConfig.disposeOnExit()) this.disposeTerminal();
@@ -296,6 +301,10 @@ class MidasDAPSession extends DebugAdapter.DebugSession {
296301
}
297302
}
298303

304+
shutdown() {
305+
console.log(`SHUTDOWN CALLED`);
306+
}
307+
299308
/**
300309
* @returns { import("../buildMode").MidasRunMode }
301310
*/
@@ -459,6 +468,7 @@ class MidasDAPSession extends DebugAdapter.DebugSession {
459468

460469
// eslint-disable-next-line no-unused-vars
461470
disconnectRequest(response, args, request) {
471+
this.#checkpointsUI.tearDown();
462472
this.gdb.sendRequest(request, args);
463473
}
464474

0 commit comments

Comments
 (0)