Browse files

Enable Crashing On Crashes

  • Loading branch information...
Lirusaito committed Jun 14, 2016
1 parent 8c86c1c commit bc93f2792dc03559c4935588987c104e4f525920
Showing with 29 additions and 4 deletions.
  1. +29 −4 indra/llcommon/llapp.cpp
@@ -311,18 +311,43 @@ LLSD LLApp::getOptionData(OptionPriority level)
return mOptions[level];
//The following code is needed for 32-bit apps on 64-bit windows to keep it from eating
//crashes. It is a lovely undocumented 'feature' in SP1 of Windows 7. An excellent
//in-depth article on the issue may be found here:
void EnableCrashingOnCrashes()
typedef BOOL (WINAPI *tGetPolicy)(LPDWORD lpFlags);
typedef BOOL (WINAPI *tSetPolicy)(DWORD dwFlags);
HMODULE kernel32 = LoadLibraryA("kernel32.dll");
tGetPolicy pGetPolicy = (tGetPolicy)GetProcAddress(kernel32,
tSetPolicy pSetPolicy = (tSetPolicy)GetProcAddress(kernel32,
if (pGetPolicy && pSetPolicy)
DWORD dwFlags;
if (pGetPolicy(&dwFlags))
// Turn off the filter
pSetPolicy(dwFlags & ~EXCEPTION_SWALLOWING);
void LLApp::setupErrorHandling()
// Error handling is done by starting up an error handling thread, which just sleeps and
// occasionally checks to see if the app is in an error state, and sees if it needs to be run.
// Windows doesn't have the same signal handling mechanisms as UNIX, thus APR doesn't provide
// a signal handling thread implementation.
// What we do is install an unhandled exception handler, which will try to do the right thing
// in the case of an error (generate a minidump)
// This sets a callback to handle w32 signals to the console window.
// The viewer shouldn't be affected, sicne its a windowed app.
SetConsoleCtrlHandler( (PHANDLER_ROUTINE) ConsoleCtrlHandler, TRUE);

0 comments on commit bc93f27

Please sign in to comment.