summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewerlinux.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-04-07 16:19:07 -0700
committerMerov Linden <merov@lindenlab.com>2014-04-07 16:19:07 -0700
commitc79abac5ad5d41f86655883fd9f3ec6a108967a7 (patch)
tree40805ae02a9ee73eb0e9832a01e1dbc0bac914d5 /indra/newview/llappviewerlinux.cpp
parent77e10d38e56d389e759d1d9c24d03b6fe71f83e0 (diff)
parent7e966f28da79d2d24f93a2615c8807421300700c (diff)
Pull merge from lindenlab/viewer-release
Diffstat (limited to 'indra/newview/llappviewerlinux.cpp')
-rwxr-xr-xindra/newview/llappviewerlinux.cpp114
1 files changed, 55 insertions, 59 deletions
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index b16bb573e1..11fcf0018e 100755
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -58,12 +58,15 @@ namespace
void (*gOldTerminateHandler)() = NULL;
}
+
static void exceptionTerminateHandler()
{
// reinstall default terminate() handler in case we re-terminate.
if (gOldTerminateHandler) std::set_terminate(gOldTerminateHandler);
// treat this like a regular viewer crash, with nice stacktrace etc.
- LLAppViewer::handleViewerCrash();
+ long *null_ptr;
+ null_ptr = 0;
+ *null_ptr = 0xDEADBEEF; //Force an exception that will trigger breakpad.
// we've probably been killed-off before now, but...
gOldTerminateHandler(); // call old terminate() handler
}
@@ -127,7 +130,17 @@ bool LLAppViewerLinux::init()
// really early in app startup!
if (!g_thread_supported ()) g_thread_init (NULL);
- return LLAppViewer::init();
+ bool success = LLAppViewer::init();
+
+#if LL_SEND_CRASH_REPORTS
+ if (success)
+ {
+ LLAppViewer* pApp = LLAppViewer::instance();
+ pApp->initCrashReporting();
+ }
+#endif
+
+ return success;
}
bool LLAppViewerLinux::restoreErrorTrap()
@@ -319,7 +332,7 @@ bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url)
}
#endif // LL_DBUS_ENABLED
-void LLAppViewerLinux::handleCrashReporting(bool reportFreeze)
+void LLAppViewerLinux::initCrashReporting(bool reportFreeze)
{
std::string cmd =gDirUtilp->getExecutableDir();
cmd += gDirUtilp->getDirDelimiter();
@@ -331,69 +344,52 @@ void LLAppViewerLinux::handleCrashReporting(bool reportFreeze)
# error Unknown platform
#endif
- if(reportFreeze)
- {
- char* const cmdargv[] =
- {(char*)cmd.c_str(),
- (char*)"-previous",
- NULL};
-
- fflush(NULL); // flush all buffers before the child inherits them
- pid_t pid = fork();
- if (pid == 0)
- { // child
- execv(cmd.c_str(), cmdargv); /* Flawfinder: Ignore */
- llwarns << "execv failure when trying to start " << cmd << llendl;
- _exit(1); // avoid atexit()
- } else {
- if (pid > 0)
- {
- // wait for child proc to die
- int childExitStatus;
- waitpid(pid, &childExitStatus, 0);
- } else {
- llwarns << "fork failure." << llendl;
- }
- }
- }
+ std::stringstream pid_str;
+ pid_str << LLApp::getPid();
+ std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "");
+ std::string appname = gDirUtilp->getExecutableFilename();
+ // launch the actual crash logger
+ const char * cmdargv[] =
+ {cmd.c_str(),
+ "-user",
+ (char*)LLGridManager::getInstance()->getGridId().c_str(),
+ "-name",
+ LLAppViewer::instance()->getSecondLifeTitle().c_str(),
+ "-pid",
+ pid_str.str().c_str(),
+ "-dumpdir",
+ logdir.c_str(),
+ "-procname",
+ appname.c_str(),
+ NULL};
+ fflush(NULL);
+
+ pid_t pid = fork();
+ if (pid == 0)
+ { // child
+ execv(cmd.c_str(), (char* const*) cmdargv); /* Flawfinder: ignore */
+ llwarns << "execv failure when trying to start " << cmd << llendl;
+ _exit(1); // avoid atexit()
+ }
else
{
- // launch the actual crash logger
- const char * cmdargv[] =
- {cmd.c_str(),
- "-user",
- (char*)LLGridManager::getInstance()->getGridId().c_str(),
- "-name",
- LLAppViewer::instance()->getSecondLifeTitle().c_str(),
- NULL};
- fflush(NULL);
- pid_t pid = fork();
- if (pid == 0)
- { // child
- execv(cmd.c_str(), (char* const*) cmdargv); /* Flawfinder: ignore */
- llwarns << "execv failure when trying to start " << cmd << llendl;
- _exit(1); // avoid atexit()
+ if (pid > 0)
+ {
+ // DO NOT wait for child proc to die; we want
+ // the logger to outlive us while we quit to
+ // free up the screen/keyboard/etc.
+ ////int childExitStatus;
+ ////waitpid(pid, &childExitStatus, 0);
}
else
{
- if (pid > 0)
- {
- // DO NOT wait for child proc to die; we want
- // the logger to outlive us while we quit to
- // free up the screen/keyboard/etc.
- ////int childExitStatus;
- ////waitpid(pid, &childExitStatus, 0);
- }
- else
- {
- llwarns << "fork failure." << llendl;
- }
+ llwarns << "fork failure." << llendl;
}
- // Sometimes signals don't seem to quit the viewer. Also, we may
- // have been called explicitly instead of from a signal handler.
- // Make sure we exit so as to not totally confuse the user.
- _exit(1); // avoid atexit(), else we may re-crash in dtors.
}
+ // Sometimes signals don't seem to quit the viewer. Also, we may
+ // have been called explicitly instead of from a signal handler.
+ // Make sure we exit so as to not totally confuse the user.
+ //_exit(1); // avoid atexit(), else we may re-crash in dtors.
}
bool LLAppViewerLinux::beingDebugged()