Push full warning signature instead of its hash only.
A previous change computed a signature including the
function name and offset, but failed to send it to
the crash server. This fixes the problem.
BUG=chromium:328948
TEST=none
Change-Id: I2ff2e548ee1a8feebd6352433c9bd0f96076f15d
Reviewed-on: https://chromium-review.googlesource.com/180561
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
diff --git a/crash_reporter/kernel_warning_collector.cc b/crash_reporter/kernel_warning_collector.cc
index f8188c7..34d29a5 100644
--- a/crash_reporter/kernel_warning_collector.cc
+++ b/crash_reporter/kernel_warning_collector.cc
@@ -28,19 +28,19 @@
}
bool KernelWarningCollector::LoadKernelWarning(std::string *content,
- std::string *hash_string) {
+ std::string *signature) {
FilePath kernel_warning_path(kKernelWarningPath);
if (!base::ReadFileToString(kernel_warning_path, content)) {
LOG(ERROR) << "Could not open " << kKernelWarningPath;
return false;
}
- /* Verify that the first line contains an 8-digit hex hash. */
- *hash_string = content->substr(0, 8);
- std::vector<uint8> output;
- if (!base::HexStringToBytes(*hash_string, &output)) {
- LOG(ERROR) << "Bad hash " << *hash_string << " in " << kKernelWarningPath;
+ /* The signature is in the first line. */
+ std::string::size_type end_position = content->find('\n');
+ if (end_position == std::string::npos) {
+ LOG(ERROR) << "unexpected kernel warning format";
return false;
}
+ *signature = content->substr(0, end_position);
return true;
}
@@ -62,8 +62,8 @@
}
std::string kernel_warning;
- std::string warning_hash;
- if (!LoadKernelWarning(&kernel_warning, &warning_hash)) {
+ std::string warning_signature;
+ if (!LoadKernelWarning(&kernel_warning, &warning_signature)) {
return true;
}
@@ -89,7 +89,7 @@
return true;
}
- AddCrashMetaData(kKernelWarningSignatureKey, warning_hash);
+ AddCrashMetaData(kKernelWarningSignatureKey, warning_signature);
WriteCrashMetaData(
root_crash_directory.Append(
StringPrintf("%s.meta", dump_basename.c_str())),
diff --git a/crash_reporter/kernel_warning_collector.h b/crash_reporter/kernel_warning_collector.h
index 2f8c793..7a50416 100644
--- a/crash_reporter/kernel_warning_collector.h
+++ b/crash_reporter/kernel_warning_collector.h
@@ -24,8 +24,8 @@
friend class KernelWarningCollectorTest;
FRIEND_TEST(KernelWarningCollectorTest, CollectOK);
- // Reads the full content of the kernel warn dump and the warning hash.
- bool LoadKernelWarning(std::string *hash, std::string *content);
+ // Reads the full content of the kernel warn dump and its signature.
+ bool LoadKernelWarning(std::string *content, std::string *signature);
};
#endif // _CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_