Skip to content
Snippets Groups Projects
Commit 5d7417b4 authored by Vadim ProductEngine's avatar Vadim ProductEngine
Browse files

STORM-422 FIXED Added command line option "-disablecrashlogger" to disable crash logger.

This is a patch originally written by Robin Cornelius.
I made it work with Google Breakpad.
parent 37b97d2f
No related branches found
No related tags found
No related merge requests found
......@@ -573,6 +573,7 @@ Robin Cornelius
SNOW-585
SNOW-599
SNOW-747
STORM-422
VWR-2488
VWR-9557
VWR-11128
......
......@@ -90,6 +90,10 @@ S32 LL_HEARTBEAT_SIGNAL = (SIGRTMAX >= 0) ? (SIGRTMAX-0) : SIGUSR2;
// the static application instance
LLApp* LLApp::sApplication = NULL;
// Allows the generation of core files for post mortem under gdb
// and disables crashlogger
BOOL LLApp::sDisableCrashlogger = FALSE;
// Local flag for whether or not to do logging in signal handlers.
//static
BOOL LLApp::sLogInSignal = FALSE;
......@@ -461,11 +465,30 @@ bool LLApp::isQuitting()
return (APP_STATUS_QUITTING == sStatus);
}
// static
bool LLApp::isExiting()
{
return isQuitting() || isError();
}
void LLApp::disableCrashlogger()
{
// Disable Breakpad exception handler.
if (mExceptionHandler != 0)
{
delete mExceptionHandler;
mExceptionHandler = 0;
}
sDisableCrashlogger = TRUE;
}
// static
bool LLApp::isCrashloggerDisabled()
{
return (sDisableCrashlogger == TRUE);
}
#if !LL_WINDOWS
// static
U32 LLApp::getSigChildCount()
......@@ -799,6 +822,15 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *)
{
llwarns << "Signal handler - Flagging error status and waiting for shutdown" << llendl;
}
if (LLApp::isCrashloggerDisabled()) // Don't gracefully handle any signal, crash and core for a gdb post mortem
{
clear_signals();
llwarns << "Fatal signal received, not handling the crash here, passing back to operating system" << llendl;
raise(signum);
return;
}
// Flag status to ERROR, so thread_error does its work.
LLApp::setError();
// Block in the signal handler until somebody says that we're done.
......
......@@ -189,6 +189,11 @@ class LL_COMMON_API LLApp : public LLOptionInterface
//
virtual bool mainLoop() = 0; // Override for the application main loop. Needs to at least gracefully notice the QUITTING state and exit.
//
// Crash logging
//
void disableCrashlogger(); // Let the OS handle the crashes
static bool isCrashloggerDisabled(); // Get the here above set value
//
// Application status
......@@ -280,6 +285,7 @@ class LL_COMMON_API LLApp : public LLOptionInterface
static void setStatus(EAppStatus status); // Use this to change the application status.
static EAppStatus sStatus; // Reflects current application status
static BOOL sErrorThreadRunning; // Set while the error thread is running
static BOOL sDisableCrashlogger; // Let the OS handle crashes for us.
#if !LL_WINDOWS
static LLAtomicU32* sSigChildCount; // Number of SIGCHLDs received.
......
......@@ -391,5 +391,13 @@
<string>CrashOnStartup</string>
</map>
<key>disablecrashlogger</key>
<map>
<key>desc</key>
<string>Disables the crash logger and lets the OS handle crashes</string>
<key>map-to</key>
<string>DisableCrashLogger</string>
</map>
</map>
</llsd>
......@@ -2020,6 +2020,15 @@ bool LLAppViewer::initConfiguration()
// - apply command line settings
clp.notify();
// Register the core crash option as soon as we can
// if we want gdb post-mortem on cores we need to be up and running
// ASAP or we might miss init issue etc.
if(clp.hasOption("disablecrashlogger"))
{
llwarns << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << llendl;
LLAppViewer::instance()->disableCrashlogger();
}
// Handle initialization from settings.
// Start up the debugging console before handling other options.
if (gSavedSettings.getBOOL("ShowConsoleWindow"))
......@@ -2596,6 +2605,11 @@ void LLAppViewer::handleViewerCrash()
abort();
}
if (LLApp::isCrashloggerDisabled())
{
abort();
}
// Returns whether a dialog was shown.
// Only do the logic in here once
if (pApp->mReportedCrash)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment