Notify debugger on BRK instruction
# Conflicts: # src/Ryujinx.HLE/Debugger/Debugger.cs # src/Ryujinx.HLE/Debugger/Message/ThreadBreakMessage.cs # src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs
This commit is contained in:
parent
9b9137bf0a
commit
09a63ba2b5
4 changed files with 44 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Memory;
|
||||
using System;
|
||||
|
@ -8,6 +8,7 @@ using System.Net;
|
|||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using IExecutionContext = Ryujinx.Cpu.IExecutionContext;
|
||||
|
||||
namespace Ryujinx.HLE.Debugger
|
||||
{
|
||||
|
@ -134,6 +135,11 @@ namespace Ryujinx.HLE.Debugger
|
|||
WriteStream.WriteByte((byte)'+');
|
||||
ProcessCommand(cmd);
|
||||
break;
|
||||
|
||||
case ThreadBreakMessage msg:
|
||||
HaltApplication();
|
||||
Reply($"T05thread:{msg.Context.ThreadUid:x};");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -641,5 +647,14 @@ namespace Ryujinx.HLE.Debugger
|
|||
HandlerThread.Join();
|
||||
}
|
||||
}
|
||||
|
||||
public void ThreadBreak(IExecutionContext ctx, ulong address, int imm)
|
||||
{
|
||||
ctx.DebugStop();
|
||||
|
||||
Logger.Notice.Print(LogClass.GdbStub, $"Break hit on thread {ctx.ThreadUid} at pc {address:x016}");
|
||||
|
||||
Messages.Add(new ThreadBreakMessage(ctx, address, imm));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
18
src/Ryujinx.HLE/Debugger/Message/ThreadBreakMessage.cs
Normal file
18
src/Ryujinx.HLE/Debugger/Message/ThreadBreakMessage.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using IExecutionContext = Ryujinx.Cpu.IExecutionContext;
|
||||
|
||||
namespace Ryujinx.HLE.Debugger
|
||||
{
|
||||
public class ThreadBreakMessage : IMessage
|
||||
{
|
||||
public IExecutionContext Context { get; }
|
||||
public ulong Address { get; }
|
||||
public int Opcode { get; }
|
||||
|
||||
public ThreadBreakMessage(IExecutionContext context, ulong address, int opcode)
|
||||
{
|
||||
Context = context;
|
||||
Address = address;
|
||||
Opcode = opcode;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -964,4 +964,4 @@ namespace Ryujinx.HLE.FileSystem
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -730,9 +730,16 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
|
||||
public IExecutionContext CreateExecutionContext()
|
||||
{
|
||||
ExceptionCallback breakCallback = null;
|
||||
|
||||
if (KernelContext.Device.Configuration.EnableGdbStub)
|
||||
{
|
||||
breakCallback = KernelContext.Device.Debugger.ThreadBreak;
|
||||
}
|
||||
|
||||
return Context?.CreateExecutionContext(new ExceptionCallbacks(
|
||||
InterruptHandler,
|
||||
null,
|
||||
breakCallback,
|
||||
KernelContext.SyscallHandler.SvcCall,
|
||||
UndefinedInstructionHandler));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue