diff --git a/src/coreclr/vm/debugdebugger.cpp b/src/coreclr/vm/debugdebugger.cpp index bb5bed368de9fe..6077de0d813118 100644 --- a/src/coreclr/vm/debugdebugger.cpp +++ b/src/coreclr/vm/debugdebugger.cpp @@ -1152,9 +1152,18 @@ void DebugStackTrace::GetStackFramesFromException(OBJECTREF * e, // to spot. DWORD dwNativeOffset; - if (cur.ip) + UINT_PTR ip = cur.ip; +#if defined(DACCESS_COMPILE) && defined(TARGET_AMD64) + // Compensate for a bug in the old EH that for a frame that faulted + // has the ip pointing to an address before the faulting instruction + if (g_isNewExceptionHandlingEnabled && (i == 0) && ((cur.flags & STEF_IP_ADJUSTED) == 0)) { - EECodeInfo codeInfo(cur.ip); + ip -= 1; + } +#endif // DACCESS_COMPILE && TARGET_AMD64 + if (ip) + { + EECodeInfo codeInfo(ip); dwNativeOffset = codeInfo.GetRelOffset(); } else @@ -1165,7 +1174,7 @@ void DebugStackTrace::GetStackFramesFromException(OBJECTREF * e, pData->pElements[i].InitPass1( dwNativeOffset, pMD, - (PCODE)cur.ip, + (PCODE)ip, cur.flags); #ifndef DACCESS_COMPILE pData->pElements[i].InitPass2(); diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp index 4cf5bb3ad4b018..937fe61f4e1342 100644 --- a/src/coreclr/vm/exceptionhandling.cpp +++ b/src/coreclr/vm/exceptionhandling.cpp @@ -7578,15 +7578,8 @@ extern "C" void QCALLTYPE AppendExceptionStackFrame(QCall::ObjectHandleOnStack e _ASSERTE(pMD == codeInfo.GetMethodDesc()); #endif // _DEBUG - // Compensate for a bug in the old EH that doesn't mark faulting instructions as faulting. The VS expects that behavior. - bool hasFaulted = pExInfo->m_frameIter.m_crawl.HasFaulted(); - if (hasFaulted) - { - pExInfo->m_frameIter.m_crawl.hasFaulted = false; - } pExInfo->m_StackTraceInfo.AppendElement(canAllocateMemory, ip, sp, pMD, &pExInfo->m_frameIter.m_crawl); pExInfo->m_StackTraceInfo.SaveStackTrace(canAllocateMemory, pExInfo->m_hThrowable, /*bReplaceStack*/FALSE, /*bSkipLastElement*/FALSE); - pExInfo->m_frameIter.m_crawl.hasFaulted = hasFaulted; } // Notify the debugger that we are on the first pass for a managed exception.