2019-07-16 19:59:21 +02:00
|
|
|
diff --git chrome/chrome_elf/BUILD.gn chrome/chrome_elf/BUILD.gn
|
2022-07-21 19:26:10 +02:00
|
|
|
index da34cf911b74d..d5c8ca11be3fc 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-21 19:26:10 +02:00
|
|
|
@@ -116,6 +114,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-21 19:26:10 +02:00
|
|
|
@@ -123,6 +122,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-05-19 12:28:44 +02:00
|
|
|
index c5fe247fc3acd..8ce4bcd78ea9e 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
|
2022-05-19 12:28:44 +02:00
|
|
|
index cd5ebb2ff81ac..ec5193c3d2a93 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"
|
|
|
|
@@ -94,8 +96,10 @@ void HandleEnableDisableFeatures(const base::CommandLine& command_line) {
|
2021-08-20 01:40:49 +02:00
|
|
|
}
|
|
|
|
#endif
|
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,
|
2022-05-19 12:28:44 +02:00
|
|
|
@@ -155,13 +159,11 @@ 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) {
|
2022-01-25 21:26:51 +01:00
|
|
|
#if BUILDFLAG(IS_CHROMEOS)
|
2021-08-20 01:40:49 +02:00
|
|
|
HandleEnableDisableFeatures(command_line);
|
|
|
|
#endif
|
|
|
|
- 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
|
2021-12-16 23:35:54 +01:00
|
|
|
index e2d53ac83dde0..6ac76e407a748 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-03-15 20:42:15 +01:00
|
|
|
index 82b7f241e2618..525f1efe5aa6a 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-01-25 21:26:51 +01:00
|
|
|
@@ -89,7 +89,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-01-25 21:26:51 +01:00
|
|
|
@@ -98,6 +98,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-01-25 21:26:51 +01:00
|
|
|
@@ -107,6 +108,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-01-25 21:26:51 +01:00
|
|
|
@@ -141,6 +143,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-03-15 20:42:15 +01:00
|
|
|
@@ -203,9 +227,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
|
2022-03-15 20:42:15 +01:00
|
|
|
index 24e53fa62c2c4..ffc72f79d67b0 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
|
2018-02-15 01:12:09 +01:00
|
|
|
@@ -5,7 +5,9 @@
|
2020-04-14 21:31:00 +02:00
|
|
|
#ifndef COMPONENTS_CRASH_CORE_APP_CRASH_REPORTER_CLIENT_H_
|
|
|
|
#define COMPONENTS_CRASH_CORE_APP_CRASH_REPORTER_CLIENT_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
|
|
|
|
2022-01-25 21:26:51 +01:00
|
|
|
@@ -89,7 +91,7 @@ class CrashReporterClient {
|
|
|
|
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
|
2022-01-25 21:26:51 +01:00
|
|
|
@@ -100,6 +102,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.
|
2022-01-25 21:26:51 +01:00
|
|
|
@@ -109,6 +112,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
|
2022-03-15 20:42:15 +01:00
|
|
|
@@ -206,6 +210,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
|
2022-05-19 12:28:44 +02:00
|
|
|
index 9058d56e8bda7..6a62596c03a52 100644
|
2020-04-14 21:31:00 +02:00
|
|
|
--- components/crash/core/app/crashpad.cc
|
|
|
|
+++ components/crash/core/app/crashpad.cc
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -154,7 +154,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-07-21 19:26:10 +02:00
|
|
|
index 7159bea91a257..090dfcfa0d45a 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
|
2021-11-10 22:57:31 +01:00
|
|
|
index dc041c43371fd..1d060ae55c586 100644
|
2020-04-14 21:31:00 +02:00
|
|
|
--- components/crash/core/app/crashpad_mac.mm
|
|
|
|
+++ components/crash/core/app/crashpad_mac.mm
|
2021-06-04 03:34:56 +02:00
|
|
|
@@ -16,11 +16,14 @@
|
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/bundle_locations.h"
|
|
|
|
#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"
|
2021-06-04 03:34:56 +02:00
|
|
|
@@ -38,14 +41,24 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() {
|
2018-06-01 21:16:26 +02:00
|
|
|
std::map<std::string, std::string> process_annotations;
|
|
|
|
@autoreleasepool {
|
2017-01-12 17:44:35 +01:00
|
|
|
NSBundle* outer_bundle = base::mac::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
|
|
|
|
- NSString* product = base::mac::ObjCCast<NSString>([outer_bundle
|
|
|
|
- objectForInfoDictionaryKey:base::mac::CFToNSCast(kCFBundleNameKey)]);
|
|
|
|
- process_annotations["prod"] =
|
|
|
|
- base::SysNSStringToUTF8(product).append("_Mac");
|
2017-01-12 17:44:35 +01:00
|
|
|
+ NSString* product = base::mac::ObjCCast<NSString>([outer_bundle
|
2020-08-29 00:39:23 +02:00
|
|
|
+ objectForInfoDictionaryKey:base::mac::CFToNSCast(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.
|
2021-06-04 03:34:56 +02:00
|
|
|
@@ -76,12 +89,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 =
|
|
|
|
- base::mac::ObjCCast<NSString>([base::mac::FrameworkBundle()
|
|
|
|
- objectForInfoDictionaryKey:@"CFBundleShortVersionString"]);
|
|
|
|
- process_annotations["ver"] = base::SysNSStringToUTF8(version);
|
|
|
|
+ if (strlen(product_version) == 0) {
|
|
|
|
+ NSString* version =
|
|
|
|
+ base::mac::ObjCCast<NSString>([base::mac::FrameworkBundle()
|
|
|
|
+ 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;
|
|
|
|
}();
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -141,10 +162,10 @@ bool PlatformCrashpadInitialization(
|
2017-01-12 17:44:35 +01:00
|
|
|
|
2018-06-01 21:16:26 +02:00
|
|
|
if (initial_client) {
|
|
|
|
@autoreleasepool {
|
|
|
|
- base::FilePath framework_bundle_path = base::mac::FrameworkBundlePath();
|
|
|
|
- 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();
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -173,6 +194,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-05-19 12:28:44 +02:00
|
|
|
index 80f33dc5e2f2e..277c336a90668 100644
|
2020-04-14 21:31:00 +02:00
|
|
|
--- components/crash/core/app/crashpad_win.cc
|
|
|
|
+++ components/crash/core/app/crashpad_win.cc
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -35,8 +35,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-03-26 02:12:30 +01:00
|
|
|
@@ -53,9 +53,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-03-26 02:12:30 +01:00
|
|
|
@@ -70,7 +72,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-05-19 12:28:44 +02:00
|
|
|
@@ -93,9 +97,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-05-19 12:28:44 +02:00
|
|
|
@@ -106,13 +112,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-05-19 12:28:44 +02:00
|
|
|
@@ -123,9 +130,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()) {
|