Commit 80846d48 authored by Jonathan Ross's avatar Jonathan Ross Committed by Commit Bot

Revert "linux: Enable Crashpad for content shell"

This reverts commit 9747ecdd.

Reason for revert: This is potentially crashing vulkan_blink_web_tests on Intel. 

A failure of one test in the following run, lead to a crash of the entire test suite: https://ci.chromium.org/p/chromium/builders/ci/Linux%20FYI%20SkiaRenderer%20Vulkan%20%28Intel%20HD%20630%29/1639

Original change's description:
> linux: Enable Crashpad for content shell
> 
> Bug: 942279
> Change-Id: I221431e352f11b40c3bc39bbcd8297b431dd8f0c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1763346
> Commit-Queue: Joshua Peraza <jperaza@chromium.org>
> Reviewed-by: Peter Beverloo <peter@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#699880}

TBR=jperaza@chromium.org

Change-Id: I117aa67f345510a5eb9ae77ec60ea5122ac12b16
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 942279
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825920Reviewed-by: default avatarJonathan Ross <jonross@chromium.org>
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699972}
parent a149bcd3
...@@ -629,9 +629,7 @@ if (is_android) { ...@@ -629,9 +629,7 @@ if (is_android) {
configs -= [ "//build/config/win:console" ] configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ] configs += [ "//build/config/win:windowed" ]
} }
}
if (is_win || is_linux) {
data_deps += data_deps +=
[ "//third_party/crashpad/crashpad/handler:crashpad_handler" ] [ "//third_party/crashpad/crashpad/handler:crashpad_handler" ]
} }
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
#include "content/shell/android/shell_descriptors.h" #include "content/shell/android/shell_descriptors.h"
#endif #endif
#if !defined(OS_FUCHSIA) #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_ANDROID)
#include "components/crash/content/app/crashpad.h" // nogncheck #include "components/crash/content/app/crashpad.h" // nogncheck
#endif #endif
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
#endif #endif
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
#include "components/crash/content/app/breakpad_linux.h"
#include "v8/include/v8-wasm-trap-handler-posix.h" #include "v8/include/v8-wasm-trap-handler-posix.h"
#endif #endif
...@@ -169,7 +170,9 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { ...@@ -169,7 +170,9 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
v8_crashpad_support::SetUp(); v8_crashpad_support::SetUp();
#endif #endif
#if defined(OS_LINUX)
breakpad::SetFirstChanceExceptionHandler(v8::TryHandleWebAssemblyTrapPosix);
#endif
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// Needs to happen before InitializeResourceBundle() and before // Needs to happen before InitializeResourceBundle() and before
// BlinkTestPlatformInitialize() are called. // BlinkTestPlatformInitialize() are called.
...@@ -326,14 +329,13 @@ void ShellMainDelegate::PreSandboxStartup() { ...@@ -326,14 +329,13 @@ void ShellMainDelegate::PreSandboxStartup() {
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kProcessType); switches::kProcessType);
crash_reporter::SetCrashReporterClient(g_shell_crash_client.Pointer()); crash_reporter::SetCrashReporterClient(g_shell_crash_client.Pointer());
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_ANDROID)
crash_reporter::InitializeCrashpad(process_type.empty(), process_type);
#elif defined(OS_LINUX)
// Reporting for sub-processes will be initialized in ZygoteForked. // Reporting for sub-processes will be initialized in ZygoteForked.
if (process_type != service_manager::switches::kZygoteProcess) { if (process_type != service_manager::switches::kZygoteProcess)
crash_reporter::InitializeCrashpad(process_type.empty(), process_type); breakpad::InitCrashReporter(process_type);
#if defined(OS_LINUX) #endif // defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_ANDROID)
crash_reporter::SetFirstChanceExceptionHandler(
v8::TryHandleWebAssemblyTrapPosix);
#endif
}
} }
#endif // !defined(OS_FUCHSIA) #endif // !defined(OS_FUCHSIA)
...@@ -394,9 +396,7 @@ void ShellMainDelegate::ZygoteForked() { ...@@ -394,9 +396,7 @@ void ShellMainDelegate::ZygoteForked() {
std::string process_type = std::string process_type =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kProcessType); switches::kProcessType);
crash_reporter::InitializeCrashpad(false, process_type); breakpad::InitCrashReporter(process_type);
crash_reporter::SetFirstChanceExceptionHandler(
v8::TryHandleWebAssemblyTrapPosix);
} }
} }
#endif // defined(OS_LINUX) #endif // defined(OS_LINUX)
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/client_certificate_delegate.h"
...@@ -65,6 +64,7 @@ ...@@ -65,6 +64,7 @@
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "base/android/apk_assets.h" #include "base/android/apk_assets.h"
#include "base/android/path_utils.h" #include "base/android/path_utils.h"
#include "components/crash/content/app/crashpad.h"
#include "content/shell/android/shell_descriptors.h" #include "content/shell/android/shell_descriptors.h"
#endif #endif
...@@ -72,13 +72,9 @@ ...@@ -72,13 +72,9 @@
#include "content/public/browser/context_factory.h" #include "content/public/browser/context_factory.h"
#endif #endif
#if defined(OS_ANDROID)
#include "components/crash/content/browser/crash_handler_host_linux.h"
#endif
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_ANDROID)
#include "components/crash/content/app/crash_switches.h" #include "base/debug/leak_annotations.h"
#include "components/crash/content/app/crashpad.h" #include "components/crash/content/browser/crash_handler_host_linux.h"
#include "content/public/common/content_descriptors.h" #include "content/public/common/content_descriptors.h"
#endif #endif
...@@ -103,12 +99,52 @@ int GetCrashSignalFD(const base::CommandLine& command_line) { ...@@ -103,12 +99,52 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
return crashpad::CrashHandlerHost::Get()->GetDeathSignalSocket(); return crashpad::CrashHandlerHost::Get()->GetDeathSignalSocket();
} }
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
const std::string& process_type) {
base::FilePath dumps_path =
base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
switches::kCrashDumpsDir);
{
ANNOTATE_SCOPED_MEMORY_LEAK;
breakpad::CrashHandlerHostLinux* crash_handler =
new breakpad::CrashHandlerHostLinux(
process_type, dumps_path, false);
crash_handler->StartUploaderThread();
return crash_handler;
}
}
int GetCrashSignalFD(const base::CommandLine& command_line) { int GetCrashSignalFD(const base::CommandLine& command_line) {
int fd; if (!breakpad::IsCrashReporterEnabled())
pid_t pid; return -1;
return crash_reporter::GetHandlerSocket(&fd, &pid) ? fd : -1;
std::string process_type =
command_line.GetSwitchValueASCII(switches::kProcessType);
if (process_type == switches::kRendererProcess) {
static breakpad::CrashHandlerHostLinux* crash_handler = nullptr;
if (!crash_handler)
crash_handler = CreateCrashHandlerHost(process_type);
return crash_handler->GetDeathSignalSocket();
}
if (process_type == switches::kPpapiPluginProcess) {
static breakpad::CrashHandlerHostLinux* crash_handler = nullptr;
if (!crash_handler)
crash_handler = CreateCrashHandlerHost(process_type);
return crash_handler->GetDeathSignalSocket();
}
if (process_type == switches::kGpuProcess) {
static breakpad::CrashHandlerHostLinux* crash_handler = nullptr;
if (!crash_handler)
crash_handler = CreateCrashHandlerHost(process_type);
return crash_handler->GetDeathSignalSocket();
}
return -1;
} }
#endif #endif // defined(OS_ANDROID)
const service_manager::Manifest& GetContentBrowserOverlayManifest() { const service_manager::Manifest& GetContentBrowserOverlayManifest() {
static base::NoDestructor<service_manager::Manifest> manifest{ static base::NoDestructor<service_manager::Manifest> manifest{
...@@ -292,15 +328,6 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches( ...@@ -292,15 +328,6 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
if (base::CommandLine::ForCurrentProcess()->HasSwitch( if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableCrashReporter)) { switches::kEnableCrashReporter)) {
command_line->AppendSwitch(switches::kEnableCrashReporter); command_line->AppendSwitch(switches::kEnableCrashReporter);
#if defined(OS_LINUX)
int fd;
pid_t pid;
if (crash_reporter::GetHandlerSocket(&fd, &pid)) {
command_line->AppendSwitchASCII(
crash_reporter::switches::kCrashpadHandlerPid,
base::NumberToString(pid));
}
#endif // OS_LINUX
} }
if (base::CommandLine::ForCurrentProcess()->HasSwitch( if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kCrashDumpsDir)) { switches::kCrashDumpsDir)) {
......
...@@ -148,12 +148,12 @@ def run_test(options, crash_dir, symbols_dir, platform, ...@@ -148,12 +148,12 @@ def run_test(options, crash_dir, symbols_dir, platform,
print '# Retrieve crash dump.' print '# Retrieve crash dump.'
if platform == 'android': if platform == 'android':
minidump = get_android_dump(crash_dir) dmp_file = get_android_dump(crash_dir)
else: else:
dmp_dir = crash_dir dmp_dir = crash_dir
# TODO(crbug.com/782923): This test should not reach directly into the # TODO(crbug.com/782923): This test should not reach directly into the
# Crashpad database, but instead should use crashpad_database_util. # Crashpad database, but instead should use crashpad_database_util.
if platform == 'darwin' or platform == 'linux2': if platform == 'darwin':
dmp_dir = os.path.join(dmp_dir, 'pending') dmp_dir = os.path.join(dmp_dir, 'pending')
elif platform == 'win32': elif platform == 'win32':
dmp_dir = os.path.join(dmp_dir, 'reports') dmp_dir = os.path.join(dmp_dir, 'reports')
...@@ -162,13 +162,24 @@ def run_test(options, crash_dir, symbols_dir, platform, ...@@ -162,13 +162,24 @@ def run_test(options, crash_dir, symbols_dir, platform,
failure = 'Expected 1 crash dump, found %d.' % len(dmp_files) failure = 'Expected 1 crash dump, found %d.' % len(dmp_files)
if len(dmp_files) != 1: if len(dmp_files) != 1:
raise Exception(failure) raise Exception(failure)
minidump = dmp_files[0] dmp_file = dmp_files[0]
if platform not in ('darwin', 'win32', 'android'):
minidump = os.path.join(crash_dir, 'minidump')
dmp_to_minidump = os.path.join(BREAKPAD_TOOLS_DIR, 'dmp2minidump.py')
cmd = [dmp_to_minidump, dmp_file, minidump]
if options.verbose:
print ' '.join(cmd)
failure = 'Failed to run dmp_to_minidump.'
subprocess.check_call(cmd)
else:
minidump = dmp_file
print '# Symbolize crash dump.' print '# Symbolize crash dump.'
if platform == 'win32': if platform == 'win32':
cdb_exe = os.path.join(options.build_dir, 'cdb', 'cdb.exe') cdb_exe = os.path.join(options.build_dir, 'cdb', 'cdb.exe')
cmd = [cdb_exe, '-y', options.build_dir, '-c', '.lines;.excr;k30;q', cmd = [cdb_exe, '-y', options.build_dir, '-c', '.lines;.excr;k30;q',
'-z', minidump] '-z', dmp_file]
if options.verbose: if options.verbose:
print ' '.join(cmd) print ' '.join(cmd)
failure = 'Failed to run cdb.exe.' failure = 'Failed to run cdb.exe.'
...@@ -188,7 +199,7 @@ def run_test(options, crash_dir, symbols_dir, platform, ...@@ -188,7 +199,7 @@ def run_test(options, crash_dir, symbols_dir, platform,
# Check whether the stack contains a CrashIntentionally symbol. # Check whether the stack contains a CrashIntentionally symbol.
found_symbol = 'CrashIntentionally' in stack found_symbol = 'CrashIntentionally' in stack
os.remove(minidump) os.remove(dmp_file)
if options.no_symbols: if options.no_symbols:
if found_symbol: if found_symbol:
......
...@@ -16,6 +16,12 @@ building. This slows down linking several minutes, so don't just always set it ...@@ -16,6 +16,12 @@ building. This slows down linking several minutes, so don't just always set it
by default. by default.
*** ***
*** note
**Linux:** Add `use_debug_fission = true` to your [gn build
arguments](https://gn.googlesource.com/gn/+/master/docs/quick_start.md) before
building.
***
Then, create a directory where the crash dumps will be stored: Then, create a directory where the crash dumps will be stored:
* Linux/Mac: * Linux/Mac:
...@@ -61,9 +67,13 @@ Crashpad can be enabled by passing `--enable-crash-reporter` and ...@@ -61,9 +67,13 @@ Crashpad can be enabled by passing `--enable-crash-reporter` and
## Retrieving the crash dump ## Retrieving the crash dump
On Android, we first have to retrieve the crash dump. On other platforms, this On Linux and Android, we first have to retrieve the crash dump. On Mac and
step can be skipped. Windows, this step can be skipped.
* Linux:
```bash
components/crash/content/tools/dmp2minidump.py /tmp/crashes/*.dmp /tmp/minidump
```
* Android: * Android:
```bash ```bash
adb pull $(adb shell ls /data/data/org.chromium.content_shell_apk/cache/pending/*.dmp) /tmp/chromium-renderer-minidump.dmp adb pull $(adb shell ls /data/data/org.chromium.content_shell_apk/cache/pending/*.dmp) /tmp/chromium-renderer-minidump.dmp
......
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