From 18ce862ad8c379b592be99bc7721a21301f00f3a Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 25 Jan 2017 13:37:12 -0500 Subject: [PATCH] Standardize product/version/platform crash keys (issue #1995) --- patch/patches/crashpad_1995.patch | 65 ++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/patch/patches/crashpad_1995.patch b/patch/patches/crashpad_1995.patch index 213605987..8047ead1b 100644 --- a/patch/patches/crashpad_1995.patch +++ b/patch/patches/crashpad_1995.patch @@ -203,7 +203,7 @@ index c658fa9..8c4a145 100644 g_crash_helper_enabled = true; return true; diff --git components/crash/content/app/breakpad_linux.cc components/crash/content/app/breakpad_linux.cc -index 6e5058e..3dd2b56 100644 +index 6e5058e..f2309ad 100644 --- components/crash/content/app/breakpad_linux.cc +++ components/crash/content/app/breakpad_linux.cc @@ -29,6 +29,7 @@ @@ -240,7 +240,29 @@ index 6e5058e..3dd2b56 100644 "--timeout=10", // Set a timeout so we don't hang forever. "--tries=1", // Don't retry if the upload fails. "-O", // output reply to fd 3 -@@ -1906,6 +1908,17 @@ void InitCrashReporter(const std::string& process_type) { +@@ -1612,10 +1614,19 @@ void HandleCrashDump(const BreakpadInfo& info) { + GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version); + + writer.AddBoundary(); +- writer.AddPairString("prod", product_name); ++ writer.AddPairString("product", product_name); + writer.AddBoundary(); +- writer.AddPairString("ver", version); ++ writer.AddPairString("version", version); + writer.AddBoundary(); ++ ++#if defined(ARCH_CPU_32_BITS) ++ const char* platform = "linux32"; ++#elif defined(ARCH_CPU_64_BITS) ++ const char* platform = "linux64"; ++#endif ++ writer.AddPairString("platform", platform); ++ writer.AddBoundary(); ++ + if (info.pid > 0) { + char pid_value_buf[kUint64StringSize]; + uint64_t pid_value_len = my_uint64_len(info.pid); +@@ -1906,6 +1917,17 @@ void InitCrashReporter(const std::string& process_type) { PostEnableBreakpadInitialization(); } @@ -389,7 +411,7 @@ index 25ae505..d923b39 100644 } // namespace crash_reporter diff --git components/crash/content/app/crashpad_mac.mm components/crash/content/app/crashpad_mac.mm -index 7df66ea..1e24110 100644 +index 7df66ea..4ee709a 100644 --- components/crash/content/app/crashpad_mac.mm +++ components/crash/content/app/crashpad_mac.mm @@ -16,11 +16,14 @@ @@ -446,15 +468,15 @@ index 7df66ea..1e24110 100644 + NSString* product = base::mac::ObjCCast([outer_bundle + objectForInfoDictionaryKey:base::mac::CFToNSCast( + kCFBundleNameKey)]); -+ process_annotations["prod"] = ++ process_annotations["product"] = + base::SysNSStringToUTF8(product).append("_Mac"); + } else { -+ process_annotations["prod"] = product_name; ++ process_annotations["product"] = product_name; + } #if defined(GOOGLE_CHROME_BUILD) NSString* channel = base::mac::ObjCCast( -@@ -73,10 +88,14 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, +@@ -73,12 +88,16 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, } #endif @@ -466,13 +488,16 @@ index 7df66ea..1e24110 100644 + NSString* version = + base::mac::ObjCCast([base::mac::FrameworkBundle() + objectForInfoDictionaryKey:@"CFBundleShortVersionString"]); -+ process_annotations["ver"] = base::SysNSStringToUTF8(version); ++ process_annotations["version"] = base::SysNSStringToUTF8(version); + } else { -+ process_annotations["ver"] = product_version; ++ process_annotations["version"] = product_version; + } - process_annotations["plat"] = std::string("OS X"); +- process_annotations["plat"] = std::string("OS X"); ++ process_annotations["platform"] = std::string("macos"); + std::vector arguments; + if (!browser_process) { @@ -90,6 +109,12 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, "--reset-own-crash-exception-port-to-system-default"); } @@ -487,9 +512,29 @@ index 7df66ea..1e24110 100644 bool result = crashpad_client.StartHandler(handler_path, database_path, diff --git components/crash/content/app/crashpad_win.cc components/crash/content/app/crashpad_win.cc -index 1e9c06c..8ed020d 100644 +index 1e9c06c..92ad937 100644 --- components/crash/content/app/crashpad_win.cc +++ components/crash/content/app/crashpad_win.cc +@@ -41,15 +41,15 @@ void GetPlatformCrashpadAnnotations( + base::string16 product_name, version, special_build, channel_name; + crash_reporter_client->GetProductNameAndVersion( + exe_file, &product_name, &version, &special_build, &channel_name); +- (*annotations)["prod"] = base::UTF16ToUTF8(product_name); +- (*annotations)["ver"] = base::UTF16ToUTF8(version); ++ (*annotations)["product"] = base::UTF16ToUTF8(product_name); ++ (*annotations)["version"] = base::UTF16ToUTF8(version); + (*annotations)["channel"] = base::UTF16ToUTF8(channel_name); + if (!special_build.empty()) + (*annotations)["special"] = base::UTF16ToUTF8(special_build); + #if defined(ARCH_CPU_X86) +- (*annotations)["plat"] = std::string("Win32"); ++ (*annotations)["platform"] = std::string("win32"); + #elif defined(ARCH_CPU_X86_64) +- (*annotations)["plat"] = std::string("Win64"); ++ (*annotations)["platform"] = std::string("win64"); + #endif + } + @@ -81,7 +81,7 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, #if defined(GOOGLE_CHROME_BUILD) std::string url = "https://clients2.google.com/cr/report";