From be236d47c884325a9031ad8a9d19afd50bc744d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 14 Aug 2026 10:21:46 +0200 Subject: [PATCH] Debugger: surface Core_RequestCPUStep() failure on cpu.stepInto instead of silently hanging Into()'s same-thread branch called Core_RequestCPUStep(CPUStepType::Into, 1) without checking its return value. Core_RequestCPUStep() can genuinely fail (a step/run request is already queued this host frame - see its own "Can't submit two steps in one host frame" ERROR_LOG) - on failure, no step happens and no cpu.stepping event ever fires, but cpu.stepInto's own contract is "no immediate response, a cpu.stepping event follows", so a rejected request looked identical to a request still in flight: nothing to distinguish "wait longer" from "this silently failed, nothing is ever coming." This is part of the same failure family as the delay-slot race just fixed in PrepareResume() (previous commit) - Core_RequestCPUStep()'s one-at-a-time guard rejecting a step no caller in this file checked for. Now calls req.Fail() on rejection so the client gets an explicit answer instead of an indefinite wait. Updated the cpu.stepInto doc comment to note the new (retryable) failure mode. Verified via UnitTest.exe all (49/49). Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9 --- Core/Debugger/WebSocket/SteppingSubscriber.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Core/Debugger/WebSocket/SteppingSubscriber.cpp b/Core/Debugger/WebSocket/SteppingSubscriber.cpp index f6d7040548..cd13db9878 100644 --- a/Core/Debugger/WebSocket/SteppingSubscriber.cpp +++ b/Core/Debugger/WebSocket/SteppingSubscriber.cpp @@ -82,7 +82,9 @@ static DebugInterface *CPUFromRequest(DebuggerRequest &req, uint32_t *threadID = // Parameters: // - thread: optional number indicating the thread id to plan stepping on. // -// No immediate response. A cpu.stepping event will be sent once complete. +// No immediate response on success. A cpu.stepping event will be sent once complete. +// May fail (same-thread case only) if another step/run request is already pending this host +// frame - safe to retry shortly after. // // Note: any thread can wake the cpu when it hits the next instruction currently. void WebSocketSteppingState::Into(DebuggerRequest &req) { @@ -108,7 +110,16 @@ void WebSocketSteppingState::Into(DebuggerRequest &req) { // If the current PC is on a breakpoint, the user doesn't want to do nothing. g_breakpoints.SetSkipFirst(currentMIPS->pc); - Core_RequestCPUStep(CPUStepType::Into, 1); + // Core_RequestCPUStep() can fail (a step or run request is already queued this host + // frame - see its own "Can't submit two steps in one host frame" log). Previously + // unchecked here: on failure, no step ever happens and no cpu.stepping event ever + // fires, but the client got no response either (this event's contract is "no + // immediate response, a cpu.stepping event follows") - so a rejected step looked + // identical to one that's just still in flight, indefinitely. Surface it instead. + if (!Core_RequestCPUStep(CPUStepType::Into, 1)) { + req.Fail("Could not step: a step or run request is already pending"); + return; + } } else { uint32_t breakpointAddress = cpuDebug->GetPC(); PrepareResume();