| 73 | |
| 74 | |
| 75 | static void CriticalErrorHandler(String inErr, bool allowFixup) |
| 76 | { |
| 77 | #ifdef HXCPP_DEBUGGER |
| 78 | if (allowFixup && __hxcpp_dbg_fix_critical_error(inErr)) |
| 79 | return; |
| 80 | #endif |
| 81 | |
| 82 | #ifdef HXCPP_STACK_TRACE |
| 83 | hx::StackContext *ctx = hx::StackContext::getCurrent(); |
| 84 | ctx->beginCatch(true); |
| 85 | #endif |
| 86 | |
| 87 | if (sCriticalErrorHandler!=null()) |
| 88 | sCriticalErrorHandler(inErr); |
| 89 | |
| 90 | #ifdef HXCPP_STACK_TRACE |
| 91 | ctx->dumpExceptionStack(); |
| 92 | #endif |
| 93 | |
| 94 | DBGLOG("Critical Error: %s\n", inErr.utf8_str()); |
| 95 | |
| 96 | #if defined(HX_WINDOWS) && !defined(HX_WINRT) |
| 97 | MessageBoxA(0, inErr.utf8_str(), "Critical Error - program must terminate", |
| 98 | MB_ICONEXCLAMATION|MB_OK); |
| 99 | #endif |
| 100 | |
| 101 | // Good when using gdb, and to collect a core ... |
| 102 | #if __has_builtin(__builtin_trap) |
| 103 | __builtin_trap(); |
| 104 | #else |
| 105 | (* (int *) 0) = 0; |
| 106 | #endif |
| 107 | |
| 108 | // Just in case that didn't do it ... |
| 109 | exit(1); |
| 110 | } |
| 111 | |
| 112 | void CriticalError(const String &inErr, bool inAllowFixup) |
| 113 | { |
no test coverage detected