Esempio n. 1
0
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
}
Esempio n. 2
0
void LLAppViewerLinux::handleCrashReporting()
{

	// Always generate the report, have the logger do the asking, and
	// don't wait for the logger before exiting (-> total cleanup).
	if (CRASH_BEHAVIOR_NEVER_SEND != LLAppViewer::instance()->getCrashBehavior())
	{	
		// 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
		// launch the actual crash logger
		char* ask_dialog = "-dialog";
		if (CRASH_BEHAVIOR_ASK != LLAppViewer::instance()->getCrashBehavior())
			ask_dialog = ""; // omit '-dialog' option
		std::string cmd =gDirUtilp->getAppRODataDir();
		cmd += gDirUtilp->getDirDelimiter();
		cmd += "linux-crash-logger.bin";
		char* const cmdargv[] =
			{(char*)cmd.c_str(),
			 ask_dialog,
			 (char*)"-user",
			 (char*)gGridName,
			 (char*)"-name",
			 (char*)LLAppViewer::instance()->getSecondLifeTitle().c_str(),
			 NULL};
		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)
			{
				// 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;
			}
		}
	}
	// Sometimes signals don't seem to quit the viewer.  
	// Make sure we exit so as to not totally confuse the user.
	exit(1);
}