SystemStats::setApplicationCrashHandler prevents MacOSX Crash Reporter to work

Adding an unhandled exception callback via SystemStats::setApplicationCrashHandler currently introduces a call to ::kill (getpid(), SIGKILL);. Therefore the application does not “crash” from the OS point of view, preventing the MacOSX Crash Reporter to do its job and generate a crash report.

This seems a little extreme: shouldn’t it be opt-in? I think, yes, calling ::kill (getpid(), SIGKILL); is expected for most use cases, but one may want to try to let the app run after getting an unhandled exception, or let the app crash on its own to get a proper OS crash report.

1 Like

I think you can re-throw the exception from the crash handler to let the macOS handler take over.

1 Like

How do you re-throw the exception without falling into the crash handler again?

I think you have to remove the signal handler for the signal that got thrown with signal(signalType, SIG_DFL); and then throw the signal again.

I can’t remember exactly but there’s probably stack overflows covering this.