Skip to content

Commit

Permalink
Fix new EH hang on DebugBreak (#112640)
Browse files Browse the repository at this point in the history
* Fix new EH hang on DebugBreak

The new exception handling doesn't work well with the DebugBreak in some
cases. E.g. when it is invoked from FATAL_GC_ERROR. The new EH attempts
to handle the STATUS_BREAKPOINT stemming from the DebugBreak, allocate a
managed exception object and hangs since it cannot do that when the GC
is running.

The cause is a missing check for the breakpoint exception in the
ProcessCLRExceptionNew that is present in the old ProcessCLRException.
To fix it, I've copied that code to the ProcessCLRExceptionNew.

Close #112599

* Never process breakpoints via the new EH
  • Loading branch information
janvorli authored Feb 19, 2025
1 parent e75eb9c commit 8192afa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/coreclr/vm/exceptionhandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,14 @@ ProcessCLRExceptionNew(IN PEXCEPTION_RECORD pExceptionRecord,
#ifndef HOST_UNIX
if (!(pExceptionRecord->ExceptionFlags & EXCEPTION_UNWINDING))
{
// If the exception is a breakpoint, let it go. The managed exception handling
// doesn't process breakpoints.
if ((pExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) ||
(pExceptionRecord->ExceptionCode == STATUS_SINGLE_STEP))
{
return ExceptionContinueSearch;
}

// Failfast if exception indicates corrupted process state
if (IsProcessCorruptedStateException(pExceptionRecord->ExceptionCode, /* throwable */ NULL))
{
Expand Down

0 comments on commit 8192afa

Please sign in to comment.