Commit 3ace88ec authored by Geoffroy Couprie's avatar Geoffroy Couprie

Win32: generate crashdumps everytime except if a debugger is present

parent 7986cb4a
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <windows.h> #include <windows.h>
#if !defined(UNDER_CE) && defined ( NDEBUG ) #if !defined(UNDER_CE)
# define _WIN32_IE 0x500 # define _WIN32_IE 0x500
# include <shlobj.h> # include <shlobj.h>
# include <tlhelp32.h> # include <tlhelp32.h>
...@@ -137,7 +137,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, ...@@ -137,7 +137,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
libvlc_exception_init (&ex); libvlc_exception_init (&ex);
libvlc_exception_init (&dummy); libvlc_exception_init (&dummy);
#if !defined( UNDER_CE ) && defined ( NDEBUG ) #if !defined( UNDER_CE )
check_crashdump(); check_crashdump();
SetUnhandledExceptionFilter(vlc_exception_filter); SetUnhandledExceptionFilter(vlc_exception_filter);
#endif #endif
...@@ -164,7 +164,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, ...@@ -164,7 +164,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
return ret; return ret;
} }
#if !defined( UNDER_CE ) && defined ( NDEBUG ) #if !defined( UNDER_CE )
static void get_crashdump_path(wchar_t * wdir) static void get_crashdump_path(wchar_t * wdir)
{ {
...@@ -223,6 +223,13 @@ static void check_crashdump() ...@@ -223,6 +223,13 @@ static void check_crashdump()
*****************************************************************************/ *****************************************************************************/
LONG WINAPI vlc_exception_filter(struct _EXCEPTION_POINTERS *lpExceptionInfo) LONG WINAPI vlc_exception_filter(struct _EXCEPTION_POINTERS *lpExceptionInfo)
{ {
if(IsDebuggerPresent())
{
//If a debugger is present, pass the exception to the debugger with EXCEPTION_CONTINUE_SEARCH
return EXCEPTION_CONTINUE_SEARCH;
}
else
{
fprintf( stderr, "unhandled vlc exception\n" ); fprintf( stderr, "unhandled vlc exception\n" );
wchar_t * wdir = (wchar_t *)malloc(sizeof(wchar_t)*MAX_PATH); wchar_t * wdir = (wchar_t *)malloc(sizeof(wchar_t)*MAX_PATH);
...@@ -292,5 +299,6 @@ LONG WINAPI vlc_exception_filter(struct _EXCEPTION_POINTERS *lpExceptionInfo) ...@@ -292,5 +299,6 @@ LONG WINAPI vlc_exception_filter(struct _EXCEPTION_POINTERS *lpExceptionInfo)
fclose( fd ); fclose( fd );
fflush( stderr ); fflush( stderr );
exit( 1 ); exit( 1 );
}
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment