diff --git a/src/ARMeilleure/Instructions/NativeInterface.cs b/src/ARMeilleure/Instructions/NativeInterface.cs index f69cc1e0a..982d6915f 100644 --- a/src/ARMeilleure/Instructions/NativeInterface.cs +++ b/src/ARMeilleure/Instructions/NativeInterface.cs @@ -176,7 +176,8 @@ namespace ARMeilleure.Instructions Statistics.PauseTimer(); ExecutionContext context = GetContext(); - + + // If debugging, we'll handle interrupts outside if (Optimizations.EnableDebugging && context.Interrupted) { return false; diff --git a/src/ARMeilleure/State/ExecutionContext.cs b/src/ARMeilleure/State/ExecutionContext.cs index a414dd3f4..2df13e286 100644 --- a/src/ARMeilleure/State/ExecutionContext.cs +++ b/src/ARMeilleure/State/ExecutionContext.cs @@ -102,10 +102,8 @@ namespace ARMeilleure.State private readonly ExceptionCallback _undefinedCallback; internal int ShouldStep; - internal int DebugStopped; - - public ulong DebugPc; // This is only valid while debugging is enabled. - public Barrier StepBarrier = new Barrier(2); + public ulong DebugPc { get; set; } + public Barrier StepBarrier { get; } public ExecutionContext( IJitMemoryAllocator allocator, @@ -123,6 +121,7 @@ namespace ARMeilleure.State _undefinedCallback = undefinedCallback; Running = true; + StepBarrier = new Barrier(2); _nativeContext.SetCounter(MinCountForCheck); } diff --git a/src/Ryujinx.Cpu/IExecutionContext.cs b/src/Ryujinx.Cpu/IExecutionContext.cs index 40438d6fc..ec9ef6a42 100644 --- a/src/Ryujinx.Cpu/IExecutionContext.cs +++ b/src/Ryujinx.Cpu/IExecutionContext.cs @@ -115,10 +115,31 @@ namespace Ryujinx.Cpu /// void StopRunning(); - // TODO: comments + /// + /// Requests the thread to stop running temporarily and call . + /// + /// + /// The thread might not pause immediately. + /// One must not assume that guest code is no longer being executed by the thread after calling this function. + /// After single stepping, the thread should signal and wait on twice to allow + /// changing the thread state after stepping. + /// void RequestDebugStep(); - ulong DebugPc { get; set; } + /// + /// Step barrier + /// + /// + /// Should be signaled and waited on twice after single-stepping. + /// Barrier StepBarrier { get; } + + /// + /// Current Program Counter (for debugging). + /// + /// + /// PC register for the debugger. Must not be accessed while the thread isn't stopped for debugging. + /// + ulong DebugPc { get; set; } } }