9#ifndef WITH_PYTHON_MODULE
14# if defined(__linux__) && defined(__GNUC__)
21# if (defined(__APPLE__) && (defined(__i386__) || defined(__x86_64__)))
23# include <xmmintrin.h>
39# include BLI_SYSTEM_PID_H
57# if defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE)
61static void sig_handle_fpe(
int )
63 fprintf(stderr,
"debug: SIGFPE trapped\n");
76 printf(
"\nBlender killed\n");
79 printf(
"\nSent an internal break event. Press ^C again to kill Blender\n");
94 printf(
"Writing: %s\n", filepath);
113 "Unable to save '%s': %s\n",
115 errno ? strerror(errno) :
"Unknown error opening file");
122 fputs(
"\n# backtrace\n", fp);
140 signal(signum, SIG_DFL);
142 kill(getpid(), signum);
144 TerminateProcess(GetCurrentProcess(), signum);
157extern LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo)
161 if (ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) {
163 CHAR modulename[MAX_PATH];
164 LPVOID address = ExceptionInfo->ExceptionRecord->ExceptionAddress;
165 fprintf(stderr,
"Error : EXCEPTION_STACK_OVERFLOW\n");
166 fprintf(stderr,
"Address : 0x%p\n", address);
167 if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, LPCSTR(address), &
mod)) {
168 if (GetModuleFileName(
mod, modulename, MAX_PATH)) {
169 fprintf(stderr,
"Module : %s\n", modulename);
197 return EXCEPTION_EXECUTE_HANDLER;
209 if (
app_state.signal.use_crash_handler) {
211 SetUnhandledExceptionFilter(windows_exception_handler);
220 SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOGPFAULTERRORBOX |
221 SEM_NOOPENFILEERRORBOX);
224 if (
app_state.signal.use_abort_handler) {
241# if defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE)
244 signal(SIGFPE, sig_handle_fpe);
246# if defined(__linux__) && defined(__GNUC__) && defined(HAVE_FEENABLEEXCEPT)
247 feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
249# if defined(OSX_SSE_FPE)
252 _MM_SET_EXCEPTION_MASK(_MM_MASK_MASK &
253 ~(_MM_MASK_OVERFLOW | _MM_MASK_INVALID | _MM_MASK_DIV_ZERO));
255# if defined(_WIN32) && defined(_MSC_VER)
257 _controlfp_s(
nullptr, 0, _MCW_EM);
259 _controlfp_s(
nullptr, _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM);
void BKE_tempdir_session_purge()
void BKE_blender_globals_crash_path_get(char *filepath)
const char * BKE_blender_version_string(void)
bool BKE_report_write_file_fp(FILE *fp, ReportList *reports, const char *header)
File and directory operations.
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
#define SNPRINTF(dst, format,...)
void BLI_system_backtrace_with_os_info(FILE *fp, const void *os_info)
Compatibility-like things for windows.
void BPY_python_backtrace(FILE *fp)
ApplicationState app_state
#define BLEND_VERSION_ARG
#define BLEND_VERSION_FMT
static void crashlog_file_generate(const char *filepath, const void *os_info)
static void sig_handle_abort(int)
void main_signal_setup_background()
static void sig_cleanup_and_terminate(int signum)
void main_signal_setup_fpe()
static void sig_handle_crash_fn(int signum)
static void sig_handle_blender_esc(int sig)
VecBase< float, D > constexpr mod(VecOp< float, D >, VecOp< float, D >) RET
WindowManagerRuntimeHandle * runtime
void BLI_windows_exception_print_message(const void *os_info)
void BLI_windows_exception_show_dialog(const char *filepath_crashlog, const char *filepath_relaunch, const char *gpu_name, const char *build_version)