mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 01:49:39 -06:00
gdb: Add timeout to prevent deadlock in DebugStep
Deadlock can happen when step at some svc instructions.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user