MCPcopy Create free account
hub / github.com/apple/foundationdb / registerCrashHandler

Function registerCrashHandler

flow/Platform.actor.cpp:3641–3666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3639}
3640
3641void registerCrashHandler() {
3642#ifdef __linux__
3643 // For these otherwise fatal errors, attempt to log a trace of
3644 // what was happening and then exit
3645 struct sigaction action;
3646 action.sa_handler = crashHandler;
3647 sigfillset(&action.sa_mask);
3648 action.sa_flags = 0;
3649
3650 sigaction(SIGILL, &action, nullptr);
3651 sigaction(SIGFPE, &action, nullptr);
3652 sigaction(SIGSEGV, &action, nullptr);
3653 sigaction(SIGBUS, &action, nullptr);
3654 sigaction(SIGUSR2, &action, nullptr);
3655#ifdef USE_GCOV
3656 // SIGTERM is the "graceful" way to end an fdbserver process, so we actually
3657 // don't want to invoke crashHandler. crashHandler is not actually
3658 // async-signal-safe, so we can only justify calling it if we were going to
3659 // crash anyway. For USE_GCOV though we need to flush coverage info, which
3660 // we do through crashHandler.
3661 sigaction(SIGTERM, &action, nullptr);
3662#endif
3663#else
3664 // No crash handler for other platforms!
3665#endif
3666}
3667
3668#ifdef __linux__
3669extern volatile void** net2backtraces;

Callers 4

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 1

sigactionClass · 0.70

Tested by 1

mainFunction · 0.68