Mac crash behavior matches windows and linux: report on crash (not after restart). This is OK because we use Breakpad generated minidumps instead of OS generated ones.

master
Andrew A. de Laix 2010-05-25 13:32:12 -07:00
parent 45a86b6751
commit 5a52c5eb8a
4 changed files with 16 additions and 85 deletions

View File

@ -235,6 +235,11 @@ public:
static void runErrorHandler(); // run shortly after we detect an error, ran in the relatively robust context of the LLErrorThread - preferred.
static void runSyncErrorHandler(); // run IMMEDIATELY when we get an error, ran in the context of the faulting thread.
//@}
//
// Expose exception handler.
//
google_breakpad::ExceptionHandler * getExceptionHandler(void) { return mExceptionHandler; }
#if !LL_WINDOWS
//

View File

@ -155,25 +155,6 @@ std::string getStartupStateFromLog(std::string& sllog)
void LLCrashLogger::gatherFiles()
{
/*
//TODO:This function needs to be reimplemented somewhere in here...
if(!previous_crash && is_crash_log)
{
// Make sure the file isn't too old.
double age = difftime(gLaunchTime, stat_data.st_mtimespec.tv_sec);
// llinfos << "age is " << age << llendl;
if(age > 60.0)
{
// The file was last modified more than 60 seconds before the crash reporter was launched. Assume it's stale.
llwarns << "File " << mFilename << " is too old!" << llendl;
return;
}
}
*/
updateApplication("Gathering logs...");
// Figure out the filename of the debug log
@ -209,18 +190,12 @@ void LLCrashLogger::gatherFiles()
mFileMap["SettingsXml"] = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings.xml");
}
#if !LL_DARWIN
if(mCrashInPreviousExec)
#else
#endif
{
// Replace the log file ext with .old, since the
// instance that launched this process has overwritten
// SecondLife.log
std::string log_filename = mFileMap["SecondLifeLog"];
log_filename.replace(log_filename.size() - 4, 4, ".old");
mFileMap["SecondLifeLog"] = log_filename;
}
// Replace the log file ext with .old, since the
// instance that launched this process has overwritten
// SecondLife.log
std::string log_filename = mFileMap["SecondLifeLog"];
log_filename.replace(log_filename.size() - 4, 4, ".old");
mFileMap["SecondLifeLog"] = log_filename;
gatherPlatformSpecificFiles();
@ -295,6 +270,7 @@ void LLCrashLogger::gatherFiles()
mCrashInfo["Minidump"] = data;
}
}
mCrashInfo["DebugLog"].erase("MinidumpPath");
}
LLSD LLCrashLogger::constructPostData()

View File

@ -102,6 +102,8 @@
// Third party library includes
#include <boost/bind.hpp>
#include <google_breakpad/exception_handler.h>
#if LL_WINDOWS
# include <share.h> // For _SH_DENYWR in initMarkerFile
@ -2281,17 +2283,7 @@ void LLAppViewer::checkForCrash(void)
{
#if LL_SEND_CRASH_REPORTS
//*NOTE:Mani The current state of the crash handler has the MacOSX
// sending all crash reports as freezes, in order to let
// the MacOSX CrashRepoter generate stacks before spawning the
// SL crash logger.
// The Linux and Windows clients generate their own stacks and
// spawn the SL crash logger immediately. This may change in the future.
#if LL_DARWIN
if(gLastExecEvent != LAST_EXEC_NORMAL)
#else
if (gLastExecEvent == LAST_EXEC_FROZE)
#endif
{
llinfos << "Last execution froze, requesting to send crash report." << llendl;
//
@ -2552,9 +2544,6 @@ void LLAppViewer::handleViewerCrash()
return;
}
pApp->mReportedCrash = TRUE;
// Make sure the watchdog gets turned off...
// pApp->destroyMainloopTimeout(); // SJB: Bah. This causes the crash handler to hang, not sure why.
//We already do this in writeSystemInfo(), but we do it again here to make /sure/ we have a version
//to check against no matter what
@ -2665,10 +2654,6 @@ void LLAppViewer::handleViewerCrash()
LLError::logToFile("");
// On Mac, we send the report on the next run, since we need macs crash report
// for a stack trace, so we have to let it the app fail.
#if !LL_DARWIN
// Remove the marker file, since otherwise we'll spawn a process that'll keep it locked
if(gDebugInfo["LastExecEvent"].asInteger() == LAST_EXEC_LOGOUT_CRASH)
{
@ -2681,8 +2666,6 @@ void LLAppViewer::handleViewerCrash()
// Call to pure virtual, handled by platform specific llappviewer instance.
pApp->handleCrashReporting();
#endif //!LL_DARWIN
return;
}
@ -3287,9 +3270,6 @@ void LLAppViewer::badNetworkHandler()
mPurgeOnExit = TRUE;
LLAppViewer::handleSyncViewerCrash();
LLAppViewer::handleViewerCrash();
std::ostringstream message;
message <<
"The viewer has detected mangled network data indicative\n"
@ -3302,6 +3282,8 @@ void LLAppViewer::badNetworkHandler()
"If the problem continues, see the Tech Support FAQ at: \n"
"www.secondlife.com/support";
forceDisconnect(message.str());
LLApp::instance()->getExceptionHandler()->WriteMinidump();
}
// This routine may get called more than once during the shutdown process.

View File

@ -384,38 +384,6 @@ void LLAppViewerMacOSX::handleCrashReporting(bool reportFreeze)
}
}
if(!reportFreeze)
{
_exit(1);
}
// TODO from palmer: Find a better way to handle managing old crash logs
// when this is a separate imbedable module. Ideally just sort crash stack
// logs based on date, and grab the latest one as opposed to deleting them
// for thoughts on what the module would look like.
// See: https://wiki.lindenlab.com/wiki/Viewer_Crash_Reporter_Round_4
// Remove the crash stack log from previous executions.
// Since we've started logging a new instance of the app, we can assume
// The old crash stack is invalid for the next crash report.
char path[MAX_PATH];
FSRef folder;
if(FSFindFolder(kUserDomain, kLogsFolderType, false, &folder) == noErr)
{
// folder is an FSRef to ~/Library/Logs/
if(FSRefMakePath(&folder, (UInt8*)&path, sizeof(path)) == noErr)
{
std::string pathname = std::string(path) + std::string("/CrashReporter/");
std::string mask = "Second Life*";
std::string file_name;
while(gDirUtilp->getNextFileInDir(pathname, mask, file_name, false))
{
LLFile::remove(pathname + file_name);
}
}
}
}
std::string LLAppViewerMacOSX::generateSerialNumber()