Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions src/coreclr/vm/exceptionhandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3651,26 +3651,6 @@ static void NotifyExceptionPassStarted(StackFrameIterator *pThis, Thread *pThrea
pExInfo->m_ExceptionFlags.SetUnwindHasStarted();
EEToDebuggerExceptionInterfaceWrapper::ManagedExceptionUnwindBegin(pThread);
}
else
{
// The debugger explicitly checks that the notification refers to a FuncEvalFrame in case an exception becomes unhandled in a func eval.
// We need to do the notification here before we start propagating the exception through native frames, since that will remove
// all managed frames from the stack and the debugger would not see the failure location.
if (pThis->GetFrameState() == StackFrameIterator::SFITER_FRAME_FUNCTION)
{
Frame* pFrame = pThis->m_crawl.GetFrame();
// If the frame is ProtectValueClassFrame, move to the next one as we want to report the FuncEvalFrame
if (pFrame->GetFrameIdentifier() == FrameIdentifier::ProtectValueClassFrame)
{
pFrame = pFrame->PtrNextFrame();
_ASSERTE(pFrame != FRAME_TOP);
}
if ((pFrame->GetFrameIdentifier() == FrameIdentifier::FuncEvalFrame) || IsTopmostDebuggerU2MCatchHandlerFrame(pFrame))
{
EEToDebuggerExceptionInterfaceWrapper::NotifyOfCHFFilter((EXCEPTION_POINTERS *)&pExInfo->m_ptrs, pFrame);
}
}
}
}
}

Comment on lines 3654 to 3656
Expand Down Expand Up @@ -4035,6 +4015,26 @@ CLR_BOOL SfiNextWorker(StackFrameIterator* pThis, uint* uExCollideClauseIdx, CLR
}
}

// When the exception is propagating to native code during pass 1, notify the debugger if the next
// explicit frame is a FuncEvalFrame or DebuggerU2MCatchHandlerFrame. The debugger needs this notification
// while the managed stack frames are still present so it can inspect the failure location.
Comment on lines +4019 to +4020
#if defined(DEBUGGING_SUPPORTED)
if (pTopExInfo->m_passNumber == 1 && pFrame != FRAME_TOP)
{
Frame* pNotifyFrame = pFrame;
// Skip ProtectValueClassFrame — we want to report the FuncEvalFrame behind it
if (pNotifyFrame->GetFrameIdentifier() == FrameIdentifier::ProtectValueClassFrame)
{
pNotifyFrame = pNotifyFrame->PtrNextFrame();
_ASSERTE(pNotifyFrame != FRAME_TOP);
}
if ((pNotifyFrame->GetFrameIdentifier() == FrameIdentifier::FuncEvalFrame) || IsTopmostDebuggerU2MCatchHandlerFrame(pNotifyFrame))
{
EEToDebuggerExceptionInterfaceWrapper::NotifyOfCHFFilter((EXCEPTION_POINTERS *)&pTopExInfo->m_ptrs, pNotifyFrame);
}
Comment on lines +4028 to +4034
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid feedback?

}
#endif // DEBUGGING_SUPPORTED

*pfIsExceptionIntercepted = FALSE;

if (fUnwoundReversePInvoke)
Expand Down
Loading