2019-07-16 19:59:21 +02:00
|
|
|
diff --git chrome/chrome_elf/BUILD.gn chrome/chrome_elf/BUILD.gn
|
2023-08-09 23:17:17 +02:00
|
|
|
index 37e2d2a50aa2c..bb6ac82cd9cb7 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
|
2024-04-23 22:06:00 +02:00
|
|
|
index 30a2c1adc4509..b60a7afaf1e5e 100644
|
2019-07-16 19:59:21 +02:00
|
|
|
--- chrome/chrome_elf/crash/crash_helper.cc
|
|
|
|
+++ chrome/chrome_elf/crash/crash_helper.cc
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -12,12 +12,17 @@
|
2016-12-12 11:05:29 +01:00
|
|
|
#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.
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -78,7 +83,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
|
2024-08-26 14:44:25 +02:00
|
|
|
index d9c721376c855..e72b67e2a1a50 100644
|
2019-07-16 19:59:21 +02:00
|
|
|
--- chrome/common/crash_keys.cc
|
|
|
|
+++ chrome/common/crash_keys.cc
|
2024-08-26 14:44:25 +02:00
|
|
|
@@ -12,6 +12,8 @@
|
2022-05-19 12:28:44 +02:00
|
|
|
#include <deque>
|
2024-05-23 03:52:35 +02:00
|
|
|
#include <string_view>
|
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"
|
2024-08-26 14:44:25 +02:00
|
|
|
@@ -110,8 +112,10 @@ void HandleEnableDisableFeatures(const base::CommandLine& command_line) {
|
2023-02-27 19:52:38 +01:00
|
|
|
"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) {
|
2024-08-26 14:44:25 +02:00
|
|
|
static const std::string_view kIgnoreSwitches[] = {
|
|
|
|
kStringAnnotationsSwitch,
|
2019-07-16 19:59:21 +02:00
|
|
|
switches::kEnableLogging,
|
2024-08-26 14:44:25 +02:00
|
|
|
@@ -171,6 +175,8 @@ bool IsBoringSwitch(const std::string& flag) {
|
2021-08-20 01:40:49 +02:00
|
|
|
return false;
|
2019-07-16 19:59:21 +02:00
|
|
|
}
|
|
|
|
|
2024-08-26 14:44:25 +02:00
|
|
|
+namespace {
|
|
|
|
+
|
|
|
|
std::deque<CrashKeyWithName>& GetCommandLineStringAnnotations() {
|
|
|
|
static base::NoDestructor<std::deque<CrashKeyWithName>>
|
|
|
|
command_line_string_annotations;
|
|
|
|
@@ -216,7 +222,7 @@ void AppendStringAnnotationsCommandLineSwitch(base::CommandLine* command_line) {
|
2019-07-16 19:59:21 +02:00
|
|
|
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) {
|
2024-08-26 14:44:25 +02:00
|
|
|
SetStringAnnotations(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
|
|
|
}
|
|
|
|
|
2024-04-23 22:06:00 +02:00
|
|
|
} // namespace crash_keys
|
2019-07-16 19:59:21 +02:00
|
|
|
diff --git chrome/common/crash_keys.h chrome/common/crash_keys.h
|
2024-08-26 14:44:25 +02:00
|
|
|
index a274b3e364084..3d995cf643399 100644
|
2019-07-16 19:59:21 +02:00
|
|
|
--- chrome/common/crash_keys.h
|
|
|
|
+++ chrome/common/crash_keys.h
|
2024-08-26 14:44:25 +02:00
|
|
|
@@ -5,6 +5,7 @@
|
2024-04-23 22:06:00 +02:00
|
|
|
#ifndef CHROME_COMMON_CRASH_KEYS_H_
|
|
|
|
#define CHROME_COMMON_CRASH_KEYS_H_
|
|
|
|
|
|
|
|
+#include <string>
|
2024-08-26 14:44:25 +02:00
|
|
|
#include <string_view>
|
2019-07-16 19:59:21 +02:00
|
|
|
|
2024-08-26 14:44:25 +02:00
|
|
|
namespace base {
|
|
|
|
@@ -24,6 +25,10 @@ void AllocateCrashKeyInBrowserAndChildren(std::string_view key,
|
|
|
|
// SetCrashKeysFromCommandLine().
|
|
|
|
void AppendStringAnnotationsCommandLineSwitch(base::CommandLine* command_line);
|
2019-07-16 19:59:21 +02:00
|
|
|
|
|
|
|
+// 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
|
2024-08-26 14:44:25 +02:00
|
|
|
// on the given `command_line`. For non-browser processes, allocates crash keys
|
|
|
|
// from the switch value set by AppendStringAnnotationsCommandLineSwitch().
|
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
|
2024-10-24 17:05:31 +02:00
|
|
|
index 4abce141b758e..c2624423ed44e 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
|
2024-09-27 16:15:44 +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) {
|
|
|
|
}
|
2024-09-27 16:15:44 +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();
|
|
|
|
}
|
2024-09-27 16:15:44 +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) {
|
2024-09-27 16:15:44 +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;
|
2024-09-27 16:15:44 +02:00
|
|
|
@@ -205,9 +229,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
|
2024-08-26 14:44:25 +02:00
|
|
|
index 641c9cdba5011..20a8b9983a476 100644
|
2020-04-14 21:31:00 +02:00
|
|
|
--- components/crash/core/app/crashpad.cc
|
|
|
|
+++ components/crash/core/app/crashpad.cc
|
2024-08-26 14:44:25 +02:00
|
|
|
@@ -128,7 +128,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
|
2024-03-19 22:11:42 +01:00
|
|
|
index 171095381e8ac..13407a7809844 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"
|
2024-02-22 19:36:15 +01:00
|
|
|
@@ -168,11 +169,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
|
2024-02-22 19:36:15 +01:00
|
|
|
@@ -189,8 +189,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.
|
2024-02-22 19:36:15 +01:00
|
|
|
@@ -207,7 +207,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
|
2024-02-22 19:36:15 +01:00
|
|
|
@@ -252,6 +265,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
|
2024-06-14 19:01:45 +02:00
|
|
|
index 42fe73aefe44f..575ce6732ae43 100644
|
2020-04-14 21:31:00 +02:00
|
|
|
--- components/crash/core/app/crashpad_mac.mm
|
|
|
|
+++ components/crash/core/app/crashpad_mac.mm
|
2024-06-14 19:01:45 +02:00
|
|
|
@@ -17,10 +17,13 @@
|
2023-09-15 21:51:43 +02:00
|
|
|
#include "base/apple/foundation_util.h"
|
2023-05-30 10:55:32 +02:00
|
|
|
#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/path_service.h"
|
|
|
|
#include "base/strings/string_number_conversions.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"
|
2024-06-14 19:01:45 +02:00
|
|
|
@@ -38,15 +41,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-09-15 21:51:43 +02:00
|
|
|
- NSString* product = base::apple::ObjCCast<NSString>(
|
2023-05-30 10:55:32 +02:00
|
|
|
- [outer_bundle objectForInfoDictionaryKey:base::apple::CFToNSPtrCast(
|
|
|
|
- kCFBundleNameKey)]);
|
2020-08-29 00:39:23 +02:00
|
|
|
- process_annotations["prod"] =
|
|
|
|
- base::SysNSStringToUTF8(product).append("_Mac");
|
2023-09-15 21:51:43 +02:00
|
|
|
+ NSString* product = base::apple::ObjCCast<NSString>(
|
2023-05-30 10:55:32 +02:00
|
|
|
+ [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.
|
2024-06-14 19:01:45 +02:00
|
|
|
@@ -77,12 +90,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-09-15 21:51:43 +02:00
|
|
|
- base::apple::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-09-15 21:51:43 +02:00
|
|
|
+ base::apple::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;
|
|
|
|
}();
|
2024-06-14 19:01:45 +02:00
|
|
|
@@ -142,10 +163,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();
|
2024-06-14 19:01:45 +02:00
|
|
|
@@ -174,6 +195,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
|
2024-05-23 03:52:35 +02:00
|
|
|
index 0e00d26f79231..fdd2b4bc73f8e 100644
|
2020-04-14 21:31:00 +02:00
|
|
|
--- components/crash/core/app/crashpad_win.cc
|
|
|
|
+++ components/crash/core/app/crashpad_win.cc
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -37,8 +37,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;
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -55,9 +55,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
|
|
|
|
}
|
|
|
|
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -72,7 +74,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();
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -95,9 +99,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()) {
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -108,13 +114,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(
|
2024-05-23 03:52:35 +02:00
|
|
|
app_launch_prefetch::SubprocessType::kCrashpad)));
|
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()) {
|