feat: support crashpad on linux (#29719)
This commit is contained in:
parent
612361c4da
commit
c9ba0d02d7
13 changed files with 547 additions and 455 deletions
|
@ -44,6 +44,7 @@
|
|||
#include "base/guid.h"
|
||||
#include "components/crash/core/app/breakpad_linux.h"
|
||||
#include "components/crash/core/common/crash_keys.h"
|
||||
#include "components/upload_list/combining_upload_list.h"
|
||||
#include "v8/include/v8-wasm-trap-handler-posix.h"
|
||||
#include "v8/include/v8.h"
|
||||
#endif
|
||||
|
@ -150,16 +151,29 @@ void Start(const std::string& submit_url,
|
|||
? "node"
|
||||
: command_line->GetSwitchValueASCII(::switches::kProcessType);
|
||||
#if defined(OS_LINUX)
|
||||
::crash_keys::SetMetricsClientIdFromGUID(GetClientId());
|
||||
auto& global_crash_keys = GetGlobalCrashKeysMutable();
|
||||
for (const auto& pair : global_extra) {
|
||||
global_crash_keys[pair.first] = pair.second;
|
||||
if (::crash_reporter::IsCrashpadEnabled()) {
|
||||
for (const auto& pair : extra)
|
||||
electron::crash_keys::SetCrashKey(pair.first, pair.second);
|
||||
{
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
::crash_reporter::InitializeCrashpad(process_type.empty(), process_type);
|
||||
}
|
||||
if (ignore_system_crash_handler) {
|
||||
crashpad::CrashpadInfo::GetCrashpadInfo()
|
||||
->set_system_crash_reporter_forwarding(crashpad::TriState::kDisabled);
|
||||
}
|
||||
} else {
|
||||
::crash_keys::SetMetricsClientIdFromGUID(GetClientId());
|
||||
auto& global_crash_keys = GetGlobalCrashKeysMutable();
|
||||
for (const auto& pair : global_extra) {
|
||||
global_crash_keys[pair.first] = pair.second;
|
||||
}
|
||||
for (const auto& pair : extra)
|
||||
electron::crash_keys::SetCrashKey(pair.first, pair.second);
|
||||
for (const auto& pair : global_extra)
|
||||
electron::crash_keys::SetCrashKey(pair.first, pair.second);
|
||||
breakpad::InitCrashReporter(process_type);
|
||||
}
|
||||
for (const auto& pair : extra)
|
||||
electron::crash_keys::SetCrashKey(pair.first, pair.second);
|
||||
for (const auto& pair : global_extra)
|
||||
electron::crash_keys::SetCrashKey(pair.first, pair.second);
|
||||
breakpad::InitCrashReporter(process_type);
|
||||
#elif defined(OS_MAC)
|
||||
for (const auto& pair : extra)
|
||||
electron::crash_keys::SetCrashKey(pair.first, pair.second);
|
||||
|
@ -203,7 +217,20 @@ scoped_refptr<UploadList> CreateCrashUploadList() {
|
|||
base::PathService::Get(electron::DIR_CRASH_DUMPS, &crash_dir_path);
|
||||
base::FilePath upload_log_path =
|
||||
crash_dir_path.AppendASCII(CrashUploadList::kReporterLogFilename);
|
||||
return base::MakeRefCounted<TextLogUploadList>(upload_log_path);
|
||||
scoped_refptr<UploadList> result =
|
||||
base::MakeRefCounted<TextLogUploadList>(upload_log_path);
|
||||
if (crash_reporter::IsCrashpadEnabled()) {
|
||||
// Crashpad keeps the records of C++ crashes (segfaults, etc) in its
|
||||
// internal database. The JavaScript error reporter writes JS error upload
|
||||
// records to the older text format. Combine the two to present a complete
|
||||
// list to the user.
|
||||
// TODO(nornagon): what is "The JavaScript error reporter", and do we care
|
||||
// about it?
|
||||
std::vector<scoped_refptr<UploadList>> uploaders = {
|
||||
base::MakeRefCounted<CrashUploadListCrashpad>(), std::move(result)};
|
||||
result = base::MakeRefCounted<CombiningUploadList>(std::move(uploaders));
|
||||
}
|
||||
return result;
|
||||
#endif // defined(OS_MAC) || defined(OS_WIN)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue