mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-05-23 05:35:47 +00:00
gdb: Fix the crash that occurs when GDB is connected early (ryubing/ryujinx!159)
See merge request ryubing/ryujinx!159
This commit is contained in:
@@ -859,7 +859,13 @@ namespace Ryujinx.HLE.Debugger
|
|||||||
{
|
{
|
||||||
if (threadId == 0 || threadId == null)
|
if (threadId == 0 || threadId == null)
|
||||||
{
|
{
|
||||||
threadId = GetThreads().First().ThreadUid;
|
var threads = GetThreads();
|
||||||
|
if (threads.Length == 0)
|
||||||
|
{
|
||||||
|
ReplyError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
threadId = threads.First().ThreadUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DebugProcess.GetThread(threadId.Value) == null)
|
if (DebugProcess.GetThread(threadId.Value) == null)
|
||||||
@@ -1037,7 +1043,7 @@ namespace Ryujinx.HLE.Debugger
|
|||||||
|
|
||||||
string response = command.Trim().ToLowerInvariant() switch
|
string response = command.Trim().ToLowerInvariant() switch
|
||||||
{
|
{
|
||||||
"help" => "backtrace\nbt\nregisters\nreg\nget info\nminidump",
|
"help" => "backtrace\nbt\nregisters\nreg\nget info\nminidump\n",
|
||||||
"get info" => GetProcessInfo(),
|
"get info" => GetProcessInfo(),
|
||||||
"backtrace" => GetStackTrace(),
|
"backtrace" => GetStackTrace(),
|
||||||
"bt" => GetStackTrace(),
|
"bt" => GetStackTrace(),
|
||||||
@@ -1192,11 +1198,11 @@ namespace Ryujinx.HLE.Debugger
|
|||||||
|
|
||||||
// If the user connects before the application is running, wait for the application to start.
|
// If the user connects before the application is running, wait for the application to start.
|
||||||
int retries = 10;
|
int retries = 10;
|
||||||
while (DebugProcess == null && retries-- > 0)
|
while ((DebugProcess == null || GetThreads().Length == 0) && retries-- > 0)
|
||||||
{
|
{
|
||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
}
|
}
|
||||||
if (DebugProcess == null)
|
if (DebugProcess == null || GetThreads().Length == 0)
|
||||||
{
|
{
|
||||||
Logger.Warning?.Print(LogClass.GdbStub, "Application is not running, cannot accept GDB client connection");
|
Logger.Warning?.Print(LogClass.GdbStub, "Application is not running, cannot accept GDB client connection");
|
||||||
ClientSocket.Close();
|
ClientSocket.Close();
|
||||||
|
|||||||
Reference in New Issue
Block a user