Mercurial > hg > openttd
changeset 13915:5a588b3068cf draft
(svn r18446) -Fix (r17450): abort() doesn't trigger crashlog on windows
author | glx <glx@openttd.org> |
---|---|
date | Wed, 09 Dec 2009 15:24:13 +0000 |
parents | f48ae1a0d976 |
children | 32bb7763b24a |
files | src/os/windows/crashlog_win.cpp |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -20,6 +20,7 @@ #include "../../gamelog.h" #include <windows.h> +#include <signal.h> /** * Windows implementation for the crash logger. @@ -407,6 +408,11 @@ extern "C" void *_get_safe_esp(); #endif +static void CDECL CustomAbort(int signal) +{ + RaiseException(0xE1212012, 0, 0, NULL); +} + /* static */ void CrashLog::InitialiseCrashLog() { #if defined(_MSC_VER) @@ -421,6 +427,12 @@ asm("movl %esp, __safe_esp"); #endif + /* SIGABRT is not an unhandled exception, so we need to intercept it. */ + signal(SIGABRT, CustomAbort); +#if defined(_MSC_VER) + /* Don't show abort message as we will get the crashlog window anyway. */ + _set_abort_behavior(0, _WRITE_ABORT_MSG); +#endif SetUnhandledExceptionFilter(ExceptionHandler); }