From d58a15c0a603a83a416f84def21d5603653e3cba Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Tue, 3 Mar 2015 13:39:15 +0100 Subject: Windows: Add stacktrace support when unhandled exception occurs. We need to register the exception handler slightly differently here, as well as adding DbgHelp as a library, but according to docs it should be supported in recent Windows editions (Win XP included even). We can try it first and revert if there are issues. --- source/blender/blenlib/intern/system.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'source/blender/blenlib/intern/system.c') diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c index d83077e0e78..b6b0f14a4e2 100644 --- a/source/blender/blenlib/intern/system.c +++ b/source/blender/blenlib/intern/system.c @@ -27,10 +27,13 @@ #include "BLI_system.h" +#include "MEM_guardedalloc.h" + /* for backtrace */ #if defined(__linux__) || defined(__APPLE__) # include -#elif defined(_MSV_VER) +#elif defined(WIN32) +# include # include #endif @@ -97,17 +100,18 @@ void BLI_system_backtrace(FILE *fp) #elif defined(_MSC_VER) (void)fp; -#if 0 +#if defined WIN32 #define MAXSYMBOL 256 - unsigned short i; +#define SIZE 100 + unsigned short i; void *stack[SIZE]; unsigned short nframes; - SYMBOL_INFO *symbolinfo; + SYMBOL_INFO *symbolinfo; HANDLE process; process = GetCurrentProcess(); - SymInitialize(process, NULL, true); + SymInitialize(process, NULL, TRUE); nframes = CaptureStackBackTrace(0, SIZE, stack, NULL); symbolinfo = MEM_callocN(sizeof(SYMBOL_INFO) + MAXSYMBOL * sizeof(char), "crash Symbol table"); @@ -122,6 +126,7 @@ void BLI_system_backtrace(FILE *fp) MEM_freeN(symbolinfo); #undef MAXSYMBOL +#undef SIZE #endif /* ------------------ */ -- cgit v1.2.3