Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure 'interrupt' and 'disconnect' signals are sent before '-gdb-exit' #338

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/desktop/GDBTargetDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,17 +472,15 @@ export class GDBTargetDebugSession extends GDBDebugSession {

if (this.targetType === 'remote') {
if (this.gdb.getAsyncMode() && this.isRunning) {
// See #295 - this use of "then" is to try to slightly delay the
// See #295 - this use of "await" is to try to slightly delay the
// call to disconnect. A proper solution that waits for the
// interrupt to be successful is needed to avoid future
// "Cannot execute this command while the target is running"
// errors
this.gdb
.sendCommand('interrupt')
.then(() => this.gdb.sendCommand('disconnect'));
} else {
await this.gdb.sendCommand('disconnect');
await this.gdb.sendCommand('interrupt');
}

await this.gdb.sendCommand('disconnect');
}

await this.gdb.sendGDBExit();
Expand Down
10 changes: 4 additions & 6 deletions src/web/GDBTargetDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,17 +327,15 @@ export class GDBTargetDebugSession extends GDBDebugSession {
try {
if (this.targetType === 'remote') {
if (this.gdb.getAsyncMode() && this.isRunning) {
// See #295 - this use of "then" is to try to slightly delay the
// See #295 - this use of "await" is to try to slightly delay the
// call to disconnect. A proper solution that waits for the
// interrupt to be successful is needed to avoid future
// "Cannot execute this command while the target is running"
// errors
this.gdb
.sendCommand('interrupt')
.then(() => this.gdb.sendCommand('disconnect'));
} else {
await this.gdb.sendCommand('disconnect');
await this.gdb.sendCommand('interrupt');
}

await this.gdb.sendCommand('disconnect');
}

await this.gdb.sendGDBExit();
Expand Down
Loading