feat: support crashpad on linux (#29719)
This commit is contained in:
parent
612361c4da
commit
c9ba0d02d7
13 changed files with 547 additions and 455 deletions
|
@ -58,7 +58,8 @@
|
|||
#endif
|
||||
|
||||
#if !defined(MAS_BUILD)
|
||||
#include "components/crash/core/app/crashpad.h" // nogncheck
|
||||
#include "components/crash/core/app/crash_switches.h" // nogncheck
|
||||
#include "components/crash/core/app/crashpad.h" // nogncheck
|
||||
#include "components/crash/core/common/crash_key.h"
|
||||
#include "components/crash/core/common/crash_keys.h"
|
||||
#include "shell/app/electron_crash_reporter_client.h"
|
||||
|
@ -369,9 +370,19 @@ void ElectronMainDelegate::PreSandboxStartup() {
|
|||
#endif
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
// Zygote needs to call InitCrashReporter() in RunZygote().
|
||||
if (process_type != ::switches::kZygoteProcess && !process_type.empty()) {
|
||||
ElectronCrashReporterClient::Create();
|
||||
breakpad::InitCrashReporter(process_type);
|
||||
if (crash_reporter::IsCrashpadEnabled()) {
|
||||
if (command_line->HasSwitch(
|
||||
crash_reporter::switches::kCrashpadHandlerPid)) {
|
||||
crash_reporter::InitializeCrashpad(false, process_type);
|
||||
crash_reporter::SetFirstChanceExceptionHandler(
|
||||
v8::TryHandleWebAssemblyTrapPosix);
|
||||
}
|
||||
} else {
|
||||
breakpad::InitCrashReporter(process_type);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -466,7 +477,16 @@ void ElectronMainDelegate::ZygoteForked() {
|
|||
base::CommandLine::ForCurrentProcess();
|
||||
std::string process_type =
|
||||
command_line->GetSwitchValueASCII(::switches::kProcessType);
|
||||
breakpad::InitCrashReporter(process_type);
|
||||
if (crash_reporter::IsCrashpadEnabled()) {
|
||||
if (command_line->HasSwitch(
|
||||
crash_reporter::switches::kCrashpadHandlerPid)) {
|
||||
crash_reporter::InitializeCrashpad(false, process_type);
|
||||
crash_reporter::SetFirstChanceExceptionHandler(
|
||||
v8::TryHandleWebAssemblyTrapPosix);
|
||||
}
|
||||
} else {
|
||||
breakpad::InitCrashReporter(process_type);
|
||||
}
|
||||
|
||||
// Reset the command line for the newly spawned process.
|
||||
crash_keys::SetCrashKeysFromCommandLine(*command_line);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue