MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / death_handler

Method death_handler

src/core/impl/utils/debug.cpp:105–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103// FIXME: imp SigHandlerInit backtrace for windows
104class SigHandlerInit {
105 static void death_handler(int signum) {
106 char msg0[] =
107 "megbrain is about to die abruptly; you can set "
108 "MGB_WAIT_TERMINATE and rerun to wait for gdb attach";
109 if (MGB_GETENV("MGB_WAIT_TERMINATE")) {
110 fprintf(stderr,
111 "megbrain is about to die abruptly; you can gdb "
112 "me at %d; wait for pressing enter\n",
113 static_cast<int>(getpid()));
114 getchar();
115 }
116 if (signum == -1) {
117 mgb_log_error("%s: std::terminate() called", msg0);
118 } else {
119 mgb_log_error(
120 "%s: caught deadly signal %d(%s)", msg0, signum, strsignal(signum));
121 }
122 std::string bp;
123 debug::backtrace(2).fmt_to_str(bp);
124 mgb_log_error("%s", bp.c_str());
125 exit(EXIT_FAILURE);
126 }
127
128public:
129 static void init_for_segv() {

Callers

nothing calls this directly

Calls 1

fmt_to_strMethod · 0.80

Tested by

no test coverage detected