0

Move Linux/Android breakpad implementation to breakpad component

Also split up breakpad component in more subdirectories and tighten up DEPS
rules

BUG=247431
R=rsesek@chromium.org
TBR=darin@chromium.org

Review URL: https://codereview.chromium.org/31243002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229964 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
jochen@chromium.org
2013-10-22 00:11:03 +00:00
parent 774a58c3ad
commit 0b818f7b22
37 changed files with 231 additions and 158 deletions

@ -157,7 +157,7 @@ _BANNED_CPP_FUNCTIONS = (
),
True,
(
r"^components[\\\/]breakpad[\\\/]breakpad_mac\.mm$",
r"^components[\\\/]breakpad[\\\/]app[\\\/]breakpad_mac\.mm$",
r"^content[\\\/]shell[\\\/]browser[\\\/]shell_browser_main\.cc$",
r"^content[\\\/]shell[\\\/]browser[\\\/]shell_message_filter\.cc$",
r"^net[\\\/]disk_cache[\\\/]cache_util\.cc$",

@ -19,5 +19,4 @@ include_rules = [
"+policy", # For generated headers and source
"+sandbox",
"+tools/memory_watcher",
"+third_party/lss/linux_syscall_support.h",
]

@ -7,7 +7,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "components/breakpad/breakpad_client.h"
#include "components/breakpad/app/breakpad_client.h"
namespace chrome {

@ -18,8 +18,8 @@
#include "chrome/browser/policy/policy_path_parser.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
#include "components/breakpad/breakpad_client.h"
#include "components/breakpad/breakpad_win.h"
#include "components/breakpad/app/breakpad_client.h"
#include "components/breakpad/app/breakpad_win.h"
#include "content/public/app/startup_helper_win.h"
#include "content/public/common/result_codes.h"
#include "sandbox/win/src/sandbox_factory.h"

@ -59,7 +59,7 @@
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/mac/cfbundle_blocker.h"
#include "chrome/common/mac/objc_zombie.h"
#include "components/breakpad/breakpad_mac.h"
#include "components/breakpad/app/breakpad_mac.h"
#include "grit/chromium_strings.h"
#include "ui/base/l10n/l10n_util_mac.h"
#endif
@ -68,7 +68,7 @@
#include <locale.h>
#include <signal.h>
#include "chrome/app/chrome_breakpad_client.h"
#include "components/breakpad/breakpad_client.h"
#include "components/breakpad/app/breakpad_client.h"
#endif
#if !defined(DISABLE_NACL) && defined(OS_LINUX)
@ -98,7 +98,7 @@
#endif
#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "chrome/app/breakpad_linux.h"
#include "components/breakpad/app/breakpad_linux.h"
#endif
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
@ -739,9 +739,9 @@ void ChromeMainDelegate::PreSandboxStartup() {
// need to call InitCrashReporter() in RunZygote().
if (!process_type.empty() && process_type != switches::kZygoteProcess) {
#if defined(OS_ANDROID)
InitNonBrowserCrashReporterForAndroid();
breakpad::InitNonBrowserCrashReporterForAndroid();
#else
InitCrashReporter();
breakpad::InitCrashReporter();
#endif
}
#endif
@ -845,7 +845,7 @@ void ChromeMainDelegate::ZygoteForked() {
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets
// this up for the browser process in a different manner.
InitCrashReporter();
breakpad::InitCrashReporter();
// Reset the command line for the newly spawned process.
crash_keys::SetSwitchesFromCommandLine(CommandLine::ForCurrentProcess());

@ -31,7 +31,7 @@
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/util_constants.h"
#include "components/breakpad/breakpad_win.h"
#include "components/breakpad/app/breakpad_win.h"
namespace {
// The entry point signature of chrome.dll.

@ -8,10 +8,10 @@
#include "base/debug/trace_event.h"
#include "base/path_service.h"
#include "cc/base/switches.h"
#include "chrome/app/breakpad_linux.h"
#include "chrome/browser/android/crash_dump_manager.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "components/breakpad/app/breakpad_linux.h"
#include "components/breakpad/browser/crash_dump_manager_android.h"
#include "content/public/browser/android/compositor.h"
#include "content/public/common/main_function_params.h"
#include "net/android/network_change_notifier_factory_android.h"
@ -44,10 +44,10 @@ void ChromeBrowserMainPartsAndroid::PreProfileInit() {
switches::kEnableCrashReporterForTesting);
if (breakpad_enabled) {
InitCrashReporter();
breakpad::InitCrashReporter();
base::FilePath crash_dump_dir;
PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_dir);
crash_dump_manager_.reset(new CrashDumpManager(crash_dump_dir));
crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dump_dir));
}
ChromeBrowserMainParts::PreProfileInit();

@ -7,7 +7,9 @@
#include "chrome/browser/chrome_browser_main.h"
namespace breakpad {
class CrashDumpManager;
}
class ChromeBrowserMainPartsAndroid : public ChromeBrowserMainParts {
public:
@ -24,7 +26,7 @@ class ChromeBrowserMainPartsAndroid : public ChromeBrowserMainParts {
private:
scoped_ptr<base::MessageLoop> main_message_loop_;
scoped_ptr<CrashDumpManager> crash_dump_manager_;
scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager_;
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsAndroid);
};

@ -9,12 +9,12 @@
#include "base/command_line.h"
#include "base/linux_util.h"
#include "base/prefs/pref_service.h"
#include "chrome/app/breakpad_linux.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/env_vars.h"
#include "chrome/common/pref_names.h"
#include "components/breakpad/app/breakpad_linux.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/settings/cros_settings.h"
@ -122,7 +122,7 @@ void ChromeBrowserMainPartsLinux::PreProfileInit() {
#endif
if (IsCrashReportingEnabled(local_state()))
InitCrashReporter();
breakpad::InitCrashReporter();
ChromeBrowserMainPartsPosix::PreProfileInit();
}
@ -131,5 +131,5 @@ void ChromeBrowserMainPartsLinux::PostProfileInit() {
ChromeBrowserMainPartsPosix::PostProfileInit();
g_browser_process->metrics_service()->RecordBreakpadRegistration(
IsCrashReporterEnabled());
breakpad::IsCrashReporterEnabled());
}

@ -23,7 +23,7 @@
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "components/breakpad/breakpad_mac.h"
#include "components/breakpad/app/breakpad_mac.h"
#include "content/public/common/main_function_params.h"
#include "content/public/common/result_codes.h"
#include "ui/base/l10n/l10n_util_mac.h"

@ -152,7 +152,7 @@
#elif defined(OS_MACOSX)
#include "chrome/browser/chrome_browser_main_mac.h"
#include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h"
#include "components/breakpad/breakpad_mac.h"
#include "components/breakpad/app/breakpad_mac.h"
#elif defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
#include "chrome/browser/chromeos/drive/file_system_backend_delegate.h"
@ -164,11 +164,11 @@
#elif defined(OS_LINUX)
#include "chrome/browser/chrome_browser_main_linux.h"
#elif defined(OS_ANDROID)
#include "chrome/browser/android/crash_dump_manager.h"
#include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h"
#include "chrome/browser/chrome_browser_main_android.h"
#include "chrome/browser/media/encrypted_media_message_filter_android.h"
#include "chrome/common/descriptors_android.h"
#include "components/breakpad/browser/crash_dump_manager_android.h"
#elif defined(OS_POSIX)
#include "chrome/browser/chrome_browser_main_posix.h"
#endif
@ -176,8 +176,8 @@
#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "base/debug/leak_annotations.h"
#include "base/linux_util.h"
#include "chrome/app/breakpad_linux.h"
#include "chrome/browser/crash_handler_host_linux.h"
#include "components/breakpad/app/breakpad_linux.h"
#include "components/breakpad/browser/crash_handler_host_linux.h"
#endif
#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
@ -254,10 +254,6 @@ using extensions::Extension;
using extensions::Manifest;
using message_center::NotifierId;
#if defined(OS_MACOSX)
using breakpad::IsCrashReporterEnabled;
#endif
namespace {
// Cached version of the locale so we can return the locale on the I/O
@ -495,13 +491,15 @@ void FillFontFamilyMap(const PrefService* prefs,
}
#if defined(OS_POSIX) && !defined(OS_MACOSX)
CrashHandlerHostLinux* CreateCrashHandlerHost(const std::string& process_type) {
breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
const std::string& process_type) {
base::FilePath dumps_path;
PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path);
{
ANNOTATE_SCOPED_MEMORY_LEAK;
CrashHandlerHostLinux* crash_handler = new CrashHandlerHostLinux(
process_type, dumps_path, getenv(env_vars::kHeadless) == NULL);
breakpad::CrashHandlerHostLinux* crash_handler =
new breakpad::CrashHandlerHostLinux(
process_type, dumps_path, getenv(env_vars::kHeadless) == NULL);
crash_handler->StartUploaderThread();
return crash_handler;
}
@ -509,7 +507,7 @@ CrashHandlerHostLinux* CreateCrashHandlerHost(const std::string& process_type) {
int GetCrashSignalFD(const CommandLine& command_line) {
if (command_line.HasSwitch(switches::kExtensionProcess)) {
static CrashHandlerHostLinux* crash_handler = NULL;
static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
if (!crash_handler)
crash_handler = CreateCrashHandlerHost("extension");
return crash_handler->GetDeathSignalSocket();
@ -519,28 +517,28 @@ int GetCrashSignalFD(const CommandLine& command_line) {
command_line.GetSwitchValueASCII(switches::kProcessType);
if (process_type == switches::kRendererProcess) {
static CrashHandlerHostLinux* crash_handler = NULL;
static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
if (!crash_handler)
crash_handler = CreateCrashHandlerHost(process_type);
return crash_handler->GetDeathSignalSocket();
}
if (process_type == switches::kPluginProcess) {
static CrashHandlerHostLinux* crash_handler = NULL;
static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
if (!crash_handler)
crash_handler = CreateCrashHandlerHost(process_type);
return crash_handler->GetDeathSignalSocket();
}
if (process_type == switches::kPpapiPluginProcess) {
static CrashHandlerHostLinux* crash_handler = NULL;
static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
if (!crash_handler)
crash_handler = CreateCrashHandlerHost(process_type);
return crash_handler->GetDeathSignalSocket();
}
if (process_type == switches::kGpuProcess) {
static CrashHandlerHostLinux* crash_handler = NULL;
static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
if (!crash_handler)
crash_handler = CreateCrashHandlerHost(process_type);
return crash_handler->GetDeathSignalSocket();
@ -1366,7 +1364,7 @@ std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName(
void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
CommandLine* command_line, int child_process_id) {
#if defined(OS_POSIX)
if (IsCrashReporterEnabled()) {
if (breakpad::IsCrashReporterEnabled()) {
std::string enable_crash_reporter;
GoogleUpdateSettings::GetMetricsId(&enable_crash_reporter);
#if !defined(OS_MACOSX)
@ -2530,8 +2528,9 @@ void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor,
FileDescriptor(f, true)));
if (IsCrashReporterEnabled()) {
f = CrashDumpManager::GetInstance()->CreateMinidumpFile(child_process_id);
if (breakpad::IsCrashReporterEnabled()) {
f = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile(
child_process_id);
if (f == base::kInvalidPlatformFileValue) {
LOG(ERROR) << "Failed to create file for minidump, crash reporting will "
"be disabled for this process.";

@ -19,7 +19,6 @@
#include "base/prefs/pref_service.h"
#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "chrome/app/breakpad_linux.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
@ -58,6 +57,7 @@
#include "chromeos/dbus/session_manager_client.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/settings/cros_settings_names.h"
#include "components/breakpad/app/breakpad_linux.h"
#include "content/public/browser/browser_thread.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/l10n/l10n_util.h"
@ -482,7 +482,7 @@ void WizardController::OnEulaAccepted() {
#if defined(GOOGLE_CHROME_BUILD)
// The crash reporter initialization needs IO to complete.
base::ThreadRestrictions::ScopedAllowIO allow_io;
InitCrashReporter();
breakpad::InitCrashReporter();
#endif
}

@ -29,7 +29,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/common/pref_names.h"
#include "chrome/installer/util/google_update_settings.h"
#import "components/breakpad/breakpad_mac.h"
#import "components/breakpad/app/breakpad_mac.h"
#endif
@interface FirstRunDialogController (PrivateMethods)

@ -10,7 +10,6 @@
#include "base/i18n/rtl.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/breakpad_linux.h"
#include "chrome/browser/first_run/first_run_dialog.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/process_singleton.h"
@ -20,6 +19,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/installer/util/google_update_settings.h"
#include "components/breakpad/app/breakpad_linux.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@ -164,7 +164,7 @@ void FirstRunDialog::OnResponseDialog(GtkWidget* widget, int response) {
if (report_crashes_ &&
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(report_crashes_))) {
if (GoogleUpdateSettings::SetCollectStatsConsent(true))
InitCrashReporter();
breakpad::InitCrashReporter();
} else {
GoogleUpdateSettings::SetCollectStatsConsent(false);
}

@ -103,8 +103,6 @@
'browser/android/chromium_application.h',
'browser/android/content_view_util.cc',
'browser/android/content_view_util.h',
'browser/android/crash_dump_manager.cc',
'browser/android/crash_dump_manager.h',
'browser/android/dev_tools_server.cc',
'browser/android/dev_tools_server.h',
'browser/android/favicon_helper.cc',
@ -3043,23 +3041,12 @@
}],
['os_posix == 1 and OS != "mac" and OS != "ios"', {
'sources': [
'app/breakpad_linux.cc',
'app/breakpad_linux.h',
'app/chrome_breakpad_client.cc',
'app/chrome_breakpad_client.h',
'browser/crash_handler_host_linux.cc',
'browser/crash_handler_host_linux.h',
],
'dependencies': [
'../breakpad/breakpad.gyp:breakpad_client',
'../components/components.gyp:breakpad_component',
# make sure file_version_info_linux.h is generated first.
'common',
],
'include_dirs': [
# breakpad_linux.cc uses generated file_version_info_linux.h.
'<(SHARED_INTERMEDIATE_DIR)',
'../breakpad/src',
'../components/components.gyp:breakpad_host',
],
}],
['use_nss==1', {
@ -3508,16 +3495,6 @@
]
}]
],
'target_conditions': [
# Need 'target_conditions' to override default filename_rules to include
# the files on Android.
['OS=="android"', {
'sources/': [
['include', '^app/breakpad_linux\\.cc$'],
['include', '^browser/crash_handler_host_linux\\.cc$'],
],
}],
],
},
{
# Protobuf compiler / generator for the fraudulent certificate reporting

@ -16,8 +16,8 @@
#include "chrome/app/chrome_breakpad_client.h"
#include "chrome/common/chrome_result_codes.h"
#include "chrome/common/logging_chrome.h"
#include "components/breakpad/breakpad_client.h"
#include "components/breakpad/breakpad_win.h"
#include "components/breakpad/app/breakpad_client.h"
#include "components/breakpad/app/breakpad_win.h"
#include "components/nacl/broker/nacl_broker_listener.h"
#include "components/nacl/common/nacl_switches.h"
#include "components/nacl/loader/nacl_listener.h"

@ -9,21 +9,28 @@
},
'target_conditions': [
['breakpad_component_target==1', {
'defines': ['BREAKPAD_IMPLEMENTATION'],
'sources': [
'breakpad/breakpad_client.cc',
'breakpad/breakpad_client.h',
'breakpad/breakpad_mac.h',
'breakpad/breakpad_mac.mm',
'breakpad/breakpad_win.cc',
'breakpad/breakpad_win.h',
'breakpad/hard_error_handler_win.cc',
'breakpad/hard_error_handler_win.h',
'breakpad/app/breakpad_client.cc',
'breakpad/app/breakpad_client.h',
'breakpad/app/breakpad_linux.cc',
'breakpad/app/breakpad_linux.h',
'breakpad/app/breakpad_linux_impl.h',
'breakpad/app/breakpad_mac.h',
'breakpad/app/breakpad_mac.mm',
'breakpad/app/breakpad_win.cc',
'breakpad/app/breakpad_win.h',
'breakpad/app/hard_error_handler_win.cc',
'breakpad/app/hard_error_handler_win.h',
],
}],
],
},
'targets': [
{
# Note: if you depend on this target, you need to either link in
# content.gyp:content_common, or add
# content/public/common/content_switches.cc to your sources.
'target_name': 'breakpad_component',
'type': 'static_library',
'variables': {
@ -36,7 +43,6 @@
['OS=="mac"', {
'dependencies': [
'../breakpad/breakpad.gyp:breakpad',
'../content/content.gyp:content_common',
],
}],
['OS=="win"', {
@ -46,6 +52,23 @@
'../sandbox/sandbox.gyp:sandbox',
],
}],
['os_posix == 1 and OS != "mac" and OS != "ios"', {
'dependencies': [
'../breakpad/breakpad.gyp:breakpad_client',
],
'include_dirs': [
'../breakpad/src',
],
}],
],
'target_conditions': [
# Need 'target_conditions' to override default filename_rules to include
# the files on Android.
['OS=="android"', {
'sources/': [
['include', '^breakpad/app/breakpad_linux\\.cc$'],
],
}],
],
},
],
@ -70,6 +93,9 @@
['OS=="win" and target_arch=="ia32"', {
'targets': [
{
# Note: if you depend on this target, you need to either link in
# content.gyp:content_common, or add
# content/public/common/content_switches.cc to your sources.
'target_name': 'breakpad_win64',
'type': 'static_library',
'variables': {
@ -116,10 +142,43 @@
'../base/base.gyp:base',
],
'sources': [
'breakpad/breakpad_client.cc',
'breakpad/breakpad_client.h',
'breakpad/breakpad_mac.h',
'breakpad/breakpad_mac_stubs.mm',
'breakpad/app/breakpad_client.cc',
'breakpad/app/breakpad_client.h',
'breakpad/app/breakpad_mac.h',
'breakpad/app/breakpad_mac_stubs.mm',
],
},
],
}],
['os_posix == 1 and OS != "mac" and OS != "ios"', {
'targets': [
{
'target_name': 'breakpad_host',
'type': 'static_library',
'dependencies': [
'breakpad_component',
'../base/base.gyp:base',
'../breakpad/breakpad.gyp:breakpad_client',
'../content/content.gyp:content_browser',
'../content/content.gyp:content_common',
],
'sources': [
'breakpad/browser/crash_dump_manager_android.cc',
'breakpad/browser/crash_dump_manager_android.h',
'breakpad/browser/crash_handler_host_linux.cc',
'breakpad/browser/crash_handler_host_linux.h',
],
'include_dirs': [
'../breakpad/src',
],
'target_conditions': [
# Need 'target_conditions' to override default filename_rules to include
# the files on Android.
['OS=="android"', {
'sources/': [
['include', '^breakpad/browser/crash_handler_host_linux\\.cc$'],
],
}],
],
},
],

@ -1,4 +1,3 @@
include_rules = [
"+breakpad",
"+sandbox",
]

@ -0,0 +1,9 @@
include_rules = [
"+sandbox",
"-content/public/common",
"+content/public/common/content_descriptors.h",
"+content/public/common/content_switches.h",
"+content/public/common/result_codes.h",
"+third_party/lss/linux_syscall_support.h",
]

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/breakpad/breakpad_client.h"
#include "components/breakpad/app/breakpad_client.h"
#include "base/files/file_path.h"
#include "base/logging.h"

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_BREAKPAD_BREAKPAD_CLIENT_H_
#define COMPONENTS_BREAKPAD_BREAKPAD_CLIENT_H_
#ifndef COMPONENTS_BREAKPAD_APP_BREAKPAD_CLIENT_H_
#define COMPONENTS_BREAKPAD_APP_BREAKPAD_CLIENT_H_
#include <string>
@ -33,8 +33,10 @@ class BreakpadClient;
// breakpad code is called, and should stay alive throughout the entire runtime.
void SetBreakpadClient(BreakpadClient* client);
#if defined(BREAKPAD_IMPLEMENTATION)
// Breakpad's embedder API should only be used by breakpad.
BreakpadClient* GetBreakpadClient();
#endif
// Interface that the embedder implements.
class BreakpadClient {
@ -139,4 +141,4 @@ class BreakpadClient {
} // namespace breakpad
#endif // COMPONENTS_BREAKPAD_BREAKPAD_CLIENT_H_
#endif // COMPONENTS_BREAKPAD_APP_BREAKPAD_CLIENT_H_

@ -1,11 +1,11 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// For linux_syscall_support.h. This makes it safe to call embedded system
// calls when in seccomp mode.
#include "chrome/app/breakpad_linux.h"
#include "components/breakpad/app/breakpad_linux.h"
#include <fcntl.h>
#include <poll.h>
@ -37,8 +37,8 @@
#include "breakpad/src/client/linux/minidump_writer/directory_reader.h"
#include "breakpad/src/common/linux/linux_libc_support.h"
#include "breakpad/src/common/memory.h"
#include "chrome/app/breakpad_linux_impl.h"
#include "components/breakpad/breakpad_client.h"
#include "components/breakpad/app/breakpad_client.h"
#include "components/breakpad/app/breakpad_linux_impl.h"
#include "content/public/common/content_descriptors.h"
#include "content/public/common/content_switches.h"
@ -72,6 +72,8 @@
using google_breakpad::ExceptionHandler;
using google_breakpad::MinidumpDescriptor;
namespace breakpad {
namespace {
#if !defined(OS_CHROMEOS)
@ -209,11 +211,10 @@ void SetClientIdFromCommandLine(const CommandLine& command_line) {
command_line.GetSwitchValueASCII(switches::kEnableCrashReporter);
size_t separator = switch_value.find(",");
if (separator != std::string::npos) {
breakpad::GetBreakpadClient()->SetClientID(
switch_value.substr(0, separator));
GetBreakpadClient()->SetClientID(switch_value.substr(0, separator));
base::SetLinuxDistro(switch_value.substr(separator + 1));
} else {
breakpad::GetBreakpadClient()->SetClientID(switch_value);
GetBreakpadClient()->SetClientID(switch_value);
}
}
@ -634,9 +635,9 @@ void EnableCrashDumping(bool unattended) {
PathService::Get(base::DIR_TEMP, &tmp_path);
base::FilePath dumps_path(tmp_path);
if (breakpad::GetBreakpadClient()->GetCrashDumpLocation(&dumps_path)) {
base::FilePath logfile = dumps_path.Append(
breakpad::GetBreakpadClient()->GetReporterLogFilename());
if (GetBreakpadClient()->GetCrashDumpLocation(&dumps_path)) {
base::FilePath logfile =
dumps_path.Append(GetBreakpadClient()->GetReporterLogFilename());
std::string logfile_str = logfile.value();
const size_t crash_log_path_len = logfile_str.size() + 1;
g_crash_log_path = new char[crash_log_path_len];
@ -1166,8 +1167,7 @@ void HandleCrashDump(const BreakpadInfo& info) {
std::string product_name;
std::string version;
breakpad::GetBreakpadClient()->GetProductNameAndVersion(&product_name,
&version);
GetBreakpadClient()->GetProductNameAndVersion(&product_name, &version);
writer.AddBoundary();
writer.AddPairString("prod", product_name.c_str());
@ -1452,7 +1452,7 @@ void InitCrashReporter() {
const std::string process_type =
parsed_command_line.GetSwitchValueASCII(switches::kProcessType);
if (process_type.empty()) {
EnableCrashDumping(breakpad::GetBreakpadClient()->IsRunningUnattended());
EnableCrashDumping(GetBreakpadClient()->IsRunningUnattended());
} else if (process_type == switches::kRendererProcess ||
process_type == switches::kPluginProcess ||
process_type == switches::kPpapiPluginProcess ||
@ -1478,14 +1478,14 @@ void InitCrashReporter() {
SetProcessStartTime();
breakpad::GetBreakpadClient()->SetDumpWithoutCrashingFunction(&DumpProcess);
GetBreakpadClient()->SetDumpWithoutCrashingFunction(&DumpProcess);
#if defined(ADDRESS_SANITIZER)
// Register the callback for AddressSanitizer error reporting.
__asan_set_error_report_callback(AsanLinuxBreakpadCallback);
#endif
g_crash_keys = new CrashKeyStorage;
breakpad::GetBreakpadClient()->RegisterCrashKeys();
GetBreakpadClient()->RegisterCrashKeys();
base::debug::SetCrashKeyReportingFunctions(
&SetCrashKeyValue, &ClearCrashKey);
}
@ -1497,8 +1497,8 @@ void InitNonBrowserCrashReporterForAndroid() {
// On Android we need to provide a FD to the file where the minidump is
// generated as the renderer and browser run with different UIDs
// (preventing the browser from inspecting the renderer process).
int minidump_fd = base::GlobalDescriptors::GetInstance()->
MaybeGet(breakpad::GetBreakpadClient()->GetAndroidMinidumpDescriptor());
int minidump_fd = base::GlobalDescriptors::GetInstance()->MaybeGet(
GetBreakpadClient()->GetAndroidMinidumpDescriptor());
if (minidump_fd == base::kInvalidPlatformFileValue) {
NOTREACHED() << "Could not find minidump FD, crash reporting disabled.";
} else {
@ -1511,3 +1511,5 @@ void InitNonBrowserCrashReporterForAndroid() {
bool IsCrashReporterEnabled() {
return g_is_crash_reporter_enabled;
}
} // namespace breakpad

@ -1,14 +1,16 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Public interface for enabling Breakpad on Linux systems.
#ifndef CHROME_APP_BREAKPAD_LINUX_H_
#define CHROME_APP_BREAKPAD_LINUX_H_
#ifndef COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_H_
#define COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_H_
#include "build/build_config.h"
namespace breakpad {
// Turns on the crash reporter in any process.
extern void InitCrashReporter();
@ -22,4 +24,6 @@ extern void InitNonBrowserCrashReporterForAndroid();
// whether InitCrashReporter() is called.
bool IsCrashReporterEnabled();
#endif // CHROME_APP_BREAKPAD_LINUX_H_
} // namespace breakpad
#endif // COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_H_

@ -6,14 +6,16 @@
// shared between crash_handler_host_linux.cc and breakpad_linux.cc. It should
// only be used in files compiled with linux_breakpad=1.
#ifndef CHROME_APP_BREAKPAD_LINUX_IMPL_H_
#define CHROME_APP_BREAKPAD_LINUX_IMPL_H_
#ifndef COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_IMPL_H_
#define COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_IMPL_H_
#include <sys/types.h>
#include "base/basictypes.h"
#include "breakpad/src/common/simple_string_dictionary.h"
#include "chrome/app/breakpad_linux.h"
#include "components/breakpad/app/breakpad_linux.h"
namespace breakpad {
typedef google_breakpad::NonAllocatingMap<256, 256, 64> CrashKeyStorage;
@ -59,4 +61,6 @@ struct BreakpadInfo {
extern void HandleCrashDump(const BreakpadInfo& info);
#endif // CHROME_APP_BREAKPAD_LINUX_IMPL_H_
} // namespace breakpad
#endif // COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_IMPL_H_

@ -1,9 +1,9 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_BREAKPAD_BREAKPAD_MAC_H_
#define COMPONENTS_BREAKPAD_BREAKPAD_MAC_H_
#ifndef COMPONENTS_BREAKPAD_APP_BREAKPAD_MAC_H_
#define COMPONENTS_BREAKPAD_APP_BREAKPAD_MAC_H_
// This header defines the entry points for Breakpad integration.
@ -22,4 +22,4 @@ bool IsCrashReporterEnabled();
} // namespace breakpad
#endif // COMPONENTS_BREAKPAD_BREAKPAD_MAC_H_
#endif // COMPONENTS_BREAKPAD_APP_BREAKPAD_MAC_H_

@ -1,8 +1,8 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "components/breakpad/breakpad_mac.h"
#import "components/breakpad/app/breakpad_mac.h"
#include <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
@ -23,7 +23,7 @@
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
#import "breakpad/src/client/mac/Framework/Breakpad.h"
#include "components/breakpad/breakpad_client.h"
#include "components/breakpad/app/breakpad_client.h"
#include "content/public/common/content_switches.h"
namespace breakpad {

@ -1,8 +1,8 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "components/breakpad/breakpad_mac.h"
#import "components/breakpad/app/breakpad_mac.h"
#import <Foundation/Foundation.h>

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/breakpad/breakpad_win.h"
#include "components/breakpad/app/breakpad_win.h"
#include <windows.h>
#include <shellapi.h>
@ -29,8 +29,8 @@
#include "base/win/registry.h"
#include "base/win/win_util.h"
#include "breakpad/src/client/windows/handler/exception_handler.h"
#include "components/breakpad/breakpad_client.h"
#include "components/breakpad/hard_error_handler_win.h"
#include "components/breakpad/app/breakpad_client.h"
#include "components/breakpad/app/hard_error_handler_win.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
#include "sandbox/win/src/nt_internals.h"

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_BREAKPAD_BREAKPAD_WIN_H_
#define COMPONENTS_BREAKPAD_BREAKPAD_WIN_H_
#ifndef COMPONENTS_BREAKPAD_APP_BREAKPAD_WIN_H_
#define COMPONENTS_BREAKPAD_APP_BREAKPAD_WIN_H_
#include <windows.h>
#include <string>
@ -19,4 +19,4 @@ bool ShowRestartDialogIfCrashed(bool* exit_now);
} // namespace breakpad
#endif // COMPONENTS_BREAKPAD_BREAKPAD_WIN_H_
#endif // COMPONENTS_BREAKPAD_APP_BREAKPAD_WIN_H_

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/breakpad/hard_error_handler_win.h"
#include "components/breakpad/app/hard_error_handler_win.h"
#if defined(_WIN32_WINNT_WIN8) && _MSC_VER < 1700
// The Windows 8 SDK defines FACILITY_VISUALCPP in winerror.h, and in
@ -14,7 +14,7 @@
#include "base/basictypes.h"
#include "base/strings/string_util.h"
#include "components/breakpad/breakpad_client.h"
#include "components/breakpad/app/breakpad_client.h"
namespace breakpad {

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_BREAKPAD_HARD_ERROR_HANDLER_WIN_H_
#define COMPONENTS_BREAKPAD_HARD_ERROR_HANDLER_WIN_H_
#ifndef COMPONENTS_BREAKPAD_APP_HARD_ERROR_HANDLER_WIN_H_
#define COMPONENTS_BREAKPAD_APP_HARD_ERROR_HANDLER_WIN_H_
#include <windows.h>
@ -31,4 +31,4 @@ bool HardErrorHandler(EXCEPTION_POINTERS* ex_info);
} // namespace breakpad
#endif // COMPONENTS_BREAKPAD_HARD_ERROR_HANDLER_WIN_H_
#endif // COMPONENTS_BREAKPAD_APP_HARD_ERROR_HANDLER_WIN_H_

@ -0,0 +1,4 @@
include_rules = [
"+content/public/browser",
"+content/public/common",
]

@ -1,8 +1,8 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/android/crash_dump_manager.h"
#include "components/breakpad/browser/crash_dump_manager_android.h"
#include "base/bind.h"
#include "base/file_util.h"
@ -22,6 +22,8 @@
using content::BrowserThread;
namespace breakpad {
// static
CrashDumpManager* CrashDumpManager::instance_ = NULL;
@ -167,3 +169,5 @@ void CrashDumpManager::OnChildExit(int child_process_id,
BrowserThread::FILE, FROM_HERE,
base::Bind(&CrashDumpManager::ProcessMinidump, minidump_path, pid));
}
} // namespace breakpad

@ -1,9 +1,9 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_
#define CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_
#ifndef COMPONENTS_BREAKPAD_BROWSER_CRASH_DUMP_MANAGER_ANDROID_H_
#define COMPONENTS_BREAKPAD_BROWSER_CRASH_DUMP_MANAGER_ANDROID_H_
#include <map>
@ -19,6 +19,8 @@ namespace content {
class RenderProcessHost;
}
namespace breakpad {
// This class manages the crash minidumps.
// On Android, because of process isolation, each renderer process runs with a
// different UID. As a result, we cannot generate the minidumps in the browser
@ -31,10 +33,12 @@ class RenderProcessHost;
class CrashDumpManager : public content::BrowserChildProcessObserver,
public content::NotificationObserver {
public:
// This object is a singleton created and owned by the
// ChromeBrowserMainPartsAndroid.
// The embedder should create a single instance of the CrashDumpManager.
static CrashDumpManager* GetInstance();
// Should be created on the UI thread.
explicit CrashDumpManager(const base::FilePath& crash_dump_dir);
virtual ~CrashDumpManager();
// Returns a file descriptor that should be used to generate a minidump for
@ -42,11 +46,6 @@ class CrashDumpManager : public content::BrowserChildProcessObserver,
int CreateMinidumpFile(int child_process_id);
private:
friend class ChromeBrowserMainPartsAndroid;
// Should be created on the UI thread.
explicit CrashDumpManager(const base::FilePath& crash_dump_dir);
typedef std::map<int, base::FilePath> ChildProcessIDToMinidumpPath;
static void ProcessMinidump(const base::FilePath& minidump_path,
@ -80,4 +79,6 @@ class CrashDumpManager : public content::BrowserChildProcessObserver,
DISALLOW_COPY_AND_ASSIGN(CrashDumpManager);
};
#endif // CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_
} // namespace breakpad
#endif // COMPONENTS_BREAKPAD_BROWSER_CRASH_DUMP_MANAGER_ANDROID_H_

@ -1,8 +1,8 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/crash_handler_host_linux.h"
#include "components/breakpad/browser/crash_handler_host_linux.h"
#include <stdint.h>
#include <stdlib.h>
@ -27,7 +27,7 @@
#include "breakpad/src/client/linux/handler/exception_handler.h"
#include "breakpad/src/client/linux/minidump_writer/linux_dumper.h"
#include "breakpad/src/client/linux/minidump_writer/minidump_writer.h"
#include "chrome/app/breakpad_linux_impl.h"
#include "components/breakpad/app/breakpad_linux_impl.h"
#include "content/public/browser/browser_thread.h"
#if defined(OS_ANDROID)
@ -39,6 +39,8 @@
using content::BrowserThread;
using google_breakpad::ExceptionHandler;
namespace breakpad {
namespace {
// The length of the control message:
@ -128,7 +130,7 @@ void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) {
// for writing the minidump as well as a file descriptor and a credentials
// block so that they can't lie about their pid.
//
// The message sender is in chrome/app/breakpad_linux.cc.
// The message sender is in components/breakpad/app/breakpad_linux.cc.
struct msghdr msg = {0};
struct iovec iov[kCrashIovSize];
@ -450,3 +452,5 @@ void CrashHandlerHostLinux::WillDestroyCurrentMessageLoop() {
bool CrashHandlerHostLinux::IsShuttingDown() const {
return shutting_down_;
}
} // namespace breakpad

@ -1,9 +1,9 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_
#define CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_
#ifndef COMPONENTS_BREAKPAD_BROWSER_CRASH_HANDLER_HOST_LINUX_H_
#define COMPONENTS_BREAKPAD_BROWSER_CRASH_HANDLER_HOST_LINUX_H_
#include <sys/types.h>
@ -15,12 +15,14 @@
#include "base/message_loop/message_loop.h"
#include "base/threading/sequenced_worker_pool.h"
struct BreakpadInfo;
namespace base {
class Thread;
}
namespace breakpad {
struct BreakpadInfo;
// This is the host for processes which run breakpad inside the sandbox on
// Linux or Android. We perform the crash dump from the browser because it
// allows us to be outside the sandbox.
@ -90,4 +92,6 @@ class CrashHandlerHostLinux : public base::MessageLoopForIO::Watcher,
DISALLOW_COPY_AND_ASSIGN(CrashHandlerHostLinux);
};
#endif // CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_
} // namespace breakpad
#endif // COMPONENTS_BREAKPAD_BROWSER_CRASH_HANDLER_HOST_LINUX_H_

@ -5,7 +5,7 @@
// This module contains the necessary code to register the Breakpad exception
// handler. This implementation is based on Chrome/Chrome Frame crash reporting
// code. See:
// - src/components/breakpad/breakpad_win.cc
// - src/components/breakpad/app/breakpad_win.cc
// - src/chrome_frame/crash_server_init.cc
// - src/chrome/installer/setup/setup_main.cc
// - src/chrome_frame/crash_reporting/crash_report.cc