Commit 783fdeb0 authored by James Cook's avatar James Cook Committed by Commit Bot

chromeos: Use chrome's crash reporter for mash services

Mash services like tap_visualizer are launched as utility processes
so Chrome's crash reporting system works fine with them. Using chrome's
crash system gives us Chrome's version number for the crashes (which
makes sense, since the services are built into the chrome binary),
support for chrome-specific crash features like crash-keys, etc.

Override the process type with the service name so these crashes
show up independently in the crash console, similar to what we do for
extension renderers.

Bug: 846123
Test: browser_tests, also kill -SEGV the tap_visualizer process and check reports
Change-Id: I133aedcf1f263beb2d349e9bc24e5b3624d03ea8
Reviewed-on: https://chromium-review.googlesource.com/1072205Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561656}
parent 27b08932
......@@ -674,6 +674,24 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
return crash_handler->GetDeathSignalSocket();
}
#if defined(OS_CHROMEOS)
// Mash services are utility processes, but crashes are reported using the
// service name as the process type to make the crash console easier to read.
if (command_line.HasSwitch(switches::kMashServiceName)) {
static base::NoDestructor<
std::map<std::string, breakpad::CrashHandlerHostLinux*>>
crash_handlers;
std::string service_name =
command_line.GetSwitchValueASCII(switches::kMashServiceName);
auto it = crash_handlers->find(service_name);
if (it == crash_handlers->end()) {
crash_handlers->insert(
std::make_pair(service_name, CreateCrashHandlerHost(service_name)));
}
return crash_handlers->at(service_name)->GetDeathSignalSocket();
}
#endif // defined(OS_CHROMEOS)
std::string process_type =
command_line.GetSwitchValueASCII(switches::kProcessType);
......@@ -1806,14 +1824,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
client_info->client_id);
}
#elif defined(OS_POSIX)
bool enable_crash_reporter = breakpad::IsCrashReporterEnabled();
#if defined(OS_CHROMEOS)
// Chrome OS uses the OS-level crash_reporter for mash services, so disable
// breakpad in-process crashing dumping.
if (command_line->HasSwitch(switches::kMashServiceName))
enable_crash_reporter = false;
#endif
if (enable_crash_reporter) {
if (breakpad::IsCrashReporterEnabled()) {
std::string switch_value;
std::unique_ptr<metrics::ClientInfo> client_info =
GoogleUpdateSettings::LoadMetricsClientInfo();
......
......@@ -50,8 +50,8 @@ bool HasSubstring(base::StringPiece str, base::StringPiece sub) {
using ChromeContentBrowserClientMashTest = InProcessBrowserTest;
// Verifies that mash service child processes do not use in-process breakpad
// crash dumping.
// Verifies that mash service child processes use in-process breakpad crash
// dumping.
IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientMashTest, CrashReporter) {
if (chromeos::GetAshConfig() != ash::Config::MASH)
return;
......@@ -76,8 +76,8 @@ IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientMashTest, CrashReporter) {
// spaces, which makes them hard to tokenize. Just search the whole string.
if (HasSubstring(cmdline, switches::kMashServiceName)) {
++mash_service_count;
// Mash services should not use in-process breakpad crash dumping.
EXPECT_FALSE(HasSubstring(cmdline, switches::kEnableCrashReporter));
// Mash services use in-process breakpad crash dumping.
EXPECT_TRUE(HasSubstring(cmdline, switches::kEnableCrashReporter));
}
}
// There's at least one mash service, for ash.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment