mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-27 11:03:04 +00:00
Bring back the debugger message handler thread
This commit is contained in:
parent
5f5cb73baa
commit
0396997c17
1 changed files with 30 additions and 21 deletions
|
@ -28,6 +28,7 @@ namespace Ryujinx.HLE.Debugger
|
||||||
private NetworkStream WriteStream = null;
|
private NetworkStream WriteStream = null;
|
||||||
private BlockingCollection<IMessage> Messages = new BlockingCollection<IMessage>(1);
|
private BlockingCollection<IMessage> Messages = new BlockingCollection<IMessage>(1);
|
||||||
private Thread DebuggerThread;
|
private Thread DebuggerThread;
|
||||||
|
private Thread MessageHandlerThread;
|
||||||
private bool _shuttingDown = false;
|
private bool _shuttingDown = false;
|
||||||
|
|
||||||
private ulong? cThread;
|
private ulong? cThread;
|
||||||
|
@ -42,6 +43,8 @@ namespace Ryujinx.HLE.Debugger
|
||||||
|
|
||||||
DebuggerThread = new Thread(DebuggerThreadMain);
|
DebuggerThread = new Thread(DebuggerThreadMain);
|
||||||
DebuggerThread.Start();
|
DebuggerThread.Start();
|
||||||
|
MessageHandlerThread = new Thread(MessageHandlerMain);
|
||||||
|
MessageHandlerThread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IDebuggableProcess DebugProcess => Device.System.DebugGetApplicationProcess();
|
private IDebuggableProcess DebugProcess => Device.System.DebugGetApplicationProcess();
|
||||||
|
@ -138,8 +141,11 @@ namespace Ryujinx.HLE.Debugger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleMessage(IMessage msg)
|
private void MessageHandlerMain()
|
||||||
{
|
{
|
||||||
|
while (!_shuttingDown)
|
||||||
|
{
|
||||||
|
IMessage msg = Messages.Take();
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case BreakInMessage:
|
case BreakInMessage:
|
||||||
|
@ -163,6 +169,7 @@ namespace Ryujinx.HLE.Debugger
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ProcessCommand(string cmd)
|
private void ProcessCommand(string cmd)
|
||||||
{
|
{
|
||||||
|
@ -621,7 +628,7 @@ namespace Ryujinx.HLE.Debugger
|
||||||
Logger.Notice.Print(LogClass.GdbStub, "NACK received!");
|
Logger.Notice.Print(LogClass.GdbStub, "NACK received!");
|
||||||
continue;
|
continue;
|
||||||
case '\x03':
|
case '\x03':
|
||||||
HandleMessage(new BreakInMessage());
|
Messages.Add(new BreakInMessage());
|
||||||
break;
|
break;
|
||||||
case '$':
|
case '$':
|
||||||
string cmd = "";
|
string cmd = "";
|
||||||
|
@ -638,11 +645,11 @@ namespace Ryujinx.HLE.Debugger
|
||||||
string checksum = $"{(char)ReadStream.ReadByte()}{(char)ReadStream.ReadByte()}";
|
string checksum = $"{(char)ReadStream.ReadByte()}{(char)ReadStream.ReadByte()}";
|
||||||
if (checksum == $"{CalculateChecksum(cmd):x2}")
|
if (checksum == $"{CalculateChecksum(cmd):x2}")
|
||||||
{
|
{
|
||||||
HandleMessage(new CommandMessage(cmd));
|
Messages.Add(new CommandMessage(cmd));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HandleMessage(new SendNackMessage());
|
Messages.Add(new SendNackMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -725,6 +732,8 @@ namespace Ryujinx.HLE.Debugger
|
||||||
ReadStream?.Close();
|
ReadStream?.Close();
|
||||||
WriteStream?.Close();
|
WriteStream?.Close();
|
||||||
DebuggerThread.Join();
|
DebuggerThread.Join();
|
||||||
|
Messages.Dispose();
|
||||||
|
MessageHandlerThread.Join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue