Add error logging and fix uploading for chrome crash reports
Adds some logging of parse errors in case there's a format mismatch in future.
Fixes detection of the minidump, was checking the wrong variable.
Modifies crash_sender to properly upload a Chrome dump, including all of the
extra options that get included, and identifies it as a Chrome and not ChromeOS
dump so that it shows up in the right lists server-side.
BUG=chromium:216523
TEST=loaded build of chrome with matching changes, verified about:crash causes
a dump to be created and placed in the right spot, and that it uploads
properly by crash_sender
Change-Id: I8a114ad6798f09f33b78df1680153c0412eabf45
Reviewed-on: https://gerrit.chromium.org/gerrit/59572
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
diff --git a/crash_reporter/crash_collector.cc b/crash_reporter/crash_collector.cc
index b433bec..d39d6f4 100644
--- a/crash_reporter/crash_collector.cc
+++ b/crash_reporter/crash_collector.cc
@@ -39,6 +39,8 @@
static const char kLsbRelease[] = "/etc/lsb-release";
static const char kShellPath[] = "/bin/sh";
static const char kSystemCrashPath[] = "/var/spool/crash";
+static const char kUploadVarPrefix[] = "upload_var_";
+static const char kUploadFilePrefix[] = "upload_file_";
// Normally this path is not used. Unfortunately, there are a few edge cases
// where we need this. Any process that runs as kDefaultUserName that crashes
// is consider a "user crash". That includes the initial Chrome browser that
@@ -479,6 +481,18 @@
extra_metadata_.append(StringPrintf("%s=%s\n", key.c_str(), value.c_str()));
}
+void CrashCollector::AddCrashMetaUploadFile(const std::string &key,
+ const std::string &path) {
+ if (!path.empty())
+ AddCrashMetaData(kUploadFilePrefix + key, path);
+}
+
+void CrashCollector::AddCrashMetaUploadData(const std::string &key,
+ const std::string &value) {
+ if (!value.empty())
+ AddCrashMetaData(kUploadVarPrefix + key, value);
+}
+
void CrashCollector::WriteCrashMetaData(const FilePath &meta_path,
const std::string &exec_name,
const std::string &payload_path) {