diff options
| author | Andrew A. de Laix <alain@lindenlab.com> | 2010-05-25 13:32:12 -0700 | 
|---|---|---|
| committer | Andrew A. de Laix <alain@lindenlab.com> | 2010-05-25 13:32:12 -0700 | 
| commit | 5a52c5eb8a5cc4e1215911bac9121891dd802d45 (patch) | |
| tree | 7f708f7589a2c166e42b797797867408cfc9793e | |
| parent | 45a86b67518a579b166e1cf6a719d4aed4c35a39 (diff) | |
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.
| -rw-r--r-- | indra/llcommon/llapp.h | 5 | ||||
| -rwxr-xr-x | indra/llcrashlogger/llcrashlogger.cpp | 38 | ||||
| -rw-r--r-- | indra/newview/llappviewer.cpp | 26 | ||||
| -rw-r--r-- | indra/newview/llappviewermacosx.cpp | 32 | 
4 files changed, 16 insertions, 85 deletions
| diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index 725c13866f..8b2dc1ab72 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -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  	// diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 8f5aa5ab2d..9d777cd649 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -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() diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index e9ec0b8b77..418b587321 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -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. diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 0b5f18c330..2f12ad7e38 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -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() | 
