mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-23 06:09:59 -06:00
gdb: Wait for the application to start if user connect gdb too early
This commit is contained in:
@ -47,7 +47,7 @@ namespace Ryujinx.HLE.Debugger
|
|||||||
MessageHandlerThread.Start();
|
MessageHandlerThread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IDebuggableProcess DebugProcess => Device.System.DebugGetApplicationProcess();
|
private IDebuggableProcess DebugProcess => Device.System?.DebugGetApplicationProcess();
|
||||||
private KThread[] GetThreads() => DebugProcess.GetThreadUids().Select(x => DebugProcess.GetThread(x)).ToArray();
|
private KThread[] GetThreads() => DebugProcess.GetThreadUids().Select(x => DebugProcess.GetThread(x)).ToArray();
|
||||||
private bool IsProcessAarch32 => DebugProcess.GetThread(gThread.Value).Context.IsAarch32;
|
private bool IsProcessAarch32 => DebugProcess.GetThread(gThread.Value).Context.IsAarch32;
|
||||||
private KernelContext KernelContext => Device.System.KernelContext;
|
private KernelContext KernelContext => Device.System.KernelContext;
|
||||||
@ -761,6 +761,20 @@ namespace Ryujinx.HLE.Debugger
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the user connects before the application is running, wait for the application to start.
|
||||||
|
int retries = 10;
|
||||||
|
while (DebugProcess == null && retries-- > 0)
|
||||||
|
{
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
if (DebugProcess == null)
|
||||||
|
{
|
||||||
|
Logger.Warning?.Print(LogClass.GdbStub, "Application is not running, cannot accept GDB client connection");
|
||||||
|
ClientSocket.Close();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ClientSocket.NoDelay = true;
|
ClientSocket.NoDelay = true;
|
||||||
ReadStream = new NetworkStream(ClientSocket, System.IO.FileAccess.Read);
|
ReadStream = new NetworkStream(ClientSocket, System.IO.FileAccess.Read);
|
||||||
WriteStream = new NetworkStream(ClientSocket, System.IO.FileAccess.Write);
|
WriteStream = new NetworkStream(ClientSocket, System.IO.FileAccess.Write);
|
||||||
|
Reference in New Issue
Block a user