9#ifndef WITH_PYTHON_MODULE
11# if defined(__linux__) && defined(__GNUC__)
18# if (defined(__APPLE__) && (defined(__i386__) || defined(__x86_64__)))
20# include <xmmintrin.h>
40# 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");
86 fputs(
"\n# backtrace\n", fp);
111 printf(
"Writing: %s\n", filepath);
130 "Unable to save '%s': %s\n",
132 errno ? strerror(errno) :
"Unknown error opening file");
153 signal(signum, SIG_DFL);
155 kill(getpid(), signum);
157 TerminateProcess(GetCurrentProcess(), signum);
162extern LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo)
166 if (ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) {
168 CHAR modulename[MAX_PATH];
169 LPVOID address = ExceptionInfo->ExceptionRecord->ExceptionAddress;
170 fprintf(stderr,
"Error : EXCEPTION_STACK_OVERFLOW\n");
171 fprintf(stderr,
"Address : 0x%p\n", address);
172 if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, LPCSTR(address), &
mod)) {
173 if (GetModuleFileName(
mod, modulename, MAX_PATH)) {
174 fprintf(stderr,
"Module : %s\n", modulename);
183 return EXCEPTION_EXECUTE_HANDLER;
197 SetUnhandledExceptionFilter(windows_exception_handler);
206 SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOGPFAULTERRORBOX |
207 SEM_NOOPENFILEERRORBOX);
227# if defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE)
230 signal(SIGFPE, sig_handle_fpe);
232# if defined(__linux__) && defined(__GNUC__) && defined(HAVE_FEENABLEEXCEPT)
233 feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
235# if defined(OSX_SSE_FPE)
238 _MM_SET_EXCEPTION_MASK(_MM_MASK_MASK &
239 ~(_MM_MASK_OVERFLOW | _MM_MASK_INVALID | _MM_MASK_DIV_ZERO));
241# if defined(_WIN32) && defined(_MSC_VER)
243 _controlfp_s(
nullptr, 0, _MCW_EM);
245 _controlfp_s(
nullptr, _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM);
const char * BKE_tempdir_base() ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
void BKE_tempdir_session_purge()
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()
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool BLI_path_extension_replace(char *path, size_t path_maxncpy, const char *ext) ATTR_NONNULL(1
#define BLI_path_join(...)
#define SNPRINTF(dst, format,...)
void BLI_system_backtrace(FILE *fp)
Compatibility-like things for windows.
void BPY_python_backtrace(FILE *fp)
ApplicationState app_state
#define BLEND_VERSION_ARG
#define BLEND_VERSION_FMT
static void sig_handle_abort(int)
void main_signal_setup_background()
void main_signal_setup_fpe()
static void sig_handle_crash(int signum)
static void sig_handle_blender_esc(int sig)
static void sig_handle_crash_backtrace(FILE *fp)
struct ApplicationState::@1407 signal
WindowManagerRuntimeHandle * runtime
void BLI_windows_handle_exception(EXCEPTION_POINTERS *exception)
ccl_device_inline int mod(int x, int m)