kern: optimize hw-single-step management

This commit is contained in:
Michael Scire 2021-07-27 14:05:32 -07:00 committed by SciresM
parent 05ea0c53d7
commit 9e7b56b33c
7 changed files with 102 additions and 125 deletions

View file

@ -372,6 +372,7 @@ namespace ams::kern {
new_state = state;
}
#if defined(MESOSPHERE_ENABLE_HARDWARE_SINGLE_STEP)
/* Clear single step on all threads. */
{
auto end = target->GetThreadList().end();
@ -379,6 +380,7 @@ namespace ams::kern {
it->ClearSingleStep();
}
}
#endif
/* Detach from the process. */
target->ClearDebugObject(new_state);
@ -900,8 +902,10 @@ namespace ams::kern {
{
auto end = process->GetThreadList().end();
for (auto it = process->GetThreadList().begin(); it != end; ++it) {
#if defined(MESOSPHERE_ENABLE_HARDWARE_SINGLE_STEP)
/* Clear the thread's single-step state. */
it->ClearSingleStep();
#endif
if (resume) {
/* If the process isn't crashed, resume threads. */
@ -993,7 +997,6 @@ namespace ams::kern {
/* If the event is an exception, set the result and clear single step. */
if (event == ams::svc::DebugEvent_Exception) {
GetCurrentThread().SetDebugExceptionResult(ResultSuccess());
GetCurrentThread().ClearSingleStep();
}
/* Exit our retry loop. */