Skip to content

Commit

Permalink
Early out in VEH for debugger exceptions (dotnet#685)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotas authored Feb 12, 2021
1 parent 782f571 commit ca11852
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/coreclr/nativeaot/Runtime/EHHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,17 @@ int32_t __stdcall RhpHardwareExceptionHandler(uintptr_t faultCode, uintptr_t fau

int32_t __stdcall RhpVectoredExceptionHandler(PEXCEPTION_POINTERS pExPtrs)
{
uintptr_t faultCode = pExPtrs->ExceptionRecord->ExceptionCode;

// Do not interfere with debugger exceptions
if (faultCode == STATUS_BREAKPOINT || faultCode == STATUS_SINGLE_STEP)
{
return EXCEPTION_CONTINUE_SEARCH;
}

uintptr_t faultingIP = pExPtrs->ContextRecord->GetIp();

ICodeManager * pCodeManager = GetRuntimeInstance()->FindCodeManagerByAddress((PTR_VOID)faultingIP);
uintptr_t faultCode = pExPtrs->ExceptionRecord->ExceptionCode;
bool translateToManagedException = false;
if (pCodeManager != NULL)
{
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/nativeaot/Runtime/PalRedhawk.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ typedef enum _EXCEPTION_DISPOSITION {
ExceptionCollidedUnwind
} EXCEPTION_DISPOSITION;

#define STATUS_BREAKPOINT ((uint32_t )0x80000003L)
#define STATUS_SINGLE_STEP ((uint32_t )0x80000004L)
#define STATUS_ACCESS_VIOLATION ((uint32_t )0xC0000005L)
#define STATUS_STACK_OVERFLOW ((uint32_t )0xC00000FDL)
#define STATUS_REDHAWK_NULL_REFERENCE ((uint32_t )0x00000000L)
Expand Down

0 comments on commit ca11852

Please sign in to comment.