2019-07-16 19:59:21 +02:00
|
|
|
diff --git chrome/chrome_elf/BUILD.gn chrome/chrome_elf/BUILD.gn
|
2023-01-30 18:43:54 +01:00
|
|
|
index e2cb049c1ce6c..8c2b6242894b3 100644
|
2019-07-16 19:59:21 +02:00
|
|
|
--- chrome/chrome_elf/BUILD.gn
|
|
|
|
+++ chrome/chrome_elf/BUILD.gn
|
2016-12-12 11:05:29 +01:00
|
|
|
@@ -7,6 +7,7 @@
|
|
|
|
|
|
|
|
import("//build/config/compiler/compiler.gni")
|
|
|
|
import("//build/config/win/manifest.gni")
|
|
|
|
+import("//cef/libcef/features/features.gni")
|
|
|
|
import("//chrome/process_version_rc_template.gni")
|
|
|
|
import("//testing/test.gni")
|
|
|
|
|
2022-07-21 19:26:10 +02:00
|
|
|
@@ -106,9 +107,6 @@ source_set("constants") {
|
2016-12-12 11:05:29 +01:00
|
|
|
|
|
|
|
static_library("crash") {
|
|
|
|
sources = [
|
2019-07-16 19:59:21 +02:00
|
|
|
- "../app/chrome_crash_reporter_client_win.cc",
|
|
|
|
- "../app/chrome_crash_reporter_client_win.h",
|
|
|
|
- "../common/chrome_result_codes.h",
|
2016-12-12 11:05:29 +01:00
|
|
|
"crash/crash_helper.cc",
|
|
|
|
"crash/crash_helper.h",
|
|
|
|
]
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -117,6 +115,7 @@ static_library("crash") {
|
2016-12-12 11:05:29 +01:00
|
|
|
":hook_util",
|
2017-09-06 23:40:58 +02:00
|
|
|
"//base", # This needs to go. DEP of app, crash_keys, client.
|
2016-12-12 11:05:29 +01:00
|
|
|
"//base:base_static", # pe_image
|
|
|
|
+ "//cef/libcef/features",
|
|
|
|
"//chrome/install_static:install_static_util",
|
2020-04-14 21:31:00 +02:00
|
|
|
"//components/crash/core/app",
|
2016-12-12 11:05:29 +01:00
|
|
|
"//components/crash/core/common", # crash_keys
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -124,6 +123,17 @@ static_library("crash") {
|
2018-02-15 01:12:09 +01:00
|
|
|
"//content/public/common:result_codes",
|
2017-09-06 23:40:58 +02:00
|
|
|
"//third_party/crashpad/crashpad/client", # DumpWithoutCrash
|
2017-07-06 22:39:37 +02:00
|
|
|
]
|
|
|
|
+
|
|
|
|
+ if (enable_cef) {
|
|
|
|
+ deps += [ "//cef:chrome_elf_set" ]
|
|
|
|
+ include_dirs = [ "//cef" ]
|
|
|
|
+ } else {
|
|
|
|
+ sources += [
|
|
|
|
+ "//chrome/app/chrome_crash_reporter_client_win.cc",
|
|
|
|
+ "//chrome/app/chrome_crash_reporter_client_win.h",
|
|
|
|
+ "//chrome/common/chrome_result_codes.h",
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
2018-07-02 19:11:49 +02:00
|
|
|
source_set("dll_hash") {
|
2019-07-16 19:59:21 +02:00
|
|
|
diff --git chrome/chrome_elf/crash/crash_helper.cc chrome/chrome_elf/crash/crash_helper.cc
|
2022-09-26 21:30:45 +02:00
|
|
|
index 27a803784eb9e..a8b033f475cb4 100644
|
2019-07-16 19:59:21 +02:00
|
|
|
--- chrome/chrome_elf/crash/crash_helper.cc
|
|
|
|
+++ chrome/chrome_elf/crash/crash_helper.cc
|
2016-12-12 11:05:29 +01:00
|
|
|
@@ -11,12 +11,17 @@
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
#include "chrome/app/chrome_crash_reporter_client_win.h"
|
2019-07-16 19:59:21 +02:00
|
|
|
#include "chrome/chrome_elf/hook_util/hook_util.h"
|
2020-04-14 21:31:00 +02:00
|
|
|
#include "components/crash/core/app/crashpad.h"
|
2016-12-12 11:05:29 +01:00
|
|
|
#include "components/crash/core/common/crash_keys.h"
|
|
|
|
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
|
|
|
|
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+#include "cef/libcef/common/crash_reporter_client.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
// Crash handling from elf is only enabled for the chrome.exe process.
|
2020-03-04 01:29:39 +01:00
|
|
|
@@ -77,7 +82,11 @@ bool InitializeCrashReporting() {
|
2016-12-12 11:05:29 +01:00
|
|
|
g_crash_reports = new std::vector<crash_reporter::Report>;
|
|
|
|
g_set_unhandled_exception_filter = new elf_hook::IATHook();
|
|
|
|
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ CefCrashReporterClient::InitializeCrashReportingForProcess();
|
|
|
|
+#else
|
|
|
|
ChromeCrashReporterClient::InitializeCrashReportingForProcess();
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
g_crash_helper_enabled = true;
|
|
|
|
return true;
|
2019-07-16 19:59:21 +02:00
|
|
|
diff --git chrome/common/crash_keys.cc chrome/common/crash_keys.cc
|
2023-02-27 19:52:38 +01:00
|
|
|
index 819bffbbe47c1..c00e3e6925cfe 100644
|
2019-07-16 19:59:21 +02:00
|
|
|
--- chrome/common/crash_keys.cc
|
|
|
|
+++ chrome/common/crash_keys.cc
|
2022-05-19 12:28:44 +02:00
|
|
|
@@ -6,6 +6,8 @@
|
2019-07-16 19:59:21 +02:00
|
|
|
|
2022-05-19 12:28:44 +02:00
|
|
|
#include <deque>
|
2019-07-16 19:59:21 +02:00
|
|
|
|
|
|
|
+#include <iterator>
|
|
|
|
+
|
|
|
|
#include "base/base_switches.h"
|
|
|
|
#include "base/command_line.h"
|
2022-05-19 12:28:44 +02:00
|
|
|
#include "base/format_macros.h"
|
2023-02-27 19:52:38 +01:00
|
|
|
@@ -90,8 +92,10 @@ void HandleEnableDisableFeatures(const base::CommandLine& command_line) {
|
|
|
|
"commandline-disabled-feature");
|
2021-08-20 01:40:49 +02:00
|
|
|
}
|
2019-07-16 19:59:21 +02:00
|
|
|
|
2021-08-20 01:40:49 +02:00
|
|
|
+} // namespace
|
|
|
|
+
|
2019-09-04 17:13:32 +02:00
|
|
|
// Return true if we DON'T want to upload this flag to the crash server.
|
2021-08-20 01:40:49 +02:00
|
|
|
-bool IsBoringSwitch(const std::string& flag) {
|
2019-07-16 19:59:21 +02:00
|
|
|
+bool IsBoringChromeSwitch(const std::string& flag) {
|
|
|
|
static const char* const kIgnoreSwitches[] = {
|
|
|
|
switches::kEnableLogging,
|
|
|
|
switches::kFlagSwitchesBegin,
|
2023-02-27 19:52:38 +01:00
|
|
|
@@ -149,11 +153,9 @@ bool IsBoringSwitch(const std::string& flag) {
|
2021-08-20 01:40:49 +02:00
|
|
|
return false;
|
2019-07-16 19:59:21 +02:00
|
|
|
}
|
|
|
|
|
2021-08-20 01:40:49 +02:00
|
|
|
-} // namespace
|
|
|
|
-
|
2019-07-16 19:59:21 +02:00
|
|
|
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) {
|
2021-08-20 01:40:49 +02:00
|
|
|
HandleEnableDisableFeatures(command_line);
|
|
|
|
- SetSwitchesFromCommandLine(command_line, &IsBoringSwitch);
|
|
|
|
+ SetSwitchesFromCommandLine(command_line, &IsBoringChromeSwitch);
|
2019-07-16 19:59:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetActiveExtensions(const std::set<std::string>& extensions) {
|
|
|
|
diff --git chrome/common/crash_keys.h chrome/common/crash_keys.h
|
2022-09-26 21:30:45 +02:00
|
|
|
index d802db81c88ef..f78029680e366 100644
|
2019-07-16 19:59:21 +02:00
|
|
|
--- chrome/common/crash_keys.h
|
|
|
|
+++ chrome/common/crash_keys.h
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -16,6 +16,10 @@ class CommandLine;
|
2019-07-16 19:59:21 +02:00
|
|
|
|
|
|
|
namespace crash_keys {
|
|
|
|
|
|
|
|
+// Returns true if the specified command-line flag should be excluded from
|
|
|
|
+// crash reporting.
|
|
|
|
+bool IsBoringChromeSwitch(const std::string& flag);
|
|
|
|
+
|
|
|
|
// Sets the kNumSwitches key and the set of keys named using kSwitchFormat based
|
|
|
|
// on the given |command_line|.
|
|
|
|
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line);
|
2020-04-14 21:31:00 +02:00
|
|
|
diff --git components/crash/core/app/crash_reporter_client.cc components/crash/core/app/crash_reporter_client.cc
|
2022-09-26 21:30:45 +02:00
|
|
|
index 284dd099122df..c09c614c11283 100644
|
2020-04-14 21:31:00 +02:00
|
|
|
--- components/crash/core/app/crash_reporter_client.cc
|
|
|
|
+++ components/crash/core/app/crash_reporter_client.cc
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -93,7 +93,7 @@ bool CrashReporterClient::GetShouldDumpLargerDumps() {
|
2017-01-12 17:44:35 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-01-25 21:26:51 +01:00
|
|
|
-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
|
|
|
+#if BUILDFLAG(IS_POSIX)
|
2017-01-12 17:44:35 +01:00
|
|
|
void CrashReporterClient::GetProductNameAndVersion(const char** product_name,
|
|
|
|
const char** version) {
|
|
|
|
}
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -102,6 +102,7 @@ void CrashReporterClient::GetProductNameAndVersion(std::string* product_name,
|
2018-05-21 14:54:08 +02:00
|
|
|
std::string* version,
|
|
|
|
std::string* channel) {}
|
2017-01-12 17:44:35 +01:00
|
|
|
|
2022-01-25 21:26:51 +01:00
|
|
|
+#if !BUILDFLAG(IS_MAC)
|
2017-01-12 17:44:35 +01:00
|
|
|
base::FilePath CrashReporterClient::GetReporterLogFilename() {
|
|
|
|
return base::FilePath();
|
|
|
|
}
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -111,6 +112,7 @@ bool CrashReporterClient::HandleCrashDump(const char* crashdump_filename,
|
2017-01-12 17:44:35 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
+#endif
|
|
|
|
|
2022-01-25 21:26:51 +01:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2021-03-04 23:36:57 +01:00
|
|
|
bool CrashReporterClient::GetCrashDumpLocation(std::wstring* crash_dir) {
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -145,6 +147,28 @@ bool CrashReporterClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) {
|
2018-04-19 17:44:42 +02:00
|
|
|
return false;
|
2016-12-12 11:05:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+bool CrashReporterClient::EnableBreakpadForProcess(
|
|
|
|
+ const std::string& process_type) {
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void CrashReporterClient::GetCrashOptionalArguments(
|
|
|
|
+ std::vector<std::string>* arguments) {
|
|
|
|
+}
|
|
|
|
+
|
2022-01-25 21:26:51 +01:00
|
|
|
+#if BUILDFLAG(IS_WIN)
|
2021-03-04 23:36:57 +01:00
|
|
|
+std::wstring CrashReporterClient::GetCrashExternalHandler(
|
|
|
|
+ const std::wstring& exe_dir) {
|
2016-12-12 11:05:29 +01:00
|
|
|
+ return exe_dir + L"\\crashpad_handler.exe";
|
|
|
|
+}
|
|
|
|
+#endif
|
2017-02-06 20:23:59 +01:00
|
|
|
+
|
2022-01-25 21:26:51 +01:00
|
|
|
+#if BUILDFLAG(IS_MAC)
|
2017-02-06 20:23:59 +01:00
|
|
|
+bool CrashReporterClient::EnableBrowserCrashForwarding() {
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+#endif
|
2016-12-12 11:05:29 +01:00
|
|
|
+
|
2022-01-25 21:26:51 +01:00
|
|
|
#if BUILDFLAG(IS_ANDROID)
|
2019-03-13 22:27:37 +01:00
|
|
|
unsigned int CrashReporterClient::GetCrashDumpPercentage() {
|
2019-01-17 10:56:52 +01:00
|
|
|
return 100;
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -207,9 +231,4 @@ bool CrashReporterClient::ShouldMonitorCrashHandlerExpensively() {
|
2018-04-19 17:44:42 +02:00
|
|
|
return false;
|
2016-12-12 11:05:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
-bool CrashReporterClient::EnableBreakpadForProcess(
|
|
|
|
- const std::string& process_type) {
|
|
|
|
- return false;
|
2022-03-15 20:42:15 +01:00
|
|
|
-}
|
|
|
|
-
|
2016-12-12 11:05:29 +01:00
|
|
|
} // namespace crash_reporter
|
2020-04-14 21:31:00 +02:00
|
|
|
diff --git components/crash/core/app/crash_reporter_client.h components/crash/core/app/crash_reporter_client.h
|
2023-04-26 21:55:59 +02:00
|
|
|
index a604df7a5ea6a..618fbde10a65c 100644
|
2020-04-14 21:31:00 +02:00
|
|
|
--- components/crash/core/app/crash_reporter_client.h
|
|
|
|
+++ components/crash/core/app/crash_reporter_client.h
|
2023-04-26 21:55:59 +02:00
|
|
|
@@ -7,7 +7,9 @@
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2016-12-12 11:05:29 +01:00
|
|
|
|
2018-02-15 01:12:09 +01:00
|
|
|
+#include <map>
|
2016-12-12 11:05:29 +01:00
|
|
|
#include <string>
|
|
|
|
+#include <vector>
|
|
|
|
|
|
|
|
#include "build/build_config.h"
|
2021-03-04 23:36:57 +01:00
|
|
|
|
2023-04-26 21:55:59 +02:00
|
|
|
@@ -96,7 +98,7 @@ class CrashReporterClient {
|
2022-01-25 21:26:51 +01:00
|
|
|
virtual bool GetShouldDumpLargerDumps();
|
2017-01-12 17:44:35 +01:00
|
|
|
#endif
|
|
|
|
|
2022-01-25 21:26:51 +01:00
|
|
|
-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
|
|
|
+#if BUILDFLAG(IS_POSIX)
|
2017-01-12 17:44:35 +01:00
|
|
|
// Returns a textual description of the product type and version to include
|
|
|
|
// in the crash report. Neither out parameter should be set to NULL.
|
2018-04-19 17:44:42 +02:00
|
|
|
// TODO(jperaza): Remove the 2-parameter overload of this method once all
|
2023-04-26 21:55:59 +02:00
|
|
|
@@ -107,6 +109,7 @@ class CrashReporterClient {
|
2018-05-21 14:54:08 +02:00
|
|
|
std::string* version,
|
|
|
|
std::string* channel);
|
2017-01-12 17:44:35 +01:00
|
|
|
|
2022-01-25 21:26:51 +01:00
|
|
|
+#if !BUILDFLAG(IS_MAC)
|
2017-01-12 17:44:35 +01:00
|
|
|
virtual base::FilePath GetReporterLogFilename();
|
|
|
|
|
|
|
|
// Custom crash minidump handler after the minidump is generated.
|
2023-04-26 21:55:59 +02:00
|
|
|
@@ -116,6 +119,7 @@ class CrashReporterClient {
|
2017-01-12 17:44:35 +01:00
|
|
|
// libc nor allocate memory normally.
|
2019-07-16 19:59:21 +02:00
|
|
|
virtual bool HandleCrashDump(const char* crashdump_filename,
|
|
|
|
uint64_t crash_pid);
|
2018-02-15 01:12:09 +01:00
|
|
|
+#endif
|
2018-03-20 21:15:08 +01:00
|
|
|
#endif
|
2017-01-12 17:44:35 +01:00
|
|
|
|
|
|
|
// The location where minidump files should be written. Returns true if
|
2023-04-26 21:55:59 +02:00
|
|
|
@@ -213,6 +217,20 @@ class CrashReporterClient {
|
2016-12-12 11:05:29 +01:00
|
|
|
|
|
|
|
// Returns true if breakpad should run in the given process type.
|
|
|
|
virtual bool EnableBreakpadForProcess(const std::string& process_type);
|
|
|
|
+
|
|
|
|
+ // Populate |arguments| with additional optional arguments.
|
|
|
|
+ virtual void GetCrashOptionalArguments(std::vector<std::string>* arguments);
|
|
|
|
+
|
2022-01-25 21:26:51 +01:00
|
|
|
+#if BUILDFLAG(IS_WIN)
|
2016-12-12 11:05:29 +01:00
|
|
|
+ // Returns the absolute path to the external crash handler exe.
|
2021-03-04 23:36:57 +01:00
|
|
|
+ virtual std::wstring GetCrashExternalHandler(const std::wstring& exe_dir);
|
2017-02-06 20:23:59 +01:00
|
|
|
+#endif
|
|
|
|
+
|
2022-01-25 21:26:51 +01:00
|
|
|
+#if BUILDFLAG(IS_MAC)
|
2017-02-06 20:23:59 +01:00
|
|
|
+ // Returns true if forwarding of crashes to the system crash reporter is
|
|
|
|
+ // enabled for the browser process.
|
|
|
|
+ virtual bool EnableBrowserCrashForwarding();
|
2016-12-12 11:05:29 +01:00
|
|
|
+#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace crash_reporter
|
2020-04-14 21:31:00 +02:00
|
|
|
diff --git components/crash/core/app/crashpad.cc components/crash/core/app/crashpad.cc
|
2023-05-30 10:55:32 +02:00
|
|
|
index 9ea9021f16006..cf187495ff3f0 100644
|
2020-04-14 21:31:00 +02:00
|
|
|
--- components/crash/core/app/crashpad.cc
|
|
|
|
+++ components/crash/core/app/crashpad.cc
|
2023-05-30 10:55:32 +02:00
|
|
|
@@ -129,7 +129,8 @@ bool InitializeCrashpadImpl(bool initial_client,
|
2017-02-06 20:23:59 +01:00
|
|
|
// fallback. Forwarding is turned off for debug-mode builds even for the
|
|
|
|
// browser process, because the system's crash reporter can take a very long
|
|
|
|
// time to chew on symbols.
|
|
|
|
- if (!browser_process || is_debug_build) {
|
|
|
|
+ if (!browser_process || is_debug_build ||
|
2020-03-30 22:13:42 +02:00
|
|
|
+ !GetCrashReporterClient()->EnableBrowserCrashForwarding()) {
|
2018-02-15 01:12:09 +01:00
|
|
|
crashpad::CrashpadInfo::GetCrashpadInfo()
|
|
|
|
->set_system_crash_reporter_forwarding(crashpad::TriState::kDisabled);
|
2017-02-06 20:23:59 +01:00
|
|
|
}
|
2022-03-15 20:42:15 +01:00
|
|
|
diff --git components/crash/core/app/crashpad_linux.cc components/crash/core/app/crashpad_linux.cc
|
2022-09-26 21:30:45 +02:00
|
|
|
index 99efa6b245b99..008eb397332c2 100644
|
2022-03-15 20:42:15 +01:00
|
|
|
--- components/crash/core/app/crashpad_linux.cc
|
|
|
|
+++ components/crash/core/app/crashpad_linux.cc
|
|
|
|
@@ -23,6 +23,7 @@
|
|
|
|
#include "components/crash/core/app/crash_reporter_client.h"
|
|
|
|
#include "components/crash/core/app/crash_switches.h"
|
|
|
|
#include "content/public/common/content_descriptors.h"
|
|
|
|
+#include "content/public/common/content_paths.h"
|
|
|
|
#include "sandbox/linux/services/namespace_sandbox.h"
|
|
|
|
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
|
|
|
|
#include "third_party/crashpad/crashpad/client/crashpad_info.h"
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -107,11 +108,10 @@ bool PlatformCrashpadInitialization(
|
2022-03-15 20:42:15 +01:00
|
|
|
crash_reporter_client->GetCrashDumpLocation(database_path);
|
|
|
|
crash_reporter_client->GetCrashMetricsLocation(&metrics_path);
|
|
|
|
|
|
|
|
+ // Use the same main (default) or subprocess helper exe.
|
|
|
|
base::FilePath handler_path;
|
|
|
|
- if (!base::PathService::Get(base::DIR_EXE, &handler_path)) {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- handler_path = handler_path.Append("chrome_crashpad_handler");
|
|
|
|
+ base::PathService::Get(content::CHILD_PROCESS_EXE, &handler_path);
|
|
|
|
+ DCHECK(!handler_path.empty());
|
|
|
|
|
|
|
|
// When --use-cros-crash-reporter is set (below), the handler passes dumps
|
|
|
|
// to ChromeOS's /sbin/crash_reporter which in turn passes the dump to
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -128,8 +128,8 @@ bool PlatformCrashpadInitialization(
|
2022-03-15 20:42:15 +01:00
|
|
|
&product_version, &channel);
|
|
|
|
|
|
|
|
std::map<std::string, std::string> annotations;
|
|
|
|
- annotations["prod"] = product_name;
|
|
|
|
- annotations["ver"] = product_version;
|
|
|
|
+ annotations["product"] = product_name;
|
|
|
|
+ annotations["version"] = product_version;
|
|
|
|
|
|
|
|
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
|
|
|
// Empty means stable.
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -146,7 +146,20 @@ bool PlatformCrashpadInitialization(
|
2022-03-15 20:42:15 +01:00
|
|
|
annotations["channel"] = channel;
|
|
|
|
}
|
|
|
|
|
|
|
|
- annotations["plat"] = std::string("Linux");
|
|
|
|
+#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)
|
|
|
|
+ annotations["platform"] = platform;
|
|
|
|
|
|
|
|
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
|
|
|
// "build_time_millis" is used on LaCros chrome to determine when to stop
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -191,6 +204,12 @@ bool PlatformCrashpadInitialization(
|
2022-03-15 20:42:15 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+ // Since we're using the same main or subprocess helper exe we must specify
|
|
|
|
+ // the process type.
|
|
|
|
+ arguments.push_back(std::string("--type=") + switches::kCrashpadHandler);
|
|
|
|
+
|
|
|
|
+ crash_reporter_client->GetCrashOptionalArguments(&arguments);
|
|
|
|
+
|
2022-07-21 19:26:10 +02:00
|
|
|
CHECK(client.StartHandler(handler_path, *database_path, metrics_path, url,
|
|
|
|
annotations, arguments, false, false));
|
|
|
|
} else {
|
2020-04-14 21:31:00 +02:00
|
|
|
diff --git components/crash/core/app/crashpad_mac.mm components/crash/core/app/crashpad_mac.mm
|
2023-05-30 10:55:32 +02:00
|
|
|
index d7351f4a912b3..6f1577533d3e9 100644
|
2020-04-14 21:31:00 +02:00
|
|
|
--- components/crash/core/app/crashpad_mac.mm
|
|
|
|
+++ components/crash/core/app/crashpad_mac.mm
|
2023-05-30 10:55:32 +02:00
|
|
|
@@ -17,11 +17,14 @@
|
|
|
|
#include "base/check.h"
|
2020-06-09 19:48:00 +02:00
|
|
|
#include "base/files/file_path.h"
|
2016-12-12 11:05:29 +01:00
|
|
|
#include "base/mac/foundation_util.h"
|
|
|
|
+#include "base/path_service.h"
|
|
|
|
#include "base/strings/string_number_conversions.h"
|
|
|
|
#include "base/strings/string_piece.h"
|
|
|
|
#include "base/strings/sys_string_conversions.h"
|
2019-10-01 15:55:16 +02:00
|
|
|
#include "build/branding_buildflags.h"
|
2020-04-14 21:31:00 +02:00
|
|
|
#include "components/crash/core/app/crash_reporter_client.h"
|
|
|
|
+#include "components/crash/core/app/crash_switches.h"
|
2016-12-12 11:05:29 +01:00
|
|
|
+#include "content/public/common/content_paths.h"
|
|
|
|
#include "third_party/crashpad/crashpad/client/crash_report_database.h"
|
|
|
|
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
|
|
|
|
#include "third_party/crashpad/crashpad/client/crashpad_info.h"
|
2023-05-30 10:55:32 +02:00
|
|
|
@@ -43,15 +46,25 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() {
|
2018-06-01 21:16:26 +02:00
|
|
|
std::map<std::string, std::string> process_annotations;
|
|
|
|
@autoreleasepool {
|
2023-05-30 10:55:32 +02:00
|
|
|
NSBundle* outer_bundle = base::apple::OuterBundle();
|
2018-06-01 21:16:26 +02:00
|
|
|
+ CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
|
|
|
|
+ const char* product_name = "";
|
|
|
|
+ const char* product_version = "";
|
|
|
|
+ crash_reporter_client->GetProductNameAndVersion(&product_name,
|
|
|
|
+ &product_version);
|
|
|
|
+
|
2017-01-12 17:44:35 +01:00
|
|
|
+ if (strlen(product_name) == 0) {
|
2020-08-29 00:39:23 +02:00
|
|
|
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
|
|
|
- process_annotations["prod"] = "Chrome_Mac";
|
|
|
|
+ process_annotations["product"] = "Chrome_Mac";
|
|
|
|
#else
|
2023-05-30 10:55:32 +02:00
|
|
|
- NSString* product = base::mac::ObjCCast<NSString>(
|
|
|
|
- [outer_bundle objectForInfoDictionaryKey:base::apple::CFToNSPtrCast(
|
|
|
|
- kCFBundleNameKey)]);
|
2020-08-29 00:39:23 +02:00
|
|
|
- process_annotations["prod"] =
|
|
|
|
- base::SysNSStringToUTF8(product).append("_Mac");
|
2023-05-30 10:55:32 +02:00
|
|
|
+ NSString* product = base::mac::ObjCCast<NSString>(
|
|
|
|
+ [outer_bundle objectForInfoDictionaryKey:base::apple::CFToNSPtrCast(
|
|
|
|
+ kCFBundleNameKey)]);
|
2017-01-25 19:37:12 +01:00
|
|
|
+ process_annotations["product"] =
|
2017-01-12 17:44:35 +01:00
|
|
|
+ base::SysNSStringToUTF8(product).append("_Mac");
|
2020-08-29 00:39:23 +02:00
|
|
|
#endif
|
2017-01-12 17:44:35 +01:00
|
|
|
+ } else {
|
2017-01-25 19:37:12 +01:00
|
|
|
+ process_annotations["product"] = product_name;
|
2017-01-12 17:44:35 +01:00
|
|
|
+ }
|
|
|
|
|
2019-10-01 15:55:16 +02:00
|
|
|
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
2017-04-20 21:28:17 +02:00
|
|
|
// Empty means stable.
|
2023-05-30 10:55:32 +02:00
|
|
|
@@ -82,12 +95,20 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() {
|
2021-04-21 00:52:34 +02:00
|
|
|
}
|
2017-01-12 17:44:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- NSString* version =
|
2023-05-30 10:55:32 +02:00
|
|
|
- base::mac::ObjCCast<NSString>([base::apple::FrameworkBundle()
|
2017-01-12 17:44:35 +01:00
|
|
|
- objectForInfoDictionaryKey:@"CFBundleShortVersionString"]);
|
|
|
|
- process_annotations["ver"] = base::SysNSStringToUTF8(version);
|
|
|
|
+ if (strlen(product_version) == 0) {
|
|
|
|
+ NSString* version =
|
2023-05-30 10:55:32 +02:00
|
|
|
+ base::mac::ObjCCast<NSString>([base::apple::FrameworkBundle()
|
2017-01-12 17:44:35 +01:00
|
|
|
+ objectForInfoDictionaryKey:@"CFBundleShortVersionString"]);
|
2017-01-25 19:37:12 +01:00
|
|
|
+ process_annotations["version"] = base::SysNSStringToUTF8(version);
|
2017-01-12 17:44:35 +01:00
|
|
|
+ } else {
|
2017-01-25 19:37:12 +01:00
|
|
|
+ process_annotations["version"] = product_version;
|
2017-01-12 17:44:35 +01:00
|
|
|
+ }
|
|
|
|
|
2017-01-25 19:37:12 +01:00
|
|
|
- process_annotations["plat"] = std::string("OS X");
|
2021-03-31 16:33:45 +02:00
|
|
|
+#if defined(ARCH_CPU_ARM64)
|
|
|
|
+ process_annotations["platform"] = std::string("macosarm64");
|
|
|
|
+#else
|
2017-01-25 19:37:12 +01:00
|
|
|
+ process_annotations["platform"] = std::string("macos");
|
2021-03-31 16:33:45 +02:00
|
|
|
+#endif
|
2018-06-01 21:16:26 +02:00
|
|
|
} // @autoreleasepool
|
|
|
|
return process_annotations;
|
|
|
|
}();
|
2023-05-30 10:55:32 +02:00
|
|
|
@@ -147,10 +168,10 @@ bool PlatformCrashpadInitialization(
|
2017-01-12 17:44:35 +01:00
|
|
|
|
2018-06-01 21:16:26 +02:00
|
|
|
if (initial_client) {
|
|
|
|
@autoreleasepool {
|
2023-05-30 10:55:32 +02:00
|
|
|
- base::FilePath framework_bundle_path = base::apple::FrameworkBundlePath();
|
2018-06-01 21:16:26 +02:00
|
|
|
- base::FilePath handler_path =
|
2019-02-21 01:42:36 +01:00
|
|
|
- framework_bundle_path.Append("Helpers").Append(
|
|
|
|
- "chrome_crashpad_handler");
|
2018-06-01 21:16:26 +02:00
|
|
|
+ // Use the same subprocess helper exe.
|
|
|
|
+ base::FilePath handler_path;
|
|
|
|
+ base::PathService::Get(content::CHILD_PROCESS_EXE, &handler_path);
|
|
|
|
+ DCHECK(!handler_path.empty());
|
|
|
|
|
|
|
|
// Is there a way to recover if this fails?
|
|
|
|
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
|
2023-05-30 10:55:32 +02:00
|
|
|
@@ -179,6 +200,12 @@ bool PlatformCrashpadInitialization(
|
2016-12-12 11:05:29 +01:00
|
|
|
"--reset-own-crash-exception-port-to-system-default");
|
|
|
|
}
|
2017-05-31 17:33:30 +02:00
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
+ // Since we're using the same subprocess helper exe we must specify the
|
|
|
|
+ // process type.
|
|
|
|
+ arguments.push_back(std::string("--type=") + switches::kCrashpadHandler);
|
|
|
|
+
|
|
|
|
+ crash_reporter_client->GetCrashOptionalArguments(&arguments);
|
2017-05-31 17:33:30 +02:00
|
|
|
+
|
2017-04-20 21:28:17 +02:00
|
|
|
bool result = GetCrashpadClient().StartHandler(
|
2021-11-10 22:57:31 +01:00
|
|
|
handler_path, *database_path, metrics_path, url,
|
2018-06-01 21:16:26 +02:00
|
|
|
GetProcessSimpleAnnotations(), arguments, true, false);
|
2020-04-14 21:31:00 +02:00
|
|
|
diff --git components/crash/core/app/crashpad_win.cc components/crash/core/app/crashpad_win.cc
|
2022-09-26 21:30:45 +02:00
|
|
|
index 9ab5fb1c82275..740014c1119bd 100644
|
2020-04-14 21:31:00 +02:00
|
|
|
--- components/crash/core/app/crashpad_win.cc
|
|
|
|
+++ components/crash/core/app/crashpad_win.cc
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -36,8 +36,8 @@ void GetPlatformCrashpadAnnotations(
|
2021-03-04 23:36:57 +01:00
|
|
|
std::wstring product_name, version, special_build, channel_name;
|
2017-01-25 19:37:12 +01:00
|
|
|
crash_reporter_client->GetProductNameAndVersion(
|
|
|
|
exe_file, &product_name, &version, &special_build, &channel_name);
|
2021-03-04 23:36:57 +01:00
|
|
|
- (*annotations)["prod"] = base::WideToUTF8(product_name);
|
|
|
|
- (*annotations)["ver"] = base::WideToUTF8(version);
|
|
|
|
+ (*annotations)["product"] = base::WideToUTF8(product_name);
|
|
|
|
+ (*annotations)["version"] = base::WideToUTF8(version);
|
2019-10-01 15:55:16 +02:00
|
|
|
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
2017-04-20 21:28:17 +02:00
|
|
|
// Empty means stable.
|
|
|
|
const bool allow_empty_channel = true;
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -54,9 +54,11 @@ void GetPlatformCrashpadAnnotations(
|
2017-01-25 19:37:12 +01:00
|
|
|
if (!special_build.empty())
|
2021-03-04 23:36:57 +01:00
|
|
|
(*annotations)["special"] = base::WideToUTF8(special_build);
|
2017-01-25 19:37:12 +01:00
|
|
|
#if defined(ARCH_CPU_X86)
|
|
|
|
- (*annotations)["plat"] = std::string("Win32");
|
2017-04-27 19:02:21 +02:00
|
|
|
+ (*annotations)["platform"] = std::string("win32");
|
2017-01-25 19:37:12 +01:00
|
|
|
#elif defined(ARCH_CPU_X86_64)
|
|
|
|
- (*annotations)["plat"] = std::string("Win64");
|
2017-04-27 19:02:21 +02:00
|
|
|
+ (*annotations)["platform"] = std::string("win64");
|
2021-03-31 16:33:45 +02:00
|
|
|
+#elif defined(ARCH_CPU_ARM64)
|
|
|
|
+ (*annotations)["platform"] = std::string("winarm64");
|
2017-01-25 19:37:12 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -71,7 +73,9 @@ bool PlatformCrashpadInitialization(
|
2018-03-28 23:15:05 +02:00
|
|
|
base::FilePath metrics_path; // Only valid in the browser process.
|
|
|
|
|
|
|
|
const char kPipeNameVar[] = "CHROME_CRASHPAD_PIPE_NAME";
|
|
|
|
+#if defined(GOOGLE_CHROME_BUILD)
|
|
|
|
const char kServerUrlVar[] = "CHROME_CRASHPAD_SERVER_URL";
|
|
|
|
+#endif
|
|
|
|
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
2020-03-04 01:29:39 +01:00
|
|
|
|
|
|
|
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -94,9 +98,11 @@ bool PlatformCrashpadInitialization(
|
2018-03-28 23:15:05 +02:00
|
|
|
|
2020-06-09 19:48:00 +02:00
|
|
|
std::string url = crash_reporter_client->GetUploadUrl();
|
2016-12-12 11:05:29 +01:00
|
|
|
|
2020-06-09 19:48:00 +02:00
|
|
|
+#if defined(GOOGLE_CHROME_BUILD)
|
2016-12-12 11:05:29 +01:00
|
|
|
// Allow the crash server to be overridden for testing. If the variable
|
2018-03-28 23:15:05 +02:00
|
|
|
// isn't present in the environment then the default URL will remain.
|
|
|
|
env->GetVar(kServerUrlVar, &url);
|
|
|
|
+#endif
|
|
|
|
|
2018-04-19 17:44:42 +02:00
|
|
|
base::FilePath exe_file(exe_path);
|
|
|
|
if (exe_file.empty()) {
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -107,13 +113,14 @@ bool PlatformCrashpadInitialization(
|
2020-03-04 01:29:39 +01:00
|
|
|
exe_file = base::FilePath(exe_file_path);
|
2017-01-13 21:23:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- // If the handler is embedded in the binary (e.g. chrome, setup), we
|
|
|
|
- // reinvoke it with --type=crashpad-handler. Otherwise, we use the
|
|
|
|
- // standalone crashpad_handler.exe (for tests, etc.).
|
2018-12-26 16:12:11 +01:00
|
|
|
std::vector<std::string> start_arguments(initial_arguments);
|
2017-04-27 03:59:52 +02:00
|
|
|
+
|
2017-01-13 21:23:19 +01:00
|
|
|
+ // Always add --type=crashpad-handler because the value is expected by
|
|
|
|
+ // CefExecuteProcess.
|
2017-04-20 21:28:17 +02:00
|
|
|
+ start_arguments.push_back(
|
|
|
|
+ std::string("--type=") + switches::kCrashpadHandler);
|
2017-01-13 21:23:19 +01:00
|
|
|
+
|
|
|
|
if (embedded_handler) {
|
2017-04-20 21:28:17 +02:00
|
|
|
- start_arguments.push_back(std::string("--type=") +
|
|
|
|
- switches::kCrashpadHandler);
|
2017-05-31 17:33:30 +02:00
|
|
|
if (!user_data_dir.empty()) {
|
|
|
|
start_arguments.push_back(std::string("--user-data-dir=") +
|
|
|
|
user_data_dir);
|
2022-07-25 19:49:32 +02:00
|
|
|
@@ -124,9 +131,12 @@ bool PlatformCrashpadInitialization(
|
2017-04-20 21:28:17 +02:00
|
|
|
start_arguments.push_back("/prefetch:7");
|
2016-12-12 11:05:29 +01:00
|
|
|
} else {
|
|
|
|
base::FilePath exe_dir = exe_file.DirName();
|
|
|
|
- exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe"));
|
|
|
|
+ exe_file = base::FilePath(
|
|
|
|
+ crash_reporter_client->GetCrashExternalHandler(exe_dir.value()));
|
|
|
|
}
|
|
|
|
|
2017-04-20 21:28:17 +02:00
|
|
|
+ crash_reporter_client->GetCrashOptionalArguments(&start_arguments);
|
2016-12-12 11:05:29 +01:00
|
|
|
+
|
2017-04-20 21:28:17 +02:00
|
|
|
std::vector<std::string> arguments(start_arguments);
|
|
|
|
|
|
|
|
if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) {
|