1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-26 13:52:21 +00:00

kern: update kdebug process management semantics

This commit is contained in:
Michael Scire 2021-04-07 14:53:12 -07:00 committed by SciresM
parent cbdf33260e
commit ee91063bbb

View file

@ -355,6 +355,15 @@ namespace ams::kern {
} else if (state == KProcess::State_DebugBreak) {
/* If the process is debug breaked, transition it accordingly. */
new_state = KProcess::State_Crashed;
/* Suspend all the threads in the process. */
{
auto end = target->GetThreadList().end();
for (auto it = target->GetThreadList().begin(); it != end; ++it) {
/* Request that we suspend the thread. */
it->RequestSuspend(KThread::SuspendType_Debug);
}
}
} else {
/* Otherwise, don't transition. */
new_state = state;
@ -840,9 +849,6 @@ namespace ams::kern {
/* If the process isn't null, detach. */
if (process.IsNotNull()) {
/* When we're done detaching, clear the reference we opened when we attached. */
ON_SCOPE_EXIT { process->Close(); };
/* Detach. */
{
/* Lock both ourselves and the target process. */
@ -877,6 +883,9 @@ namespace ams::kern {
/* Clear our process. */
m_process = nullptr;
}
/* We're done detaching, so clear the reference we opened when we attached. */
process->Close();
}
}
}