mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-27 22:06:24 +02:00
gdb: Wait for the application to start if user connect gdb too early
This commit is contained in:
parent
8682c51ef7
commit
737afbfa2f
1 changed files with 15 additions and 1 deletions
|
@ -47,7 +47,7 @@ namespace Ryujinx.HLE.Debugger
|
|||
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 bool IsProcessAarch32 => DebugProcess.GetThread(gThread.Value).Context.IsAarch32;
|
||||
private KernelContext KernelContext => Device.System.KernelContext;
|
||||
|
@ -761,6 +761,20 @@ namespace Ryujinx.HLE.Debugger
|
|||
{
|
||||
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;
|
||||
ReadStream = new NetworkStream(ClientSocket, System.IO.FileAccess.Read);
|
||||
WriteStream = new NetworkStream(ClientSocket, System.IO.FileAccess.Write);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue