From 3a94ad3a016b50fd39569f1741fa36c422a2489f Mon Sep 17 00:00:00 2001 From: Mattias Hansson Date: Wed, 22 Jul 2026 22:19:58 +0200 Subject: [PATCH] Working with DeepSeek trying to get debugging working --- src/protocol/client.ts | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/protocol/client.ts b/src/protocol/client.ts index 6dccd85..9a95ea4 100644 --- a/src/protocol/client.ts +++ b/src/protocol/client.ts @@ -236,29 +236,14 @@ export class ViceClient { // Don't return - continue to check for pending requests } - // VICE sends async events with ReqID=0xffffffff - // For these, we match by response type to the oldest pending request expecting that type + // VICE sends unsolicited events with ReqID=0xffffffff. + // These are state notifications (Stopped/Resumed) or auto-sent data on + // monitor entry (RegisterInfo). They must NOT be matched to pending + // requests by response type — doing so would consume the auto-sent + // RegisterInfo as the response to a pending getRegisters() call, + // returning the pre-breakpoint PC instead of the actual breakpoint PC. if (response.requestId === 0xffffffff) { - // Find a pending request that expects this response type - for (const [reqId, pending] of this.pendingRequests) { - if (pending.expectedResponseType === response.responseType) { - debugLog(`Matched async response type 0x${response.responseType.toString(16)} to request ${reqId}`); - this.pendingRequests.delete(reqId); - if (response.errorCode !== ErrorCode.Ok) { - pending.reject( - this.makeError( - `VICE_ERROR_${response.errorCode}`, - `VICE returned error code ${response.errorCode}`, - this.getErrorSuggestion(response.errorCode) - ) - ); - } else { - pending.resolve(response); - } - return; - } - } - debugLog(`No pending request matched async response type 0x${response.responseType.toString(16)}`); + debugLog(`Ignoring unsolicited event type 0x${response.responseType.toString(16)} (reqId=0xffffffff)`); return; }