From 719edddf0498752a0295502d62710823d1a72cc7 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Fri, 21 May 2010 09:38:29 -0700 Subject: Switch Darwin to use breakpad minidump rather than os generated crash stack. --- indra/llcrashlogger/llcrashlogger.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'indra/llcrashlogger') diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index c1022c1195..8f5aa5ab2d 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -274,6 +274,27 @@ void LLCrashLogger::gatherFiles() mCrashInfo[(*itr).first] = rawstr_to_utf8(crash_info); } + + // Add minidump as binary. + std::string minidump_path = mDebugLog["MinidumpPath"]; + if(minidump_path != "") + { + std::ifstream minidump_stream(minidump_path.c_str(), std::ios_base::in | std::ios_base::binary); + if(minidump_stream.is_open()) + { + minidump_stream.seekg(0, std::ios::end); + size_t length = minidump_stream.tellg(); + minidump_stream.seekg(0, std::ios::beg); + + LLSD::Binary data; + data.resize(length); + + minidump_stream.read(reinterpret_cast(&(data[0])),length); + minidump_stream.close(); + + mCrashInfo["Minidump"] = data; + } + } } LLSD LLCrashLogger::constructPostData() -- cgit v1.2.3 From 5a52c5eb8a5cc4e1215911bac9121891dd802d45 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 25 May 2010 13:32:12 -0700 Subject: 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. --- indra/llcrashlogger/llcrashlogger.cpp | 38 +++++++---------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) (limited to 'indra/llcrashlogger') 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() -- cgit v1.2.3 From 6a39149fec72e3a105d7a47b8a9f5aa2a0bfba87 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 25 May 2010 15:08:36 -0700 Subject: Added configuration setting to send crash reports to configured url rather than through the grid. --- indra/llcrashlogger/llcrashlogger.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llcrashlogger') diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 9d777cd649..2ec7347db0 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -200,7 +200,12 @@ void LLCrashLogger::gatherFiles() gatherPlatformSpecificFiles(); //Use the debug log to reconstruct the URL to send the crash report to - if(mDebugLog.has("CurrentSimHost")) + if(mDebugLog.has("CrashHostUrl")) + { + // Crash log receiver has been manually configured. + mCrashHost = mDebugLog["CrashHostUrl"].asString(); + } + else if(mDebugLog.has("CurrentSimHost")) { mCrashHost = "https://"; mCrashHost += mDebugLog["CurrentSimHost"].asString(); -- cgit v1.2.3 From bd32a9c6efc5598711bfed9ff20d049878bc96a4 Mon Sep 17 00:00:00 2001 From: Lynx Linden Date: Thu, 27 May 2010 15:47:05 +0100 Subject: Don't try to add old stack trace files to the crash report. Such as stack_trace.log on Linux or SecondLifeException.log on Win32. --- indra/llcrashlogger/llcrashlogger.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llcrashlogger') diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 2ec7347db0..aa2ea17af9 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -227,7 +227,6 @@ void LLCrashLogger::gatherFiles() mCrashInfo["DebugLog"] = mDebugLog; mFileMap["StatsLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stats.log"); - mFileMap["StackTrace"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); updateApplication("Encoding files..."); -- cgit v1.2.3 From f24335d7901b040365b4934c5fc0ce8f7d694f18 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 1 Jun 2010 14:07:20 -0700 Subject: Fix log file inclusion; include SecondLife.log on crash, but SecondLife.old on freeze. --- indra/llcrashlogger/llcrashlogger.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'indra/llcrashlogger') diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index aa2ea17af9..078795f962 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -190,12 +190,16 @@ void LLCrashLogger::gatherFiles() mFileMap["SettingsXml"] = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings.xml"); } - // 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; + if(mCrashInPreviousExec) + { + // Restarting after freeze. + // 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(); -- cgit v1.2.3 From 8990498b420ba7083aa35c3eb08d87ebcd2a29a4 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Wed, 2 Jun 2010 11:03:03 -0700 Subject: Crash logger renames log flies to safe names so they don't get clobbered on SL restart. Old logs are cleaned up after 1 week. --- indra/llcrashlogger/llcrashlogger.cpp | 88 +++++++++++++++++++++++------------ indra/llcrashlogger/llcrashlogger.h | 1 + 2 files changed, 59 insertions(+), 30 deletions(-) (limited to 'indra/llcrashlogger') diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 078795f962..a91cf530b5 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -36,6 +36,8 @@ #include "llcrashlogger.h" #include "linden_common.h" +#include "lldate.h" +#include "llfile.h" #include "llstring.h" #include "indra_constants.h" // CRASH_BEHAVIOR_ASK, CRASH_SETTING_NAME #include "llerror.h" @@ -153,54 +155,79 @@ std::string getStartupStateFromLog(std::string& sllog) return startup_state; } -void LLCrashLogger::gatherFiles() +void LLCrashLogger::findAndRenameLogFiles() { - updateApplication("Gathering logs..."); + // Find and rename the relevant log files so they won't be stomped on if + // SL is restarted before user sends crash report. + + std::string now = "." + LLDate::now().asString(); + + std::string stats_log_original = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stats.log"); + std::string stats_log = stats_log_original; + stats_log.insert(stats_log.length() - 4, now); + if(LLFile::rename(stats_log_original, stats_log) == 0) + { + mFileMap["StatsLog"] = stats_log; + } + + std::string second_life_log_original; + std::string settings_file_original; - // Figure out the filename of the debug log - std::string db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); + std::string db_file_name_original = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); + std::string db_file_name = db_file_name_original; + db_file_name.insert(db_file_name.length() - 4, now); + LLFile::rename(db_file_name_original, db_file_name); std::ifstream debug_log_file(db_file_name.c_str()); - - // Look for it in the debug_info.log file if (debug_log_file.is_open()) { - LLSDSerialize::fromXML(mDebugLog, debug_log_file); - + LLSDSerialize::fromXML(mDebugLog, debug_log_file); mCrashInPreviousExec = mDebugLog["CrashNotHandled"].asBoolean(); - - mFileMap["SecondLifeLog"] = mDebugLog["SLLog"].asString(); - mFileMap["SettingsXml"] = mDebugLog["SettingsFilename"].asString(); - if(mDebugLog.has("CAFilename")) - { - LLCurl::setCAFile(mDebugLog["CAFilename"].asString()); - } - else - { - LLCurl::setCAFile(gDirUtilp->getCAFile()); - } - - llinfos << "Using log file from debug log " << mFileMap["SecondLifeLog"] << llendl; - llinfos << "Using settings file from debug log " << mFileMap["SettingsXml"] << llendl; + second_life_log_original = mDebugLog["SLLog"].asString(); + settings_file_original = mDebugLog["SettingsFilename"].asString(); } else { // Figure out the filename of the second life log - LLCurl::setCAFile(gDirUtilp->getCAFile()); - mFileMap["SecondLifeLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log"); - mFileMap["SettingsXml"] = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings.xml"); + second_life_log_original = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log"); + settings_file_original = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings.xml"); } - + if(mCrashInPreviousExec) { // Restarting after freeze. // 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; + second_life_log_original.replace(second_life_log_original.size() - 4, 4, ".old"); } + + std::string second_life_log = second_life_log_original; + std::string settings_file = settings_file_original; + second_life_log.insert(second_life_log.length() - 4, now); + settings_file.insert(settings_file.length() - 4, now); + if(LLFile::rename(second_life_log_original, second_life_log) == 0) + { + mFileMap["SecondLifeLog"] = second_life_log; + } + if(LLFile::rename(settings_file_original, settings_file) == 0) + { + mFileMap["SettingsXml"] = settings_file; + } +} + +void LLCrashLogger::gatherFiles() +{ + updateApplication("Gathering logs..."); + if(mDebugLog.has("CAFilename")) + { + LLCurl::setCAFile(mDebugLog["CAFilename"].asString()); + } + else + { + LLCurl::setCAFile(gDirUtilp->getCAFile()); + } + gatherPlatformSpecificFiles(); //Use the debug log to reconstruct the URL to send the crash report to @@ -230,7 +257,6 @@ void LLCrashLogger::gatherFiles() mAltCrashHost = "https://login.agni.lindenlab.com:12043/crash/report"; mCrashInfo["DebugLog"] = mDebugLog; - mFileMap["StatsLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stats.log"); updateApplication("Encoding files..."); @@ -405,5 +431,7 @@ bool LLCrashLogger::init() LLAPRFile::remove( marker_file ); } + findAndRenameLogFiles(); + return true; } diff --git a/indra/llcrashlogger/llcrashlogger.h b/indra/llcrashlogger/llcrashlogger.h index f8abe20597..a3cb17a958 100755 --- a/indra/llcrashlogger/llcrashlogger.h +++ b/indra/llcrashlogger/llcrashlogger.h @@ -48,6 +48,7 @@ public: S32 loadCrashBehaviorSetting(); void gatherFiles(); virtual void gatherPlatformSpecificFiles() {} + void findAndRenameLogFiles(); bool saveCrashBehaviorSetting(S32 crash_behavior); bool sendCrashLogs(); LLSD constructPostData(); -- cgit v1.2.3 From 671092bcbc1a565e8b1cd140d005f246d325adc7 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 3 Jun 2010 13:22:50 -0700 Subject: Strip invalid characters from log files before adding into crash log llsd. --- indra/llcrashlogger/llcrashlogger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcrashlogger') diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 078795f962..51e5f14bfe 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -255,7 +255,7 @@ void LLCrashLogger::gatherFiles() trimSLLog(crash_info); } - mCrashInfo[(*itr).first] = rawstr_to_utf8(crash_info); + mCrashInfo[(*itr).first] = LLStringFn::strip_invalid_xml(rawstr_to_utf8(crash_info)); } // Add minidump as binary. -- cgit v1.2.3 From 94a2a1a98bb22c88c87a6f1d3f5beb6bdc471d87 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Thu, 3 Jun 2010 18:21:06 -0700 Subject: Backed out renaming of log files (changeset 7357f4ef70df) executed: 'hg backout -r 7357f4ef70df --merge' --- indra/llcrashlogger/llcrashlogger.cpp | 88 ++++++++++++----------------------- indra/llcrashlogger/llcrashlogger.h | 1 - 2 files changed, 30 insertions(+), 59 deletions(-) (limited to 'indra/llcrashlogger') diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index a91cf530b5..078795f962 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -36,8 +36,6 @@ #include "llcrashlogger.h" #include "linden_common.h" -#include "lldate.h" -#include "llfile.h" #include "llstring.h" #include "indra_constants.h" // CRASH_BEHAVIOR_ASK, CRASH_SETTING_NAME #include "llerror.h" @@ -155,79 +153,54 @@ std::string getStartupStateFromLog(std::string& sllog) return startup_state; } -void LLCrashLogger::findAndRenameLogFiles() +void LLCrashLogger::gatherFiles() { - // Find and rename the relevant log files so they won't be stomped on if - // SL is restarted before user sends crash report. - - std::string now = "." + LLDate::now().asString(); - - std::string stats_log_original = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stats.log"); - std::string stats_log = stats_log_original; - stats_log.insert(stats_log.length() - 4, now); - if(LLFile::rename(stats_log_original, stats_log) == 0) - { - mFileMap["StatsLog"] = stats_log; - } - - std::string second_life_log_original; - std::string settings_file_original; + updateApplication("Gathering logs..."); - std::string db_file_name_original = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); - std::string db_file_name = db_file_name_original; - db_file_name.insert(db_file_name.length() - 4, now); - LLFile::rename(db_file_name_original, db_file_name); + // Figure out the filename of the debug log + std::string db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); std::ifstream debug_log_file(db_file_name.c_str()); + + // Look for it in the debug_info.log file if (debug_log_file.is_open()) { - LLSDSerialize::fromXML(mDebugLog, debug_log_file); + LLSDSerialize::fromXML(mDebugLog, debug_log_file); + mCrashInPreviousExec = mDebugLog["CrashNotHandled"].asBoolean(); - second_life_log_original = mDebugLog["SLLog"].asString(); - settings_file_original = mDebugLog["SettingsFilename"].asString(); + + mFileMap["SecondLifeLog"] = mDebugLog["SLLog"].asString(); + mFileMap["SettingsXml"] = mDebugLog["SettingsFilename"].asString(); + if(mDebugLog.has("CAFilename")) + { + LLCurl::setCAFile(mDebugLog["CAFilename"].asString()); + } + else + { + LLCurl::setCAFile(gDirUtilp->getCAFile()); + } + + llinfos << "Using log file from debug log " << mFileMap["SecondLifeLog"] << llendl; + llinfos << "Using settings file from debug log " << mFileMap["SettingsXml"] << llendl; } else { // Figure out the filename of the second life log - second_life_log_original = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log"); - settings_file_original = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings.xml"); + LLCurl::setCAFile(gDirUtilp->getCAFile()); + mFileMap["SecondLifeLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log"); + mFileMap["SettingsXml"] = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings.xml"); } - + if(mCrashInPreviousExec) { // Restarting after freeze. // Replace the log file ext with .old, since the // instance that launched this process has overwritten // SecondLife.log - second_life_log_original.replace(second_life_log_original.size() - 4, 4, ".old"); + std::string log_filename = mFileMap["SecondLifeLog"]; + log_filename.replace(log_filename.size() - 4, 4, ".old"); + mFileMap["SecondLifeLog"] = log_filename; } - - std::string second_life_log = second_life_log_original; - std::string settings_file = settings_file_original; - second_life_log.insert(second_life_log.length() - 4, now); - settings_file.insert(settings_file.length() - 4, now); - if(LLFile::rename(second_life_log_original, second_life_log) == 0) - { - mFileMap["SecondLifeLog"] = second_life_log; - } - if(LLFile::rename(settings_file_original, settings_file) == 0) - { - mFileMap["SettingsXml"] = settings_file; - } -} - -void LLCrashLogger::gatherFiles() -{ - updateApplication("Gathering logs..."); - if(mDebugLog.has("CAFilename")) - { - LLCurl::setCAFile(mDebugLog["CAFilename"].asString()); - } - else - { - LLCurl::setCAFile(gDirUtilp->getCAFile()); - } - gatherPlatformSpecificFiles(); //Use the debug log to reconstruct the URL to send the crash report to @@ -257,6 +230,7 @@ void LLCrashLogger::gatherFiles() mAltCrashHost = "https://login.agni.lindenlab.com:12043/crash/report"; mCrashInfo["DebugLog"] = mDebugLog; + mFileMap["StatsLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stats.log"); updateApplication("Encoding files..."); @@ -431,7 +405,5 @@ bool LLCrashLogger::init() LLAPRFile::remove( marker_file ); } - findAndRenameLogFiles(); - return true; } diff --git a/indra/llcrashlogger/llcrashlogger.h b/indra/llcrashlogger/llcrashlogger.h index a3cb17a958..f8abe20597 100755 --- a/indra/llcrashlogger/llcrashlogger.h +++ b/indra/llcrashlogger/llcrashlogger.h @@ -48,7 +48,6 @@ public: S32 loadCrashBehaviorSetting(); void gatherFiles(); virtual void gatherPlatformSpecificFiles() {} - void findAndRenameLogFiles(); bool saveCrashBehaviorSetting(S32 crash_behavior); bool sendCrashLogs(); LLSD constructPostData(); -- cgit v1.2.3