Improve debugger interface code
This commit is contained in:
parent
e401097e1e
commit
cc32ac251b
1 changed files with 18 additions and 11 deletions
|
@ -1196,6 +1196,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
public DebuggerInterface(KProcess p)
|
public DebuggerInterface(KProcess p)
|
||||||
{
|
{
|
||||||
_parent = p;
|
_parent = p;
|
||||||
|
KernelContext = p.KernelContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DebugStop()
|
public void DebugStop()
|
||||||
|
@ -1206,7 +1207,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_parent.KernelContext.CriticalSection.Enter();
|
KernelContext.CriticalSection.Enter();
|
||||||
lock (_parent._threadingLock)
|
lock (_parent._threadingLock)
|
||||||
{
|
{
|
||||||
foreach (KThread thread in _parent._threads)
|
foreach (KThread thread in _parent._threads)
|
||||||
|
@ -1217,8 +1218,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_debugState = (int)DebugState.Stopped;
|
_debugState = (int)DebugState.Stopped;
|
||||||
_parent.KernelContext.CriticalSection.Leave();
|
KernelContext.CriticalSection.Leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DebugContinue()
|
public void DebugContinue()
|
||||||
|
@ -1229,7 +1230,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_parent.KernelContext.CriticalSection.Enter();
|
KernelContext.CriticalSection.Enter();
|
||||||
lock (_parent._threadingLock)
|
lock (_parent._threadingLock)
|
||||||
{
|
{
|
||||||
foreach (KThread thread in _parent._threads)
|
foreach (KThread thread in _parent._threads)
|
||||||
|
@ -1237,7 +1238,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
thread.Resume(ThreadSchedState.ThreadPauseFlag);
|
thread.Resume(ThreadSchedState.ThreadPauseFlag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_parent.KernelContext.CriticalSection.Leave();
|
KernelContext.CriticalSection.Leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DebugStep(KThread target)
|
public bool DebugStep(KThread target)
|
||||||
|
@ -1246,10 +1247,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_parent.KernelContext.CriticalSection.Enter();
|
KernelContext.CriticalSection.Enter();
|
||||||
bool waiting = target.MutexOwner != null || target.WaitingSync || target.WaitingInArbitration;
|
bool waiting = target.MutexOwner != null || target.WaitingSync || target.WaitingInArbitration;
|
||||||
target.Context.RequestDebugStep();
|
target.Context.RequestDebugStep();
|
||||||
target.Resume(ThreadSchedState.ThreadPauseFlag);
|
|
||||||
if (waiting)
|
if (waiting)
|
||||||
{
|
{
|
||||||
lock (_parent._threadingLock)
|
lock (_parent._threadingLock)
|
||||||
|
@ -1260,13 +1260,16 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_parent.KernelContext.CriticalSection.Leave();
|
else
|
||||||
|
{
|
||||||
|
target.Resume(ThreadSchedState.ThreadPauseFlag);
|
||||||
|
}
|
||||||
|
KernelContext.CriticalSection.Leave();
|
||||||
|
|
||||||
target.Context.StepBarrier.SignalAndWait();
|
target.Context.StepBarrier.SignalAndWait();
|
||||||
target.Context.StepBarrier.SignalAndWait();
|
target.Context.StepBarrier.SignalAndWait();
|
||||||
|
|
||||||
_parent.KernelContext.CriticalSection.Enter();
|
KernelContext.CriticalSection.Enter();
|
||||||
target.Suspend(ThreadSchedState.ThreadPauseFlag);
|
|
||||||
if (waiting)
|
if (waiting)
|
||||||
{
|
{
|
||||||
lock (_parent._threadingLock)
|
lock (_parent._threadingLock)
|
||||||
|
@ -1277,7 +1280,11 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_parent.KernelContext.CriticalSection.Leave();
|
else
|
||||||
|
{
|
||||||
|
target.Suspend(ThreadSchedState.ThreadPauseFlag);
|
||||||
|
}
|
||||||
|
KernelContext.CriticalSection.Leave();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue