Breaking pad: restore 'Ask' preference for sending reports, cleanup remaining out-of-process bits
This commit is contained in:
@@ -307,46 +307,12 @@ void LLApp::setupErrorHandling()
|
|||||||
// Install the Google Breakpad crash handler for Windows
|
// Install the Google Breakpad crash handler for Windows
|
||||||
if(mExceptionHandler == 0)
|
if(mExceptionHandler == 0)
|
||||||
{
|
{
|
||||||
llwarns << "adding breakpad exception handler" << llendl;
|
mExceptionHandler = new google_breakpad::ExceptionHandler(
|
||||||
|
std::wstring(mDumpPath.begin(),mDumpPath.end()), //Dump path
|
||||||
std::wostringstream ws;
|
0, //dump filename
|
||||||
ws << mCrashReportPipeStr << getPid();
|
windows_post_minidump_callback,
|
||||||
std::wstring wpipe_name = ws.str();
|
0,
|
||||||
std::string ptmp = std::string(wpipe_name.begin(), wpipe_name.end());
|
google_breakpad::ExceptionHandler::HANDLER_ALL);
|
||||||
|
|
||||||
::Sleep(2000); //HACK hopefully a static wait won't blow up in my face before google fixes their implementation.
|
|
||||||
|
|
||||||
//HACK this for loop is ueless. Breakpad dumbly returns success when the OOP handler isn't initialized.
|
|
||||||
for (int retries=0;retries<5;++retries)
|
|
||||||
{
|
|
||||||
mExceptionHandler = new google_breakpad::ExceptionHandler(
|
|
||||||
L"",
|
|
||||||
NULL, //No filter
|
|
||||||
windows_post_minidump_callback,
|
|
||||||
0,
|
|
||||||
google_breakpad::ExceptionHandler::HANDLER_ALL,
|
|
||||||
MiniDumpNormal, //Generate a 'normal' minidump.
|
|
||||||
(WCHAR *)wpipe_name.c_str(),
|
|
||||||
NULL); //No custom client info.
|
|
||||||
if (mExceptionHandler)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
::Sleep(100); //Wait a tick and try again.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!mExceptionHandler)
|
|
||||||
{
|
|
||||||
llwarns << "Failed to initialize OOP exception handler. Defaulting to In Process handling" << llendl;
|
|
||||||
mExceptionHandler = new google_breakpad::ExceptionHandler(
|
|
||||||
std::wstring(mDumpPath.begin(),mDumpPath.end()), //Dump path
|
|
||||||
0, //dump filename
|
|
||||||
windows_post_minidump_callback,
|
|
||||||
0,
|
|
||||||
google_breakpad::ExceptionHandler::HANDLER_ALL);
|
|
||||||
}
|
|
||||||
if (mExceptionHandler)
|
if (mExceptionHandler)
|
||||||
{
|
{
|
||||||
mExceptionHandler->set_handle_debug_exceptions(true);
|
mExceptionHandler->set_handle_debug_exceptions(true);
|
||||||
|
|||||||
@@ -522,61 +522,7 @@ bool LLAppViewerWin32::restoreErrorTrap()
|
|||||||
|
|
||||||
void LLAppViewerWin32::initCrashReporting(bool reportFreeze)
|
void LLAppViewerWin32::initCrashReporting(bool reportFreeze)
|
||||||
{
|
{
|
||||||
/* Singu Note: don't fork the crash logger on start
|
// Singu Note: we don't fork the crash logger on start
|
||||||
const char* logger_name = "win_crash_logger.exe";
|
|
||||||
std::string exe_path = gDirUtilp->getExecutableDir();
|
|
||||||
exe_path += gDirUtilp->getDirDelimiter();
|
|
||||||
exe_path += logger_name;
|
|
||||||
|
|
||||||
std::stringstream pid_str;
|
|
||||||
pid_str << LLApp::getPid();
|
|
||||||
std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "");
|
|
||||||
std::string appname = gDirUtilp->getExecutableFilename();
|
|
||||||
|
|
||||||
S32 slen = logdir.length() -1;
|
|
||||||
S32 end = slen;
|
|
||||||
while (logdir.at(end) == '/' || logdir.at(end) == '\\') end--;
|
|
||||||
|
|
||||||
if (slen !=end)
|
|
||||||
{
|
|
||||||
logdir = logdir.substr(0,end+1);
|
|
||||||
}
|
|
||||||
std::string arg_str = "\"" + exe_path + "\" -dumpdir \"" + logdir + "\" -procname \"" + appname + "\" -pid " + pid_str.str();
|
|
||||||
llinfos << "spawning " << arg_str << llendl;
|
|
||||||
_spawnl(_P_NOWAIT, exe_path.c_str(), arg_str.c_str(), NULL);
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* STARTUPINFO siStartupInfo;
|
|
||||||
|
|
||||||
std::string arg_str = "-dumpdir \"" + logdir + "\" -procname \"" + appname + "\" -pid " + pid_str.str();
|
|
||||||
|
|
||||||
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
|
|
||||||
memset(&mCrashReporterProcessInfo, 0, sizeof(mCrashReporterProcessInfo));
|
|
||||||
|
|
||||||
siStartupInfo.cb = sizeof(siStartupInfo);
|
|
||||||
|
|
||||||
std::wstring exe_wstr;
|
|
||||||
exe_wstr.assign(exe_path.begin(), exe_path.end());
|
|
||||||
|
|
||||||
std::wstring arg_wstr;
|
|
||||||
arg_wstr.assign(arg_str.begin(), arg_str.end());
|
|
||||||
|
|
||||||
if(CreateProcess(&exe_wstr[0],
|
|
||||||
&arg_wstr[0], // Application arguments
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
FALSE,
|
|
||||||
CREATE_DEFAULT_ERROR_MODE,
|
|
||||||
0,
|
|
||||||
0, // Working directory
|
|
||||||
&siStartupInfo,
|
|
||||||
&mCrashReporterProcessInfo) == FALSE)
|
|
||||||
// Could not start application -> call 'GetLastError()'
|
|
||||||
{
|
|
||||||
//llinfos << "CreateProcess failed " << GetLastError() << llendl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//virtual
|
//virtual
|
||||||
|
|||||||
@@ -40,7 +40,10 @@
|
|||||||
#include "llhttpclient.h"
|
#include "llhttpclient.h"
|
||||||
#include "llsdserialize.h"
|
#include "llsdserialize.h"
|
||||||
#include "llproxy.h"
|
#include "llproxy.h"
|
||||||
|
#include "llwindow.h"
|
||||||
|
#include "lltrans.h"
|
||||||
#include "aistatemachine.h"
|
#include "aistatemachine.h"
|
||||||
|
#include "boost/filesystem.hpp"
|
||||||
|
|
||||||
class AIHTTPTimeoutPolicy;
|
class AIHTTPTimeoutPolicy;
|
||||||
extern AIHTTPTimeoutPolicy crashLoggerResponder_timeout;
|
extern AIHTTPTimeoutPolicy crashLoggerResponder_timeout;
|
||||||
@@ -144,6 +147,36 @@ std::string getStartupStateFromLog(std::string& sllog)
|
|||||||
return startup_state;
|
return startup_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool miniDumpExists(const std::string& dumpDir)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!boost::filesystem::exists(dumpDir))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::filesystem::directory_iterator end_itr;
|
||||||
|
for (boost::filesystem::directory_iterator i(dumpDir); i != end_itr; ++i)
|
||||||
|
{
|
||||||
|
if (!boost::filesystem::is_regular_file(i->status())) continue;
|
||||||
|
if (".dmp" == i->path().extension())
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const boost::filesystem::filesystem_error& e)
|
||||||
|
{
|
||||||
|
llwarns << "Failed to determine existance of the minidump file: '" + e.code().message() +"'" << llendl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
bool LLCrashLogger::readDebugFromXML(LLSD& dest, const std::string& filename )
|
bool LLCrashLogger::readDebugFromXML(LLSD& dest, const std::string& filename )
|
||||||
{
|
{
|
||||||
std::string db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,filename);
|
std::string db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,filename);
|
||||||
@@ -350,20 +383,29 @@ bool LLCrashLogger::sendCrashLog(std::string dump_dir)
|
|||||||
|
|
||||||
void LLCrashLogger::checkCrashDump()
|
void LLCrashLogger::checkCrashDump()
|
||||||
{
|
{
|
||||||
mCrashHost = gSavedSettings.getString("CrashHostUrl");
|
|
||||||
|
|
||||||
std::string dumpDir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "") + "singularity-debug";
|
|
||||||
if (gDirUtilp->fileExists(dumpDir))
|
|
||||||
{
|
|
||||||
#if LL_SEND_CRASH_REPORTS
|
#if LL_SEND_CRASH_REPORTS
|
||||||
if (!mCrashHost.empty() && gSavedSettings.getS32("CrashSubmitBehavior") != 2)
|
// 0 - ask, 1 - always send, 2 - never send
|
||||||
|
S32 pref = gSavedSettings.getS32("CrashSubmitBehavior");
|
||||||
|
if (pref == 2) return; //never send
|
||||||
|
|
||||||
|
mCrashHost = gSavedSettings.getString("CrashHostUrl");
|
||||||
|
std::string dumpDir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "") + "singularity-debug";
|
||||||
|
|
||||||
|
// Do we have something to send, and somewhere to send it
|
||||||
|
if (!mCrashHost.empty() && miniDumpExists(dumpDir))
|
||||||
|
{
|
||||||
|
if (pref == 1) // always send
|
||||||
{
|
{
|
||||||
sendCrashLog(dumpDir);
|
sendCrashLog(dumpDir);
|
||||||
}
|
}
|
||||||
|
else // ask
|
||||||
|
{
|
||||||
|
U32 response = OSMessageBox(LLTrans::getString("MBFrozenCrashed"), LLTrans::getString("MBAlert"), OSMB_YESNO);
|
||||||
|
if (response == OSBTN_YES)
|
||||||
|
{
|
||||||
|
sendCrashLog(dumpDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llinfos << "No crash dump found frome previous run, not sending report" << LL_ENDL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user