gdb: More cleanup changes
- 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
This commit is contained in:
parent
6058af5119
commit
247e2e03d6
19 changed files with 319 additions and 328 deletions
58
src/Ryujinx.HLE/Debugger/Debugger.MessageHandler.cs
Normal file
58
src/Ryujinx.HLE/Debugger/Debugger.MessageHandler.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue