- Move the message handler into its debugger class part, - Move all message types into one file and collapse 3 of the ones with no data into a generic, stateless message with a single property being its type, - Add an Fpscr helper property on IExecutionContext along with a comment about what Fpscr is (similar to the other registers in there) - Moved the Rcmd helpers (such as GetRegisters, GetMinidump, etc) into a dedicated Debugger class part, - Fixed the double-collection (ToArray being called twice) in GetThreadUids & GetThread in KProcess
58 lines
2.1 KiB
C#
58 lines
2.1 KiB
C#
using Ryujinx.Common.Logging;
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace Ryujinx.HLE.Debugger
|
|
{
|
|
public partial class Debugger
|
|
{
|
|
private void MessageHandlerMain()
|
|
{
|
|
while (!_shuttingDown)
|
|
{
|
|
try
|
|
{
|
|
switch (_messages.Take())
|
|
{
|
|
case StatelessMessage { Type: MessageType.BreakIn }:
|
|
Logger.Notice.Print(LogClass.GdbStub, "Break-in requested");
|
|
_commands.Interrupt();
|
|
break;
|
|
|
|
case StatelessMessage { Type: MessageType.SendNack }:
|
|
_writeStream.WriteByte((byte)'-');
|
|
break;
|
|
|
|
case StatelessMessage { Type: MessageType.Kill }:
|
|
return;
|
|
|
|
case CommandMessage { Command: { } cmd }:
|
|
Logger.Debug?.Print(LogClass.GdbStub, $"Received Command: {cmd}");
|
|
_writeStream.WriteByte((byte)'+');
|
|
_commandProcessor.Process(cmd);
|
|
break;
|
|
|
|
case ThreadBreakMessage { Context: { } ctx }:
|
|
DebugProcess.DebugStop();
|
|
GThread = CThread = ctx.ThreadUid;
|
|
_breakHandlerEvent.Set();
|
|
_commandProcessor.Reply($"T05thread:{ctx.ThreadUid:x};");
|
|
break;
|
|
}
|
|
}
|
|
catch (IOException e)
|
|
{
|
|
Logger.Error?.Print(LogClass.GdbStub, "Error while processing GDB messages", e);
|
|
}
|
|
catch (NullReferenceException e)
|
|
{
|
|
Logger.Error?.Print(LogClass.GdbStub, "Error while processing GDB messages", e);
|
|
}
|
|
catch (ObjectDisposedException e)
|
|
{
|
|
Logger.Error?.Print(LogClass.GdbStub, "Error while processing GDB messages", e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|