diff --git a/CHANGELOG.md b/CHANGELOG.md index 2778ce1..ef2894b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Prevent exception with stopOnEntry + ## [1.0.5] - 2023-11-15 +### Fixed + - Force kill emulator if SIGKILL doesn't work - Handle unsupported message types 'S' for stop codes and 'O' for output - Special case to handle S05 as exception. Ideally the emulator would return appropriate codes for each exception type, diff --git a/src/debugSession.ts b/src/debugSession.ts index 34bd7b3..1f814d3 100644 --- a/src/debugSession.ts +++ b/src/debugSession.ts @@ -129,6 +129,7 @@ export class UAEDebugSession extends LoggingDebugSession { protected trace = false; protected stopOnEntry = false; protected exceptionMask = defaultArgs.exceptionMask; + protected awaitingStopOnEntry = false; protected breakpoints?: BreakpointManager; protected variables?: VariableManager; @@ -158,11 +159,13 @@ export class UAEDebugSession extends LoggingDebugSession { const mutex = new Mutex(); this.gdb.on("stop", (haltStatus) => { - mutex.runExclusive(async () => { - return this.handleStop(haltStatus).catch((err) => { - logger.error(this.errorString(err)); + if (!this.awaitingStopOnEntry) { + mutex.runExclusive(async () => { + return this.handleStop(haltStatus).catch((err) => { + logger.error(this.errorString(err)); + }); }); - }); + } }); this.gdb.on("end", this.shutdown.bind(this)); this.gdb.on("output", (msg) => @@ -343,8 +346,11 @@ export class UAEDebugSession extends LoggingDebugSession { if (args.stopOnEntry) { logger.log("[LAUNCH] Stopping on entry"); + // Tell the standard stop hander to ignore + this.awaitingStopOnEntry = true; await this.gdb.stepIn(Threads.CPU); this.sendStoppedEvent(Threads.CPU, "entry"); + this.awaitingStopOnEntry = false; } // Tell client that we can now handle breakpoints etc.