gdb: Add timeout to prevent deadlock in DebugStep

Deadlock can happen when step at some svc instructions.
This commit is contained in:
Coxxs 2025-06-21 05:26:48 +08:00
parent 9c5d81201d
commit a2b35ecce3

View file

@ -1283,7 +1283,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
}
_kernelContext.CriticalSection.Leave();
StepBarrier.SignalAndWait();
bool stepTimedOut = false;
if (!StepBarrier.SignalAndWait(TimeSpan.FromMilliseconds(2000)))
{
Logger.Warning?.Print(LogClass.Kernel, $"Failed to step thread {target.ThreadUid} in time.");
stepTimedOut = true;
}
_kernelContext.CriticalSection.Enter();
steppingThread = null;
@ -1302,6 +1307,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
target.Suspend(ThreadSchedState.ThreadPauseFlag);
}
_kernelContext.CriticalSection.Leave();
if (stepTimedOut)
{
return false;
}
StepBarrier.SignalAndWait();
return true;
}