*/ void OS_Crash(const REBYTE *title, const REBYTE *content) /* ** Tell user that REBOL has crashed. This function must use ** the most obvious and reliable method of displaying the ** crash message. ** ** If the title is NULL, then REBOL is running in a server mode. ** In that case, we do not want the crash message to appear on ** the screen, because the system may be unattended. ** ** On some systems, the error may be recorded in the system log. ** ***********************************************************************/ { // Echo crash message if echo file is open: ///PUTE(content); OS_Call_Device(RDI_STDIO, RDC_CLOSE); // close echo // A title tells us we should alert the user: if (title) { // OS_Put_Str(title); // OS_Put_Str(":\n"); // Use ASCII only (in case we are on non-unicode win32): MessageBoxA(NULL, content, title, MB_ICONHAND); } // OS_Put_Str(content); exit(100); }
// // OS_Crash: C // // Tell user that REBOL has crashed. This function must use // the most obvious and reliable method of displaying the // crash message. // // If the title is NULL, then REBOL is running in a server mode. // In that case, we do not want the crash message to appear on // the screen, because the system may be unattended. // // On some systems, the error may be recorded in the system log. // // coverity[+kill] // void OS_Crash(const REBYTE *title, const REBYTE *content) { // Echo crash message if echo file is open: ///PUTE(content); OS_Call_Device(RDI_STDIO, RDC_CLOSE); // close echo // A title tells us we should alert the user: if (title) { fputs(cs_cast(title), stderr); fputs(":\n", stderr); } fputs(cs_cast(content), stderr); fputs("\n\n", stderr); #ifdef HAVE_EXECINFO_AVAILABLE // backtrace is a GNU extension. { void *backtrace_buf[1024]; int n_backtrace = backtrace(backtrace_buf, sizeof(backtrace_buf)/sizeof(backtrace_buf[0])); fputs("Backtrace:\n", stderr); backtrace_symbols_fd(backtrace_buf, n_backtrace, STDERR_FILENO); } #endif exit(EXIT_FAILURE); }
// // OS_Crash: C // // Tell user that REBOL has crashed. This function must use // the most obvious and reliable method of displaying the // crash message. // // If the title is NULL, then REBOL is running in a server mode. // In that case, we do not want the crash message to appear on // the screen, because the system may be unattended. // // On some systems, the error may be recorded in the system log. // void OS_Crash(const REBYTE *title, const REBYTE *content) { // Echo crash message if echo file is open: ///PUTE(content); OS_Call_Device(RDI_STDIO, RDC_CLOSE); // close echo // A title tells us we should alert the user: if (title) { // OS_Put_Str(title); // OS_Put_Str(":\n"); // Use ASCII only MessageBoxA(NULL, cs_cast(content), cs_cast(title), MB_ICONHAND); } // OS_Put_Str(content); exit(100); }
*/ void OS_Crash(const REBYTE *title, const REBYTE *content) /* ** Tell user that REBOL has crashed. This function must use ** the most obvious and reliable method of displaying the ** crash message. ** ** If the title is NULL, then REBOL is running in a server mode. ** In that case, we do not want the crash message to appear on ** the screen, because the system may be unattended. ** ** On some systems, the error may be recorded in the system log. ** ***********************************************************************/ { // Echo crash message if echo file is open: ///PUTE(content); OS_Call_Device(RDI_STDIO, RDC_CLOSE); // close echo // A title tells us we should alert the user: if (title) { fputs(cs_cast(title), stderr); fputs(":\n", stderr); } fputs(cs_cast(content), stderr); fputs("\n\n", stderr); #ifdef HAVE_EXECINFO_AVAILABLE // backtrace is a GNU extension. { void *backtrace_buf[1024]; int n_backtrace = backtrace(backtrace_buf, sizeof(backtrace_buf)/sizeof(backtrace_buf[0])); fputs("Backtrace:\n", stderr); backtrace_symbols_fd(backtrace_buf, n_backtrace, STDERR_FILENO); } #endif exit(EXIT_FAILURE); }