summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewerlinux.cpp
diff options
context:
space:
mode:
authorAura Linden <aura@lindenlab.com>2013-12-03 17:06:06 -0800
committerAura Linden <aura@lindenlab.com>2013-12-03 17:06:06 -0800
commit680934812598d2c9116303f3245e7a9d60ff58bf (patch)
treedb084813bcfb23f00bd260c014672f4de784949f /indra/newview/llappviewerlinux.cpp
parent787ccaf297e81291469aaf269f563d862fb150a3 (diff)
Creating a cleaner branch
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()