diff options
| -rw-r--r-- | indra/llcommon/llapp.cpp | 25 | ||||
| -rw-r--r-- | indra/llcommon/llapp.h | 3 | ||||
| -rw-r--r-- | indra/newview/llappviewer.cpp | 7 | ||||
| -rw-r--r-- | indra/newview/llappviewer.h | 2 | ||||
| -rw-r--r-- | indra/newview/llappviewerlinux.cpp | 224 | ||||
| -rw-r--r-- | indra/newview/llappviewerlinux.h | 1 | ||||
| -rw-r--r-- | indra/newview/llappviewermacosx.cpp | 5 | ||||
| -rw-r--r-- | indra/newview/llappviewermacosx.h | 1 | ||||
| -rw-r--r-- | indra/newview/llappviewerwin32.cpp | 5 | ||||
| -rw-r--r-- | indra/newview/llappviewerwin32.h | 1 | 
10 files changed, 2 insertions, 272 deletions
| diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 6f4acd49b1..da14020f2b 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -96,7 +96,6 @@ BOOL LLApp::sLogInSignal = FALSE;  // static  LLApp::EAppStatus LLApp::sStatus = LLApp::APP_STATUS_STOPPED; // Keeps track of application status  LLAppErrorHandler LLApp::sErrorHandler = NULL; -LLAppErrorHandler LLApp::sSyncErrorHandler = NULL;  BOOL LLApp::sErrorThreadRunning = FALSE;  #if !LL_WINDOWS  LLApp::child_map LLApp::sChildMap; @@ -334,21 +333,6 @@ void LLApp::setErrorHandler(LLAppErrorHandler handler)  	LLApp::sErrorHandler = handler;  } - -void LLApp::setSyncErrorHandler(LLAppErrorHandler handler) -{ -	LLApp::sSyncErrorHandler = handler; -} - -// static -void LLApp::runSyncErrorHandler() -{ -	if (LLApp::sSyncErrorHandler) -	{ -		LLApp::sSyncErrorHandler(); -	} -} -  // static  void LLApp::runErrorHandler()  { @@ -371,13 +355,8 @@ void LLApp::setStatus(EAppStatus status)  // static  void LLApp::setError()  { -	if (!isError()) -	{ -		// perform any needed synchronous error-handling -		runSyncErrorHandler(); -		// set app status to ERROR so that the LLErrorThread notices -		setStatus(APP_STATUS_ERROR); -	} +	// set app status to ERROR so that the LLErrorThread notices +	setStatus(APP_STATUS_ERROR);  }  void LLApp::writeMiniDump() diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index 7b1144ebf1..a6294a5e1a 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -231,9 +231,7 @@ public:  	void setupErrorHandling();  	void setErrorHandler(LLAppErrorHandler handler); -	void setSyncErrorHandler(LLAppErrorHandler handler);  	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.  	//@}  	// @@ -306,7 +304,6 @@ private:  	// their own purposes  	typedef int(*signal_handler_func)(int signum);  	static LLAppErrorHandler sErrorHandler; -	static LLAppErrorHandler sSyncErrorHandler;  	// Default application threads  	LLErrorThread* mThreadErrorp;		// Waits for app to go to status ERROR, then runs the error callback diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 0484659793..1ad180a024 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2513,13 +2513,6 @@ void LLAppViewer::writeSystemInfo()  	writeDebugInfo(); // Save out debug_info.log early, in case of crash.  } -void LLAppViewer::handleSyncViewerCrash() -{ -	LLAppViewer* pApp = LLAppViewer::instance(); -	// Call to pure virtual, handled by platform specific llappviewer instance. -	pApp->handleSyncCrashTrace();  -} -  void LLAppViewer::handleViewerCrash()  {  	llinfos << "Handle viewer crash entry." << llendl; diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 5acd6e11c4..0b862a92a1 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -92,9 +92,7 @@ public:  	virtual bool restoreErrorTrap() = 0; // Require platform specific override to reset error handling mechanism.  	                                     // return false if the error trap needed restoration.  	virtual void handleCrashReporting(bool reportFreeze = false) = 0; // What to do with crash report? -	virtual void handleSyncCrashTrace() = 0; // any low-level crash-prep that has to happen in the context of the crashing thread before the crash report is delivered.  	static void handleViewerCrash(); // Hey! The viewer crashed. Do this, soon. -	static void handleSyncViewerCrash(); // Hey! The viewer crashed. Do this right NOW in the context of the crashing thread.      void checkForCrash();  	// Thread accessors diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 78b0f7ba83..ba9a4e4a6e 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -46,23 +46,6 @@  #include <exception> -#if LL_LINUX -# include <dlfcn.h>		// RTLD_LAZY -# include <execinfo.h>  // backtrace - glibc only -#elif LL_SOLARIS -# include <sys/types.h> -# include <unistd.h> -# include <fcntl.h> -# include <ucontext.h> -#endif - -#ifdef LL_ELFBIN -# ifdef __GNUC__ -#  include <cxxabi.h>			// for symbol demangling -# endif -# include "ELFIO/ELFIO.h"		// for better backtraces -#endif -  #if LL_DBUS_ENABLED  # include "llappviewerlinux_api_dbus.h" @@ -86,7 +69,6 @@ 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::handleSyncViewerCrash();  	LLAppViewer::handleViewerCrash();  	// we've probably been killed-off before now, but...  	gOldTerminateHandler(); // call old terminate() handler @@ -109,7 +91,6 @@ int main( int argc, char **argv )  	gOldTerminateHandler = std::set_terminate(exceptionTerminateHandler);  	// install crash handlers  	viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash); -	viewer_app_ptr->setSyncErrorHandler(LLAppViewer::handleSyncViewerCrash);  	bool ok = viewer_app_ptr->init();  	if(!ok) @@ -138,201 +119,6 @@ int main( int argc, char **argv )  	return 0;  } -#ifdef LL_SOLARIS -static inline BOOL do_basic_glibc_backtrace() -{ -	BOOL success = FALSE; - -	std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); -	llinfos << "Opening stack trace file " << strace_filename << llendl; -	LLFILE* StraceFile = LLFile::fopen(strace_filename, "w"); -	if (!StraceFile) -	{ -		llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; -		StraceFile = stderr; -	} - -	printstack(fileno(StraceFile)); - -	if (StraceFile != stderr) -		fclose(StraceFile); - -	return success; -} -#else -#define MAX_STACK_TRACE_DEPTH 40 -// This uses glibc's basic built-in stack-trace functions for a not very -// amazing backtrace. -static inline BOOL do_basic_glibc_backtrace() -{ -	void *stackarray[MAX_STACK_TRACE_DEPTH]; -	size_t size; -	char **strings; -	size_t i; -	BOOL success = FALSE; - -	size = backtrace(stackarray, MAX_STACK_TRACE_DEPTH); -	strings = backtrace_symbols(stackarray, size); - -	std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); -	llinfos << "Opening stack trace file " << strace_filename << llendl; -	LLFILE* StraceFile = LLFile::fopen(strace_filename, "w");		// Flawfinder: ignore -        if (!StraceFile) -	{ -		llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; -		StraceFile = stderr; -	} - -	if (size) -	{ -		for (i = 0; i < size; i++) -		{ -			// the format of the StraceFile is very specific, to allow (kludgy) machine-parsing -			fprintf(StraceFile, "%-3lu ", (unsigned long)i); -			fprintf(StraceFile, "%-32s\t", "unknown"); -			fprintf(StraceFile, "%p ", stackarray[i]); -			fprintf(StraceFile, "%s\n", strings[i]); -		} - -		success = TRUE; -	} -	 -	if (StraceFile != stderr) -		fclose(StraceFile); - -	free (strings); -	return success; -} - -#if LL_ELFBIN -// This uses glibc's basic built-in stack-trace functions together with -// ELFIO's ability to parse the .symtab ELF section for better symbol -// extraction without exporting symbols (which'd cause subtle, fatal bugs). -static inline BOOL do_elfio_glibc_backtrace() -{ -	void *stackarray[MAX_STACK_TRACE_DEPTH]; -	size_t btsize; -	char **strings; -	BOOL success = FALSE; - -	std::string appfilename = gDirUtilp->getExecutablePathAndName(); - -	std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); -	llinfos << "Opening stack trace file " << strace_filename << llendl; -	LLFILE* StraceFile = LLFile::fopen(strace_filename, "w");		// Flawfinder: ignore -        if (!StraceFile) -	{ -		llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; -		StraceFile = stderr; -	} - -	// get backtrace address list and basic symbol info -	btsize = backtrace(stackarray, MAX_STACK_TRACE_DEPTH); -	strings = backtrace_symbols(stackarray, btsize); - -	// create ELF reader for our app binary -	IELFI* pReader; -	const IELFISection* pSec = NULL; -	IELFISymbolTable* pSymTbl = 0; -	if (ERR_ELFIO_NO_ERROR != ELFIO::GetInstance()->CreateELFI(&pReader) || -	    ERR_ELFIO_NO_ERROR != pReader->Load(appfilename.c_str()) || -	    // find symbol table, create reader-object -	    NULL == (pSec = pReader->GetSection( ".symtab" )) || -	    ERR_ELFIO_NO_ERROR != pReader->CreateSectionReader(IELFI::ELFI_SYMBOL, pSec, (void**)&pSymTbl) ) -	{ -		// Failed to open our binary and read its symbol table somehow -		llinfos << "Could not initialize ELF symbol reading - doing basic backtrace." << llendl; -		if (StraceFile != stderr) -			fclose(StraceFile); -		// note that we may be leaking some of the above ELFIO -		// objects now, but it's expected that we'll be dead soon -		// and we want to tread delicately until we get *some* kind -		// of useful backtrace. -		return do_basic_glibc_backtrace(); -	} - -	// iterate over trace and symtab, looking for plausible symbols -	std::string   name; -	Elf32_Addr    value; -	Elf32_Word    ssize; -	unsigned char bind; -	unsigned char type; -	Elf32_Half    section; -	int nSymNo = pSymTbl->GetSymbolNum(); -	size_t btpos; -	for (btpos = 0; btpos < btsize; ++btpos) -	{ -		// the format of the StraceFile is very specific, to allow (kludgy) machine-parsing -		fprintf(StraceFile, "%-3ld ", (long)btpos); -		int symidx; -		for (symidx = 0; symidx < nSymNo; ++symidx) -		{ -			if (ERR_ELFIO_NO_ERROR == -			    pSymTbl->GetSymbol(symidx, name, value, ssize, -					       bind, type, section)) -			{ -				// check if trace address within symbol range -				if (uintptr_t(stackarray[btpos]) >= value && -				    uintptr_t(stackarray[btpos]) < value+ssize) -				{ -					// symbol is inside viewer -					fprintf(StraceFile, "%-32s\t", "com.secondlife.indra.viewer"); -					fprintf(StraceFile, "%p ", stackarray[btpos]); - -					char *demangled_str = NULL; -					int demangle_result = 1; -					demangled_str = -						abi::__cxa_demangle -						(name.c_str(), NULL, NULL, -						 &demangle_result); -					if (0 == demangle_result && -					    NULL != demangled_str) { -						fprintf(StraceFile, -							"%s", demangled_str); -						free(demangled_str); -					} -					else // failed demangle; print it raw -					{ -						fprintf(StraceFile, -							"%s", name.c_str()); -					} -					// print offset from symbol start -					fprintf(StraceFile, -						" + %lu\n", -						uintptr_t(stackarray[btpos]) - -						value); -					goto got_sym; // early escape -				} -			} -		} -		// Fallback: -		// Didn't find a suitable symbol in the binary - it's probably -		// a symbol in a DSO; use glibc's idea of what it should be. -		fprintf(StraceFile, "%-32s\t", "unknown"); -		fprintf(StraceFile, "%p ", stackarray[btpos]); -		fprintf(StraceFile, "%s\n", strings[btpos]); -	got_sym:; -	} -	 -	if (StraceFile != stderr) -		fclose(StraceFile); - -	pSymTbl->Release(); -	pSec->Release(); -	pReader->Release(); - -	free(strings); - -	llinfos << "Finished generating stack trace." << llendl; - -	success = TRUE; -	return success; -} -#endif // LL_ELFBIN - -#endif // LL_SOLARIS - -  LLAppViewerLinux::LLAppViewerLinux()  {  } @@ -541,16 +327,6 @@ bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url)  }  #endif // LL_DBUS_ENABLED -void LLAppViewerLinux::handleSyncCrashTrace() -{ -	// This backtrace writes into stack_trace.log -#  if LL_ELFBIN -	do_elfio_glibc_backtrace(); // more useful backtrace -#  else -	do_basic_glibc_backtrace(); // only slightly useful backtrace -#  endif // LL_ELFBIN -} -  void LLAppViewerLinux::handleCrashReporting(bool reportFreeze)  {  	std::string cmd =gDirUtilp->getExecutableDir(); diff --git a/indra/newview/llappviewerlinux.h b/indra/newview/llappviewerlinux.h index 230c0dc24b..b17380d4d8 100644 --- a/indra/newview/llappviewerlinux.h +++ b/indra/newview/llappviewerlinux.h @@ -68,7 +68,6 @@ protected:  	virtual bool restoreErrorTrap();  	virtual void handleCrashReporting(bool reportFreeze); -	virtual void handleSyncCrashTrace();  	virtual bool initLogging();  	virtual bool initParseCommandLine(LLCommandLineParser& clp); diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 2f12ad7e38..1e66e55f3d 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -264,11 +264,6 @@ bool LLAppViewerMacOSX::restoreErrorTrap()  	return reset_count == 0;  } -void LLAppViewerMacOSX::handleSyncCrashTrace() -{ -	// do nothing -} -  static OSStatus CarbonEventHandler(EventHandlerCallRef inHandlerCallRef,   								   EventRef inEvent,   								   void* inUserData) diff --git a/indra/newview/llappviewermacosx.h b/indra/newview/llappviewermacosx.h index cbf7e6c209..3d7bb55556 100644 --- a/indra/newview/llappviewermacosx.h +++ b/indra/newview/llappviewermacosx.h @@ -55,7 +55,6 @@ public:  protected:  	virtual bool restoreErrorTrap();  	virtual void handleCrashReporting(bool reportFreeze);  -	virtual void handleSyncCrashTrace();  	std::string generateSerialNumber();  	virtual bool initParseCommandLine(LLCommandLineParser& clp); diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 88d8dba8af..e3ef04d03d 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -479,11 +479,6 @@ bool LLAppViewerWin32::restoreErrorTrap()  	//return LLWinDebug::checkExceptionHandler();  } -void LLAppViewerWin32::handleSyncCrashTrace() -{ -	// do nothing -} -  void LLAppViewerWin32::handleCrashReporting(bool reportFreeze)  {  	const char* logger_name = "win_crash_logger.exe"; diff --git a/indra/newview/llappviewerwin32.h b/indra/newview/llappviewerwin32.h index 13454edeec..52dcc583a4 100644 --- a/indra/newview/llappviewerwin32.h +++ b/indra/newview/llappviewerwin32.h @@ -57,7 +57,6 @@ protected:  	virtual bool restoreErrorTrap();  	virtual void handleCrashReporting(bool reportFreeze);  -	virtual void handleSyncCrashTrace();  	virtual bool sendURLToOtherInstance(const std::string& url); | 
