Customize the 'platform' crash key value for ARM builds (see issue #2981, see issue #2773)

This commit is contained in:
Marshall Greenblatt 2021-03-31 10:33:45 -04:00
parent 19ac738b77
commit 4960970dbd
1 changed files with 31 additions and 17 deletions

View File

@ -127,7 +127,7 @@ index bcf172e645a2..f879aa745adf 100644
// on the given |command_line|.
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line);
diff --git components/crash/core/app/breakpad_linux.cc components/crash/core/app/breakpad_linux.cc
index 9e850c0380b8..e06d0a26617a 100644
index 9e850c0380b8..559d93010edf 100644
--- components/crash/core/app/breakpad_linux.cc
+++ components/crash/core/app/breakpad_linux.cc
@@ -28,6 +28,7 @@
@ -147,29 +147,37 @@ index 9e850c0380b8..e06d0a26617a 100644
info.process_start_time = g_process_start_time;
info.oom_size = base::g_oom_size;
info.pid = g_pid;
@@ -1733,10 +1734,19 @@ void HandleCrashDump(const BreakpadInfo& info) {
@@ -1733,10 +1734,27 @@ 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.AddBoundary();
+ writer.AddPairString("version", version);
writer.AddBoundary();
- writer.AddPairString("ver", version);
+
+#if defined(ARCH_CPU_ARM_FAMILY)
+#if defined(ARCH_CPU_32_BITS)
+ const char* platform = "linuxarm";
+#elif defined(ARCH_CPU_64_BITS)
+ const char* platform = "linuxarm64";
+#endif
+#else
+#if defined(ARCH_CPU_32_BITS)
+ const char* platform = "linux32";
+#elif defined(ARCH_CPU_64_BITS)
+ const char* platform = "linux64";
+#endif
+#endif // defined(ARCH_CPU_ARM_FAMILY)
+ writer.AddPairString("platform", platform);
+ writer.AddBoundary();
writer.AddBoundary();
+
if (info.pid > 0) {
char pid_value_buf[kUint64StringSize];
uint64_t pid_value_len = my_uint64_len(info.pid);
@@ -1853,6 +1863,9 @@ void HandleCrashDump(const BreakpadInfo& info) {
@@ -1853,6 +1871,9 @@ void HandleCrashDump(const BreakpadInfo& info) {
crash_reporter::internal::TransitionalCrashKeyStorage;
CrashKeyStorage::Iterator crash_key_iterator(*info.crash_keys);
const CrashKeyStorage::Entry* entry;
@ -179,7 +187,7 @@ index 9e850c0380b8..e06d0a26617a 100644
while ((entry = crash_key_iterator.Next())) {
size_t key_size, value_size;
// Check for malformed messages.
@@ -1863,7 +1876,13 @@ void HandleCrashDump(const BreakpadInfo& info) {
@@ -1863,7 +1884,13 @@ void HandleCrashDump(const BreakpadInfo& info) {
? CrashKeyStorage::value_size - 1
: my_strlen(entry->value);
@ -363,7 +371,7 @@ index 5117ded1e214..0d86e0363315 100644
->set_system_crash_reporter_forwarding(crashpad::TriState::kDisabled);
}
diff --git components/crash/core/app/crashpad_mac.mm components/crash/core/app/crashpad_mac.mm
index eb675321436a..4e74af742ed5 100644
index eb675321436a..9f95323b9b35 100644
--- components/crash/core/app/crashpad_mac.mm
+++ components/crash/core/app/crashpad_mac.mm
@@ -16,12 +16,15 @@
@ -412,7 +420,7 @@ index eb675321436a..4e74af742ed5 100644
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Empty means stable.
@@ -68,12 +81,16 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() {
@@ -68,12 +81,20 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() {
process_annotations["channel"] = base::SysNSStringToUTF8(channel);
}
@ -430,11 +438,15 @@ index eb675321436a..4e74af742ed5 100644
+ }
- process_annotations["plat"] = std::string("OS X");
+#if defined(ARCH_CPU_ARM64)
+ process_annotations["platform"] = std::string("macosarm64");
+#else
+ process_annotations["platform"] = std::string("macos");
+#endif
} // @autoreleasepool
return process_annotations;
}();
@@ -133,10 +150,10 @@ base::FilePath PlatformCrashpadInitialization(
@@ -133,10 +154,10 @@ base::FilePath PlatformCrashpadInitialization(
if (initial_client) {
@autoreleasepool {
@ -449,7 +461,7 @@ index eb675321436a..4e74af742ed5 100644
// Is there a way to recover if this fails?
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
@@ -165,6 +182,12 @@ base::FilePath PlatformCrashpadInitialization(
@@ -165,6 +186,12 @@ base::FilePath PlatformCrashpadInitialization(
"--reset-own-crash-exception-port-to-system-default");
}
@ -463,7 +475,7 @@ index eb675321436a..4e74af742ed5 100644
handler_path, database_path, metrics_path, url,
GetProcessSimpleAnnotations(), arguments, true, false);
diff --git components/crash/core/app/crashpad_win.cc components/crash/core/app/crashpad_win.cc
index c66a6dfc6f5d..2d80782ab341 100644
index c66a6dfc6f5d..0a612b0afaa6 100644
--- components/crash/core/app/crashpad_win.cc
+++ components/crash/core/app/crashpad_win.cc
@@ -36,8 +36,8 @@ void GetPlatformCrashpadAnnotations(
@ -477,7 +489,7 @@ index c66a6dfc6f5d..2d80782ab341 100644
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Empty means stable.
const bool allow_empty_channel = true;
@@ -49,9 +49,9 @@ void GetPlatformCrashpadAnnotations(
@@ -49,9 +49,11 @@ void GetPlatformCrashpadAnnotations(
if (!special_build.empty())
(*annotations)["special"] = base::WideToUTF8(special_build);
#if defined(ARCH_CPU_X86)
@ -486,10 +498,12 @@ index c66a6dfc6f5d..2d80782ab341 100644
#elif defined(ARCH_CPU_X86_64)
- (*annotations)["plat"] = std::string("Win64");
+ (*annotations)["platform"] = std::string("win64");
+#elif defined(ARCH_CPU_ARM64)
+ (*annotations)["platform"] = std::string("winarm64");
#endif
}
@@ -66,7 +66,9 @@ base::FilePath PlatformCrashpadInitialization(
@@ -66,7 +68,9 @@ base::FilePath PlatformCrashpadInitialization(
base::FilePath metrics_path; // Only valid in the browser process.
const char kPipeNameVar[] = "CHROME_CRASHPAD_PIPE_NAME";
@ -499,7 +513,7 @@ index c66a6dfc6f5d..2d80782ab341 100644
std::unique_ptr<base::Environment> env(base::Environment::Create());
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
@@ -87,9 +89,11 @@ base::FilePath PlatformCrashpadInitialization(
@@ -87,9 +91,11 @@ base::FilePath PlatformCrashpadInitialization(
std::string url = crash_reporter_client->GetUploadUrl();
@ -511,7 +525,7 @@ index c66a6dfc6f5d..2d80782ab341 100644
base::FilePath exe_file(exe_path);
if (exe_file.empty()) {
@@ -100,13 +104,14 @@ base::FilePath PlatformCrashpadInitialization(
@@ -100,13 +106,14 @@ base::FilePath PlatformCrashpadInitialization(
exe_file = base::FilePath(exe_file_path);
}
@ -531,7 +545,7 @@ index c66a6dfc6f5d..2d80782ab341 100644
if (!user_data_dir.empty()) {
start_arguments.push_back(std::string("--user-data-dir=") +
user_data_dir);
@@ -117,9 +122,12 @@ base::FilePath PlatformCrashpadInitialization(
@@ -117,9 +124,12 @@ base::FilePath PlatformCrashpadInitialization(
start_arguments.push_back("/prefetch:7");
} else {
base::FilePath exe_dir = exe_file.DirName();