Skip to content

Commit

Permalink
XXX Work around GDB breaking SIGFPE handling
Browse files Browse the repository at this point in the history
For some reason when I have GDB attached, SIGFPE is not processed correctly. Even if I run this in gdb:

handle SIGFPE nostop
handle SIGFPE noprint
  • Loading branch information
AustinWise committed Jul 6, 2024
1 parent e270bbe commit f9f5886
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ public static void RhThrowHwEx(uint exceptionCode, ref ExInfo exInfo)
// We don't wrap SEH exceptions from foreign code like CLR does, so we believe that we
// know the complete set of HW faults generated by managed code and do not need to handle
// this case.
Internal.Console.WriteLine($"Unexpected HwExceptionCode: {exceptionCode}");
FailFastViaClasslib(RhFailFastReason.InternalError, null, faultingCodeAddress);
break;
}
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/pal/src/thread/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,10 @@ DWORD CONTEXTGetExceptionCodeForSignal(const siginfo_t *siginfo,
case SIGFPE:
switch (siginfo->si_code)
{
case 0:
// XXX: is this actually a good idea?
// For some reason we see this when a gdb is attached.
return EXCEPTION_INT_DIVIDE_BY_ZERO;
case FPE_INTDIV:
return EXCEPTION_INT_DIVIDE_BY_ZERO;
case FPE_INTOVF:
Expand Down

0 comments on commit f9f5886

Please sign in to comment.