diff --git a/src/coreclr/debug/ee/controller.cpp b/src/coreclr/debug/ee/controller.cpp index 46a4f74f85cf2..f1fc3c00f4e63 100644 --- a/src/coreclr/debug/ee/controller.cpp +++ b/src/coreclr/debug/ee/controller.cpp @@ -3232,7 +3232,7 @@ void DebuggerController::UnapplyTraceFlag(Thread *thread) // so there should be nothing to do. However, we still assert b/c we want to know how // we'd actually hit this. // @todo - is there a path if TriggerUnwind() calls DisableAll(). But why would - CONSISTENCY_CHECK_MSGF(false, ("How did we get here?. thread=%p\n", thread)); + //CONSISTENCY_CHECK_MSGF(false, ("How did we get here?. thread=%p\n", thread)); it can be caused in a scenario where we are stepping and an AV is thrown LOG((LF_CORDB,LL_INFO1000, "DC::UnapplyTraceFlag couldn't get context.\n")); return; } diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp index e23852a53775b..303c5c6d83ced 100644 --- a/src/coreclr/vm/exceptionhandling.cpp +++ b/src/coreclr/vm/exceptionhandling.cpp @@ -5426,6 +5426,17 @@ BOOL IsSafeToCallExecutionManager() BOOL IsSafeToHandleHardwareException(PCONTEXT contextRecord, PEXCEPTION_RECORD exceptionRecord) { +#ifdef FEATURE_EMULATE_SINGLESTEP + Thread *pThread = GetThreadNULLOk(); + if (pThread && pThread->IsSingleStepEnabled() && + exceptionRecord->ExceptionCode != STATUS_BREAKPOINT && + exceptionRecord->ExceptionCode != STATUS_SINGLE_STEP && + exceptionRecord->ExceptionCode != STATUS_STACK_OVERFLOW) + { + pThread->HandleSingleStep(contextRecord, exceptionRecord->ExceptionCode); + } +#endif + PCODE controlPc = GetIP(contextRecord); if (IsIPInWriteBarrierCodeCopy(controlPc))