Skip to content

Commit

Permalink
Re-factor debugSession & CP UI
Browse files Browse the repository at this point in the history
We want to dispose of checkpoint UI data when debug session is closed.
  • Loading branch information
theIDinside committed Jan 20, 2024
1 parent cfca20e commit f5fa3ce
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions modules/gdb-dap/debugSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class MidasDAPSession extends DebugAdapter.DebugSession {
/** @type {import("../terminalInterface").TerminalInterface} */
#terminal;

// The Checkpoints UI
/** @type {import("../ui/checkpoints/checkpoints").CheckpointsViewProvider }*/
#checkpointsUI;
#defaultLogger = (output) => {
console.log(output);
Expand All @@ -244,7 +244,6 @@ class MidasDAPSession extends DebugAdapter.DebugSession {
this.setDebuggerColumnsStartAt1(true);
this.gdb = new Gdb(spawnConfig.path, spawnConfig.options ?? []);
this.#terminal = terminal;

this.gdb.response_connect((response) => {
if(!response.success) {
const err = (response.body.error ?? { stacktrace: "No stack trace info" }).stacktrace;
Expand Down Expand Up @@ -279,7 +278,7 @@ class MidasDAPSession extends DebugAdapter.DebugSession {
});

this.on("exit", (evt) => {
this.disposeTerminal();
this.dispose();
});

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

}

dispose() {
this.#checkpointsUI.tearDown();
this.disposeTerminal();
super.dispose();
}

atExitCleanUp(signal) {
this.gdb.gdb.kill(signal);
if (this.#spawnConfig.disposeOnExit()) this.disposeTerminal();
Expand All @@ -296,6 +301,10 @@ class MidasDAPSession extends DebugAdapter.DebugSession {
}
}

shutdown() {
console.log(`SHUTDOWN CALLED`);
}

/**
* @returns { import("../buildMode").MidasRunMode }
*/
Expand Down Expand Up @@ -459,6 +468,7 @@ class MidasDAPSession extends DebugAdapter.DebugSession {

// eslint-disable-next-line no-unused-vars
disconnectRequest(response, args, request) {
this.#checkpointsUI.tearDown();
this.gdb.sendRequest(request, args);
}

Expand Down

0 comments on commit f5fa3ce

Please sign in to comment.