diff --git a/src/backend/mi2/mi2.ts b/src/backend/mi2/mi2.ts index 4bfbabb1..a8dbf958 100644 --- a/src/backend/mi2/mi2.ts +++ b/src/backend/mi2/mi2.ts @@ -179,7 +179,7 @@ export class MI2 extends EventEmitter implements IBackend { const sigstr = signal ? `, signal: ${signal}` : ''; const how = this.exiting ? '' : ((code || signal) ? ' unexpectedly' : ''); const msg = `GDB session ended${how}. exit-code: ${codestr}${sigstr}\n`; - this.emit('quit', msg); + this.emit('quit', how ? 'stderr' : 'stdout', msg); } } diff --git a/src/gdb.ts b/src/gdb.ts index b88ec16b..cbd36b78 100755 --- a/src/gdb.ts +++ b/src/gdb.ts @@ -1742,13 +1742,13 @@ export class GDBDebugSession extends LoggingDebugSession { } } - protected quitEvent(msg?: string) { + protected quitEvent(type?: string, msg?: string) { this.quit = true; if (traceThreads) { this.handleMsg('log', '**** quit event\n'); } - if (msg) { - this.handleMsg('stderr', msg); + if (msg && type) { + this.handleMsg(type, msg); } if (this.server && this.server.isProcessRunning()) { // A gdb quit may be happening with VSCode asking us to finish or a crash or user doing something