mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 00:16:23 +02:00
gdb: Wait for the application to start if user connect gdb too early
This commit is contained in:
parent
2c01f30f41
commit
84e078f94c
1 changed files with 15 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue