2016-12-12 11:05:29 +01:00
|
|
|
diff --git chrome/common/crash_keys.cc chrome/common/crash_keys.cc
|
2018-03-20 21:15:08 +01:00
|
|
|
index 887e13776dd2..de30ebff25e4 100644
|
2016-12-12 11:05:29 +01:00
|
|
|
--- chrome/common/crash_keys.cc
|
|
|
|
+++ chrome/common/crash_keys.cc
|
|
|
|
@@ -4,6 +4,8 @@
|
|
|
|
|
|
|
|
#include "chrome/common/crash_keys.h"
|
|
|
|
|
|
|
|
+#include <iterator>
|
|
|
|
+
|
|
|
|
#include "base/base_switches.h"
|
|
|
|
#include "base/command_line.h"
|
2018-02-15 01:12:09 +01:00
|
|
|
#include "base/logging.h"
|
|
|
|
@@ -26,7 +28,7 @@
|
|
|
|
|
|
|
|
namespace crash_keys {
|
2016-12-12 11:05:29 +01:00
|
|
|
|
|
|
|
-static bool IsBoringSwitch(const std::string& flag) {
|
|
|
|
+bool IsBoringChromeSwitch(const std::string& flag) {
|
|
|
|
static const char* const kIgnoreSwitches[] = {
|
|
|
|
switches::kEnableLogging,
|
|
|
|
switches::kFlagSwitchesBegin,
|
2018-03-20 21:15:08 +01:00
|
|
|
@@ -77,7 +79,7 @@ static bool IsBoringSwitch(const std::string& flag) {
|
2016-12-12 11:05:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) {
|
|
|
|
- return SetSwitchesFromCommandLine(command_line, &IsBoringSwitch);
|
|
|
|
+ return SetSwitchesFromCommandLine(command_line, &IsBoringChromeSwitch);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetActiveExtensions(const std::set<std::string>& extensions) {
|
|
|
|
diff --git chrome/common/crash_keys.h chrome/common/crash_keys.h
|
2018-05-14 13:24:05 +02:00
|
|
|
index bcf172e645a2..f879aa745adf 100644
|
2016-12-12 11:05:29 +01:00
|
|
|
--- chrome/common/crash_keys.h
|
|
|
|
+++ chrome/common/crash_keys.h
|
2018-05-14 13:24:05 +02:00
|
|
|
@@ -17,6 +17,10 @@ class CommandLine;
|
2016-12-12 11:05:29 +01:00
|
|
|
|
|
|
|
namespace crash_keys {
|
2018-05-14 13:24:05 +02:00
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
+// Returns true if the specified command-line flag should be excluded from
|
|
|
|
+// crash reporting.
|
|
|
|
+bool IsBoringChromeSwitch(const std::string& flag);
|
2018-05-14 13:24:05 +02:00
|
|
|
+
|
2016-12-12 11:05:29 +01:00
|
|
|
// Sets the kNumSwitches key and the set of keys named using kSwitchFormat based
|
|
|
|
// on the given |command_line|.
|
2018-05-14 13:24:05 +02:00
|
|
|
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line);
|
2016-12-12 11:05:29 +01:00
|
|
|
diff --git chrome_elf/BUILD.gn chrome_elf/BUILD.gn
|
2018-07-02 19:11:49 +02:00
|
|
|
index a47b2b61fbfa..83936ff6e265 100644
|
2016-12-12 11:05:29 +01:00
|
|
|
--- chrome_elf/BUILD.gn
|
|
|
|
+++ chrome_elf/BUILD.gn
|
|
|
|
@@ -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")
|
|
|
|
|
2018-07-02 19:11:49 +02:00
|
|
|
@@ -124,9 +125,6 @@ source_set("constants") {
|
2016-12-12 11:05:29 +01:00
|
|
|
|
|
|
|
static_library("crash") {
|
|
|
|
sources = [
|
|
|
|
- "../chrome/app/chrome_crash_reporter_client_win.cc",
|
|
|
|
- "../chrome/app/chrome_crash_reporter_client_win.h",
|
|
|
|
- "../chrome/common/chrome_result_codes.h",
|
|
|
|
"crash/crash_helper.cc",
|
|
|
|
"crash/crash_helper.h",
|
|
|
|
]
|
2018-07-02 19:11:49 +02:00
|
|
|
@@ -134,6 +132,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",
|
2017-09-06 23:40:58 +02:00
|
|
|
"//components/crash/content/app",
|
2016-12-12 11:05:29 +01:00
|
|
|
"//components/crash/core/common", # crash_keys
|
2018-07-02 19:11:49 +02:00
|
|
|
@@ -141,6 +140,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") {
|
2016-12-12 11:05:29 +01:00
|
|
|
diff --git chrome_elf/crash/crash_helper.cc chrome_elf/crash/crash_helper.cc
|
2018-04-19 17:44:42 +02:00
|
|
|
index fdc51ab22807..cb0a99dd190c 100644
|
2016-12-12 11:05:29 +01:00
|
|
|
--- chrome_elf/crash/crash_helper.cc
|
|
|
|
+++ chrome_elf/crash/crash_helper.cc
|
|
|
|
@@ -11,12 +11,17 @@
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
#include "chrome/app/chrome_crash_reporter_client_win.h"
|
|
|
|
#include "chrome_elf/hook_util/hook_util.h"
|
|
|
|
#include "components/crash/content/app/crashpad.h"
|
|
|
|
#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.
|
|
|
|
@@ -74,7 +79,11 @@ bool InitializeCrashReporting() {
|
|
|
|
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;
|
|
|
|
diff --git components/crash/content/app/breakpad_linux.cc components/crash/content/app/breakpad_linux.cc
|
2018-05-21 14:54:08 +02:00
|
|
|
index 76f15cb5b511..7cf4cb636a2e 100644
|
2016-12-12 11:05:29 +01:00
|
|
|
--- components/crash/content/app/breakpad_linux.cc
|
|
|
|
+++ components/crash/content/app/breakpad_linux.cc
|
2018-02-15 01:12:09 +01:00
|
|
|
@@ -28,6 +28,7 @@
|
|
|
|
#include "base/base_switches.h"
|
2016-12-12 11:05:29 +01:00
|
|
|
#include "base/command_line.h"
|
|
|
|
#include "base/debug/dump_without_crashing.h"
|
|
|
|
+#include "base/debug/leak_annotations.h"
|
|
|
|
#include "base/files/file_path.h"
|
|
|
|
#include "base/lazy_instance.h"
|
|
|
|
#include "base/linux_util.h"
|
2018-02-15 01:12:09 +01:00
|
|
|
@@ -88,6 +89,7 @@ namespace {
|
2016-12-12 11:05:29 +01:00
|
|
|
|
|
|
|
#if !defined(OS_CHROMEOS)
|
|
|
|
const char kUploadURL[] = "https://clients2.google.com/cr/report";
|
|
|
|
+const char* g_crash_server_url = kUploadURL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
bool g_is_crash_reporter_enabled = false;
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -686,7 +688,7 @@ bool CrashDone(const MinidumpDescriptor& minidump,
|
2016-12-12 11:05:29 +01:00
|
|
|
info.process_type_length = 7;
|
|
|
|
info.distro = base::g_linux_distro;
|
|
|
|
info.distro_length = my_strlen(base::g_linux_distro);
|
|
|
|
- info.upload = upload;
|
|
|
|
+ info.upload = upload && g_crash_server_url;
|
|
|
|
info.process_start_time = g_process_start_time;
|
|
|
|
info.oom_size = base::g_oom_size;
|
|
|
|
info.pid = g_pid;
|
2018-05-21 14:54:08 +02:00
|
|
|
@@ -1341,7 +1343,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info,
|
2016-12-12 11:05:29 +01:00
|
|
|
header_content_encoding,
|
|
|
|
header_content_type,
|
|
|
|
post_file,
|
|
|
|
- kUploadURL,
|
|
|
|
+ g_crash_server_url,
|
|
|
|
"--timeout=10", // Set a timeout so we don't hang forever.
|
|
|
|
"--tries=1", // Don't retry if the upload fails.
|
2017-03-03 23:37:23 +01:00
|
|
|
"-O", // Output reply to the file descriptor path.
|
2018-05-21 14:54:08 +02:00
|
|
|
@@ -1681,10 +1683,19 @@ void HandleCrashDump(const BreakpadInfo& info) {
|
2017-01-25 19:37:12 +01:00
|
|
|
GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version);
|
|
|
|
|
|
|
|
writer.AddBoundary();
|
|
|
|
- writer.AddPairString("prod", product_name);
|
|
|
|
+ writer.AddPairString("product", product_name);
|
2018-02-15 01:12:09 +01:00
|
|
|
+ writer.AddBoundary();
|
2017-01-25 19:37:12 +01:00
|
|
|
+ writer.AddPairString("version", version);
|
|
|
|
writer.AddBoundary();
|
2018-02-15 01:12:09 +01:00
|
|
|
- writer.AddPairString("ver", version);
|
2017-01-25 19:37:12 +01:00
|
|
|
+
|
|
|
|
+#if defined(ARCH_CPU_32_BITS)
|
|
|
|
+ const char* platform = "linux32";
|
|
|
|
+#elif defined(ARCH_CPU_64_BITS)
|
|
|
|
+ const char* platform = "linux64";
|
|
|
|
+#endif
|
|
|
|
+ writer.AddPairString("platform", platform);
|
2018-02-15 01:12:09 +01:00
|
|
|
writer.AddBoundary();
|
2017-01-25 19:37:12 +01:00
|
|
|
+
|
|
|
|
if (info.pid > 0) {
|
|
|
|
char pid_value_buf[kUint64StringSize];
|
|
|
|
uint64_t pid_value_len = my_uint64_len(info.pid);
|
2018-05-21 14:54:08 +02:00
|
|
|
@@ -1802,10 +1813,20 @@ void HandleCrashDump(const BreakpadInfo& info) {
|
2018-02-15 01:12:09 +01:00
|
|
|
crash_reporter::internal::TransitionalCrashKeyStorage;
|
|
|
|
CrashKeyStorage::Iterator crash_key_iterator(*info.crash_keys);
|
|
|
|
const CrashKeyStorage::Entry* entry;
|
|
|
|
+
|
|
|
|
+ crash_reporter::CrashReporterClient::ParameterMap parameters;
|
|
|
|
+
|
|
|
|
while ((entry = crash_key_iterator.Next())) {
|
|
|
|
if (g_use_crash_key_white_list && !IsInWhiteList(entry->key))
|
|
|
|
continue;
|
|
|
|
- writer.AddPairString(entry->key, entry->value);
|
|
|
|
+ parameters.insert(std::make_pair(entry->key, entry->value));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!parameters.empty())
|
|
|
|
+ parameters = GetCrashReporterClient()->FilterParameters(parameters);
|
|
|
|
+
|
|
|
|
+ for (const auto& param : parameters) {
|
|
|
|
+ writer.AddPairString(param.first.c_str(), param.second.c_str());
|
|
|
|
writer.AddBoundary();
|
|
|
|
writer.Flush();
|
|
|
|
}
|
2018-05-21 14:54:08 +02:00
|
|
|
@@ -2015,6 +2036,17 @@ void SetChannelCrashKey(const std::string& channel) {
|
2018-02-15 01:12:09 +01:00
|
|
|
channel_key.Set(channel);
|
2016-12-12 11:05:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+void SetCrashServerURL(const std::string& url) {
|
|
|
|
+ if (url.empty()) {
|
|
|
|
+ g_crash_server_url = nullptr;
|
|
|
|
+ } else {
|
|
|
|
+ char* new_url = new char[url.size() + 1];
|
|
|
|
+ ANNOTATE_LEAKING_OBJECT_PTR(new_url);
|
|
|
|
+ strcpy(new_url, url.c_str());
|
|
|
|
+ g_crash_server_url = new_url;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
#if defined(OS_ANDROID)
|
|
|
|
void InitNonBrowserCrashReporterForAndroid(const std::string& process_type) {
|
2017-03-03 23:37:23 +01:00
|
|
|
SanitizationInfo sanitization_info;
|
2016-12-12 11:05:29 +01:00
|
|
|
diff --git components/crash/content/app/breakpad_linux.h components/crash/content/app/breakpad_linux.h
|
2018-03-20 21:15:08 +01:00
|
|
|
index 9ee85554812c..7af55ddda8fe 100644
|
2016-12-12 11:05:29 +01:00
|
|
|
--- components/crash/content/app/breakpad_linux.h
|
|
|
|
+++ components/crash/content/app/breakpad_linux.h
|
2018-02-15 01:12:09 +01:00
|
|
|
@@ -19,6 +19,9 @@ extern void InitCrashReporter(const std::string& process_type);
|
|
|
|
// Sets the product/distribution channel crash key.
|
|
|
|
void SetChannelCrashKey(const std::string& channel);
|
2016-12-12 11:05:29 +01:00
|
|
|
|
|
|
|
+// Set the crash server URL.
|
|
|
|
+void SetCrashServerURL(const std::string& url);
|
|
|
|
+
|
|
|
|
#if defined(OS_ANDROID)
|
2017-04-20 21:28:17 +02:00
|
|
|
extern void InitCrashKeysForTesting();
|
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
diff --git components/crash/content/app/crash_reporter_client.cc components/crash/content/app/crash_reporter_client.cc
|
2018-07-02 19:11:49 +02:00
|
|
|
index f69c6c3ff26e..e0d402abd3fd 100644
|
2016-12-12 11:05:29 +01:00
|
|
|
--- components/crash/content/app/crash_reporter_client.cc
|
|
|
|
+++ components/crash/content/app/crash_reporter_client.cc
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -88,7 +88,7 @@ int CrashReporterClient::GetResultCodeRespawnFailed() {
|
2017-01-12 17:44:35 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS)
|
|
|
|
+#if defined(OS_POSIX) && !defined(OS_IOS)
|
|
|
|
void CrashReporterClient::GetProductNameAndVersion(const char** product_name,
|
|
|
|
const char** version) {
|
|
|
|
}
|
2018-05-21 14:54:08 +02:00
|
|
|
@@ -97,6 +97,7 @@ void CrashReporterClient::GetProductNameAndVersion(std::string* product_name,
|
|
|
|
std::string* version,
|
|
|
|
std::string* channel) {}
|
2017-01-12 17:44:35 +01:00
|
|
|
|
|
|
|
+#if !defined(OS_MACOSX)
|
|
|
|
base::FilePath CrashReporterClient::GetReporterLogFilename() {
|
|
|
|
return base::FilePath();
|
|
|
|
}
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -105,6 +106,7 @@ bool CrashReporterClient::HandleCrashDump(const char* crashdump_filename) {
|
2017-01-12 17:44:35 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
#if defined(OS_WIN)
|
|
|
|
bool CrashReporterClient::GetCrashDumpLocation(base::string16* crash_dir) {
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -147,6 +149,32 @@ bool CrashReporterClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) {
|
|
|
|
return false;
|
2016-12-12 11:05:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+bool CrashReporterClient::EnableBreakpadForProcess(
|
|
|
|
+ const std::string& process_type) {
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+std::string CrashReporterClient::GetCrashServerURL() {
|
|
|
|
+ return std::string();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void CrashReporterClient::GetCrashOptionalArguments(
|
|
|
|
+ std::vector<std::string>* arguments) {
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#if defined(OS_WIN)
|
|
|
|
+base::string16 CrashReporterClient::GetCrashExternalHandler(
|
|
|
|
+ const base::string16& exe_dir) {
|
|
|
|
+ return exe_dir + L"\\crashpad_handler.exe";
|
|
|
|
+}
|
|
|
|
+#endif
|
2017-02-06 20:23:59 +01:00
|
|
|
+
|
|
|
|
+#if defined(OS_MACOSX)
|
|
|
|
+bool CrashReporterClient::EnableBrowserCrashForwarding() {
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+#endif
|
2016-12-12 11:05:29 +01:00
|
|
|
+
|
|
|
|
#if defined(OS_ANDROID)
|
|
|
|
int CrashReporterClient::GetAndroidMinidumpDescriptor() {
|
|
|
|
return 0;
|
2018-07-02 19:11:49 +02:00
|
|
|
@@ -186,9 +214,11 @@ 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;
|
2018-02-15 01:12:09 +01:00
|
|
|
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
|
|
|
+CrashReporterClient::ParameterMap
|
|
|
|
+CrashReporterClient::FilterParameters(const ParameterMap& parameters) {
|
|
|
|
+ return parameters;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
} // namespace crash_reporter
|
|
|
|
diff --git components/crash/content/app/crash_reporter_client.h components/crash/content/app/crash_reporter_client.h
|
2018-07-02 19:11:49 +02:00
|
|
|
index 485c2c8bf638..7eb175c43b6c 100644
|
2016-12-12 11:05:29 +01:00
|
|
|
--- components/crash/content/app/crash_reporter_client.h
|
|
|
|
+++ components/crash/content/app/crash_reporter_client.h
|
2018-02-15 01:12:09 +01:00
|
|
|
@@ -5,7 +5,9 @@
|
|
|
|
#ifndef COMPONENTS_CRASH_CONTENT_APP_CRASH_REPORTER_CLIENT_H_
|
|
|
|
#define COMPONENTS_CRASH_CONTENT_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 "base/strings/string16.h"
|
|
|
|
#include "build/build_config.h"
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -91,7 +93,7 @@ class CrashReporterClient {
|
2017-01-12 17:44:35 +01:00
|
|
|
virtual int GetResultCodeRespawnFailed();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS)
|
|
|
|
+#if defined(OS_POSIX) && !defined(OS_IOS)
|
|
|
|
// 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
|
|
|
|
@@ -102,6 +104,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
|
|
|
|
|
|
|
+#if !defined(OS_MACOSX)
|
|
|
|
virtual base::FilePath GetReporterLogFilename();
|
|
|
|
|
|
|
|
// Custom crash minidump handler after the minidump is generated.
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -110,6 +113,7 @@ class CrashReporterClient {
|
2018-03-20 21:15:08 +01:00
|
|
|
// WARNING: this handler runs in a compromised context. It may not call into
|
2017-01-12 17:44:35 +01:00
|
|
|
// libc nor allocate memory normally.
|
|
|
|
virtual bool HandleCrashDump(const char* crashdump_filename);
|
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
|
2018-07-02 19:11:49 +02:00
|
|
|
@@ -197,6 +201,30 @@ 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);
|
|
|
|
+
|
|
|
|
+ // Returns the URL for submitting crash reports.
|
|
|
|
+ virtual std::string GetCrashServerURL();
|
|
|
|
+
|
|
|
|
+ // Populate |arguments| with additional optional arguments.
|
|
|
|
+ virtual void GetCrashOptionalArguments(std::vector<std::string>* arguments);
|
|
|
|
+
|
|
|
|
+#if defined(OS_WIN)
|
|
|
|
+ // Returns the absolute path to the external crash handler exe.
|
|
|
|
+ virtual base::string16 GetCrashExternalHandler(const base::string16& exe_dir);
|
2017-02-06 20:23:59 +01:00
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#if defined(OS_MACOSX)
|
|
|
|
+ // Returns true if forwarding of crashes to the system crash reporter is
|
|
|
|
+ // enabled for the browser process.
|
|
|
|
+ virtual bool EnableBrowserCrashForwarding();
|
2018-02-15 01:12:09 +01:00
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
|
|
|
+ // Provides an oportunity to modify the parameters that will be sent with a
|
|
|
|
+ // crash upload.
|
|
|
|
+ using ParameterMap = std::map<std::string, std::string>;
|
|
|
|
+ virtual ParameterMap FilterParameters(const ParameterMap& parameters);
|
2016-12-12 11:05:29 +01:00
|
|
|
+#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace crash_reporter
|
2017-02-06 20:23:59 +01:00
|
|
|
diff --git components/crash/content/app/crashpad.cc components/crash/content/app/crashpad.cc
|
2018-05-21 14:54:08 +02:00
|
|
|
index c6a98292bb5e..7cf360d3b340 100644
|
2017-02-06 20:23:59 +01:00
|
|
|
--- components/crash/content/app/crashpad.cc
|
|
|
|
+++ components/crash/content/app/crashpad.cc
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -147,7 +147,8 @@ void 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 ||
|
|
|
|
+ !crash_reporter_client->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
|
|
|
}
|
2016-12-12 11:05:29 +01:00
|
|
|
diff --git components/crash/content/app/crashpad_mac.mm components/crash/content/app/crashpad_mac.mm
|
2018-06-01 21:16:26 +02:00
|
|
|
index f06d903c2f41..6ec1442323e9 100644
|
2016-12-12 11:05:29 +01:00
|
|
|
--- components/crash/content/app/crashpad_mac.mm
|
|
|
|
+++ components/crash/content/app/crashpad_mac.mm
|
|
|
|
@@ -16,11 +16,14 @@
|
|
|
|
#include "base/logging.h"
|
|
|
|
#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/stringprintf.h"
|
|
|
|
#include "base/strings/sys_string_conversions.h"
|
|
|
|
#include "components/crash/content/app/crash_reporter_client.h"
|
|
|
|
+#include "components/crash/content/app/crash_switches.h"
|
|
|
|
+#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"
|
2018-06-01 21:16:26 +02:00
|
|
|
@@ -36,12 +39,25 @@ namespace {
|
|
|
|
std::map<std::string, std::string> GetProcessSimpleAnnotations() {
|
|
|
|
static std::map<std::string, std::string> annotations = []() -> auto {
|
|
|
|
std::map<std::string, std::string> process_annotations;
|
2017-04-27 03:59:52 +02:00
|
|
|
+
|
2018-06-01 21:16:26 +02:00
|
|
|
@autoreleasepool {
|
2017-01-12 17:44:35 +01:00
|
|
|
NSBundle* outer_bundle = base::mac::OuterBundle();
|
|
|
|
- NSString* product = base::mac::ObjCCast<NSString>([outer_bundle
|
|
|
|
- objectForInfoDictionaryKey:base::mac::CFToNSCast(kCFBundleNameKey)]);
|
|
|
|
- process_annotations["prod"] =
|
|
|
|
- base::SysNSStringToUTF8(product).append("_Mac");
|
|
|
|
+
|
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) {
|
|
|
|
+ NSString* product = base::mac::ObjCCast<NSString>([outer_bundle
|
|
|
|
+ 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");
|
|
|
|
+ } else {
|
2017-01-25 19:37:12 +01:00
|
|
|
+ process_annotations["product"] = product_name;
|
2017-01-12 17:44:35 +01:00
|
|
|
+ }
|
|
|
|
|
|
|
|
#if defined(GOOGLE_CHROME_BUILD)
|
2017-04-20 21:28:17 +02:00
|
|
|
// Empty means stable.
|
2018-06-01 21:16:26 +02:00
|
|
|
@@ -57,12 +73,16 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() {
|
2017-04-20 21:28:17 +02:00
|
|
|
process_annotations["channel"] = "";
|
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");
|
|
|
|
+ process_annotations["platform"] = std::string("macos");
|
2018-06-01 21:16:26 +02:00
|
|
|
} // @autoreleasepool
|
|
|
|
return process_annotations;
|
|
|
|
}();
|
|
|
|
@@ -119,9 +139,10 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client,
|
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 =
|
|
|
|
- framework_bundle_path.Append("Helpers").Append("crashpad_handler");
|
|
|
|
+ // 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();
|
|
|
|
@@ -133,7 +154,7 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client,
|
|
|
|
// crash server won't have symbols for any other build types.
|
|
|
|
std::string url = "https://clients2.google.com/cr/report";
|
|
|
|
#else
|
|
|
|
- std::string url;
|
|
|
|
+ std::string url = crash_reporter_client->GetCrashServerURL();
|
|
|
|
#endif
|
2017-04-20 21:28:17 +02:00
|
|
|
|
2018-06-01 21:16:26 +02:00
|
|
|
std::vector<std::string> arguments;
|
|
|
|
@@ -156,6 +177,12 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client,
|
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(
|
2018-06-01 21:16:26 +02:00
|
|
|
handler_path, database_path, metrics_path, url,
|
|
|
|
GetProcessSimpleAnnotations(), arguments, true, false);
|
2016-12-12 11:05:29 +01:00
|
|
|
diff --git components/crash/content/app/crashpad_win.cc components/crash/content/app/crashpad_win.cc
|
2018-04-19 17:44:42 +02:00
|
|
|
index 8b0edef1b594..22555bb9dc77 100644
|
2016-12-12 11:05:29 +01:00
|
|
|
--- components/crash/content/app/crashpad_win.cc
|
|
|
|
+++ components/crash/content/app/crashpad_win.cc
|
2017-09-06 23:40:58 +02:00
|
|
|
@@ -34,8 +34,8 @@ void GetPlatformCrashpadAnnotations(
|
2017-01-25 19:37:12 +01:00
|
|
|
base::string16 product_name, version, special_build, channel_name;
|
|
|
|
crash_reporter_client->GetProductNameAndVersion(
|
|
|
|
exe_file, &product_name, &version, &special_build, &channel_name);
|
|
|
|
- (*annotations)["prod"] = base::UTF16ToUTF8(product_name);
|
|
|
|
- (*annotations)["ver"] = base::UTF16ToUTF8(version);
|
|
|
|
+ (*annotations)["product"] = base::UTF16ToUTF8(product_name);
|
|
|
|
+ (*annotations)["version"] = base::UTF16ToUTF8(version);
|
2017-04-20 21:28:17 +02:00
|
|
|
#if defined(GOOGLE_CHROME_BUILD)
|
|
|
|
// Empty means stable.
|
|
|
|
const bool allow_empty_channel = true;
|
2017-09-06 23:40:58 +02:00
|
|
|
@@ -47,9 +47,9 @@ void GetPlatformCrashpadAnnotations(
|
2017-01-25 19:37:12 +01:00
|
|
|
if (!special_build.empty())
|
|
|
|
(*annotations)["special"] = base::UTF16ToUTF8(special_build);
|
|
|
|
#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");
|
2017-01-25 19:37:12 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -62,7 +62,9 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client,
|
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());
|
|
|
|
if (initial_client) {
|
|
|
|
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -82,13 +84,13 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client,
|
2018-03-28 23:15:05 +02:00
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
#if defined(GOOGLE_CHROME_BUILD)
|
|
|
|
std::string url = "https://clients2.google.com/cr/report";
|
2018-03-28 23:15:05 +02:00
|
|
|
-#else
|
2016-12-12 11:05:29 +01:00
|
|
|
- std::string url;
|
2018-03-28 23:15:05 +02:00
|
|
|
-#endif
|
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);
|
|
|
|
+#else
|
|
|
|
+ std::string url = crash_reporter_client->GetCrashServerURL();
|
|
|
|
+#endif
|
|
|
|
|
2018-04-19 17:44:42 +02:00
|
|
|
base::FilePath exe_file(exe_path);
|
|
|
|
if (exe_file.empty()) {
|
|
|
|
@@ -106,13 +108,14 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client,
|
2017-01-13 21:23:19 +01:00
|
|
|
crashpad::TriState::kEnabled, kIndirectMemoryLimit);
|
|
|
|
}
|
|
|
|
|
|
|
|
- // 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.).
|
2017-04-20 21:28:17 +02:00
|
|
|
std::vector<std::string> start_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);
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -123,9 +126,12 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client,
|
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()) {
|
2016-12-12 11:05:29 +01:00
|
|
|
diff --git content/browser/frame_host/debug_urls.cc content/browser/frame_host/debug_urls.cc
|
2018-04-19 17:44:42 +02:00
|
|
|
index f66e16a2ebc2..23118ffbeb4b 100644
|
2016-12-12 11:05:29 +01:00
|
|
|
--- content/browser/frame_host/debug_urls.cc
|
|
|
|
+++ content/browser/frame_host/debug_urls.cc
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -129,7 +129,9 @@ bool HandleDebugURL(const GURL& url, ui::PageTransition transition) {
|
2016-12-12 11:05:29 +01:00
|
|
|
cc::switches::kEnableGpuBenchmarking) &&
|
|
|
|
(PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_TYPED));
|
|
|
|
|
|
|
|
- if (!(transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) &&
|
|
|
|
+ // CEF does not use PAGE_TRANSITION_FROM_ADDRESS_BAR.
|
|
|
|
+ if (!(transition & (ui::PAGE_TRANSITION_TYPED ||
|
|
|
|
+ ui::PAGE_TRANSITION_FROM_ADDRESS_BAR)) &&
|
|
|
|
!is_telemetry_navigation)
|
|
|
|
return false;
|
|
|
|
|