mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2025-01-08 21:47:57 +00:00
kern: update kdebug process management semantics
This commit is contained in:
parent
cbdf33260e
commit
ee91063bbb
1 changed files with 12 additions and 3 deletions
|
@ -355,6 +355,15 @@ namespace ams::kern {
|
||||||
} else if (state == KProcess::State_DebugBreak) {
|
} else if (state == KProcess::State_DebugBreak) {
|
||||||
/* If the process is debug breaked, transition it accordingly. */
|
/* If the process is debug breaked, transition it accordingly. */
|
||||||
new_state = KProcess::State_Crashed;
|
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 {
|
} else {
|
||||||
/* Otherwise, don't transition. */
|
/* Otherwise, don't transition. */
|
||||||
new_state = state;
|
new_state = state;
|
||||||
|
@ -840,9 +849,6 @@ namespace ams::kern {
|
||||||
|
|
||||||
/* If the process isn't null, detach. */
|
/* If the process isn't null, detach. */
|
||||||
if (process.IsNotNull()) {
|
if (process.IsNotNull()) {
|
||||||
/* When we're done detaching, clear the reference we opened when we attached. */
|
|
||||||
ON_SCOPE_EXIT { process->Close(); };
|
|
||||||
|
|
||||||
/* Detach. */
|
/* Detach. */
|
||||||
{
|
{
|
||||||
/* Lock both ourselves and the target process. */
|
/* Lock both ourselves and the target process. */
|
||||||
|
@ -877,6 +883,9 @@ namespace ams::kern {
|
||||||
/* Clear our process. */
|
/* Clear our process. */
|
||||||
m_process = nullptr;
|
m_process = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We're done detaching, so clear the reference we opened when we attached. */
|
||||||
|
process->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue