breakpad_treat_node_processes_as_browser_processes.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Jeremy Apthorp <[email protected]>
  3. Date: Thu, 30 Apr 2020 17:04:13 -0700
  4. Subject: breakpad: treat node processes as browser processes
  5. On Linux, to avoid the need to pass breakpad FDs to child node processes
  6. spawned by child_process.fork(), each child process must re-initialize
  7. breakpad independently, as a "browser" process. This patches
  8. //components/crash so that it will correctly report 'ptype=node' as a
  9. crash annotation.
  10. diff --git a/components/crash/core/app/breakpad_linux.cc b/components/crash/core/app/breakpad_linux.cc
  11. index a3599b4403b7be33cb4aa300746c3ade962627de..342f16a4c8418c1e56703d8969d0f31d834ad74c 100644
  12. --- a/components/crash/core/app/breakpad_linux.cc
  13. +++ b/components/crash/core/app/breakpad_linux.cc
  14. @@ -719,8 +719,13 @@ bool CrashDone(const MinidumpDescriptor& minidump,
  15. log_path[log_path_len] = '\0';
  16. info.log_filename = log_path;
  17. #endif
  18. - info.process_type = "browser";
  19. - info.process_type_length = 7;
  20. + if (g_is_node) {
  21. + info.process_type = "node";
  22. + info.process_type_length = 4;
  23. + } else {
  24. + info.process_type = "browser";
  25. + info.process_type_length = 7;
  26. + }
  27. info.distro = base::g_linux_distro;
  28. info.distro_length = my_strlen(base::g_linux_distro);
  29. info.upload = upload;
  30. @@ -2041,8 +2046,13 @@ void InitCrashReporter(const std::string& process_type) {
  31. process_type == kWebViewSingleProcessType ||
  32. process_type == kBrowserProcessType ||
  33. #endif
  34. + process_type == "node" ||
  35. process_type.empty();
  36. + if (process_type == "node") {
  37. + g_is_node = true;
  38. + }
  39. +
  40. #if !defined(OS_CHROMEOS)
  41. SetUploadURL(GetCrashReporterClient()->GetUploadUrl());
  42. #endif