summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp59
1 files changed, 52 insertions, 7 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 1fda07edd6..f9ee22d20a 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -719,14 +719,14 @@ LLAppViewer::LLAppViewer()
// from the previous viewer run between this constructor call and the
// init() call, which will overwrite the static_debug_info.log file for
// THIS run. So setDebugFileNames() early.
-#if LL_BUGSPLAT
+# ifdef LL_BUGSPLAT
// MAINT-8917: don't create a dump directory just for the
// static_debug_info.log file
std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
-#else // ! LL_BUGSPLAT
+# else // ! LL_BUGSPLAT
// write Google Breakpad minidump files to a per-run dump directory to avoid multiple viewer issues.
std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "");
-#endif // ! LL_BUGSPLAT
+# endif // ! LL_BUGSPLAT
mDumpPath = logdir;
setMiniDumpDir(logdir);
setDebugFileNames(logdir);
@@ -751,6 +751,16 @@ public:
}
};
+namespace {
+// With Xcode 6, _exit() is too magical to use with boost::bind(), so provide
+// this little helper function.
+void fast_exit(int rc)
+{
+ _exit(rc);
+}
+
+
+}
bool LLAppViewer::init()
{
@@ -790,6 +800,18 @@ bool LLAppViewer::init()
initMaxHeapSize() ;
LLCoros::instance().setStackSize(gSavedSettings.getS32("CoroutineStackSize"));
+ // Although initLoggingAndGetLastDuration() is the right place to mess with
+ // overrideCrashOnError(), we can't query gSavedSettings until after
+ // initConfiguration().
+ S32 rc(gSavedSettings.getS32("QAModeTermCode"));
+ if (rc >= 0)
+ {
+ // QAModeTermCode set, terminate with that rc on LL_ERRS. Use
+ // fast_exit() rather than exit() because normal cleanup depends too
+ // much on successful startup!
+ LLError::overrideCrashOnError(boost::bind(fast_exit, rc));
+ }
+
mAlloc.setProfilingEnabled(gSavedSettings.getBOOL("MemProfiling"));
// Initialize the non-LLCurl libcurl library. Should be called
@@ -2096,9 +2118,6 @@ bool LLAppViewer::cleanup()
return true;
}
- gDebugInfo["FatalMessage"] = error_string;
- LLAppViewer::instance()->writeDebugInfo();
-
bool LLAppViewer::initThreads()
{
static const bool enable_threads = true;
@@ -2133,6 +2152,24 @@ bool LLAppViewer::initThreads()
return true;
}
+#ifndef LL_BUGSPLAT
+void errorCallback(const std::string &error_string)
+{
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+ OSMessageBox(error_string, LLTrans::getString("MBFatalError"), OSMB_OK);
+#endif
+
+ //Set the ErrorActivated global so we know to create a marker file
+ gLLErrorActivated = true;
+
+ gDebugInfo["FatalMessage"] = error_string;
+ // We're not already crashing -- we simply *intend* to crash. Since we
+ // haven't actually trashed anything yet, we can afford to write the whole
+ // static info file.
+ LLAppViewer::instance()->writeDebugInfo();
+}
+#endif // ! LL_BUGSPLAT
+
void LLAppViewer::initLoggingAndGetLastDuration()
{
//
@@ -2889,7 +2926,6 @@ bool LLAppViewer::initWindow()
// Need to load feature table before cheking to start watchdog.
bool use_watchdog = false;
int watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled");
-
if (watchdog_enabled_setting == -1)
{
use_watchdog = !LLFeatureManager::getInstance()->isFeatureAvailable("WatchdogDisabled");
@@ -3352,10 +3388,19 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["MainloopThreadID"] = (S32)thread_id;
#endif
+#ifndef LL_BUGSPLAT
+ // "CrashNotHandled" is set here, while things are running well,
+ // in case of a freeze. If there is a freeze, the crash logger will be launched
+ // and can read this value from the debug_info.log.
+ // If the crash is handled by LLAppViewer::handleViewerCrash, ie not a freeze,
+ // then the value of "CrashNotHandled" will be set to true.
+ gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)true;
+#else // LL_BUGSPLAT
// "CrashNotHandled" is obsolete; it used (not very successsfully)
// to try to distinguish crashes from freezes
gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)false;
gDebugInfo["FatalMessage"] = LLError::getFatalMessage();
+#endif // ! LL_BUGSPLAT
// Insert crash host url (url to post crash log to) if configured. This insures
// that the crash report will go to the proper location in the case of a