From b20c9ef8e90a7e7584b83faa25986b4c08021389 Mon Sep 17 00:00:00 2001 From: Luigi Semenzato Date: Tue, 17 Dec 2013 18:12:09 -0800 Subject: [PATCH] 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 Tested-by: Luigi Semenzato Commit-Queue: Luigi Semenzato --- crash_reporter/kernel_warning_collector.cc | 18 +++++++++--------- crash_reporter/kernel_warning_collector.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crash_reporter/kernel_warning_collector.cc b/crash_reporter/kernel_warning_collector.cc index f8188c7fb..34d29a58f 100644 --- a/crash_reporter/kernel_warning_collector.cc +++ b/crash_reporter/kernel_warning_collector.cc @@ -28,19 +28,19 @@ KernelWarningCollector::~KernelWarningCollector() { } 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 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 @@ bool KernelWarningCollector::Collect() { } 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 @@ bool KernelWarningCollector::Collect() { 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 2f8c793b8..7a5041617 100644 --- a/crash_reporter/kernel_warning_collector.h +++ b/crash_reporter/kernel_warning_collector.h @@ -24,8 +24,8 @@ class KernelWarningCollector : public CrashCollector { 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_