5050#include " util/posix/signals.h"
5151#include " util/posix/spawn_subprocess.h"
5252
53+ #if defined(CRASHPAD_USE_BORINGSSL) && BUILDFLAG(IS_ANDROID)
54+ #include " util/backtrace/android_cert_store.h"
55+ #endif
56+
5357namespace crashpad {
5458
5559namespace {
@@ -449,6 +453,10 @@ bool CrashpadClient::StartHandler(
449453 const std::vector<base::FilePath>& attachments) {
450454 DCHECK (!asynchronous_start);
451455
456+ #if defined(CRASHPAD_USE_BORINGSSL) && BUILDFLAG(IS_ANDROID)
457+ backtrace::android_cert_store::create (database);
458+ #endif
459+
452460 ScopedFileHandle client_sock, handler_sock;
453461 if (!UnixCredentialSocket::CreateCredentialSocketpair (&client_sock,
454462 &handler_sock)) {
@@ -467,6 +475,11 @@ bool CrashpadClient::StartHandler(
467475 argv.push_back (" --annotation=run-uuid=" + run_uuid_.ToString ());
468476 }
469477
478+ if (uuid_override_enabled_) {
479+ argv.push_back (" --annotation=_backtrace_internal_guid_override=" +
480+ uuid_override_.ToString ());
481+ }
482+
470483 if (!SpawnSubprocess (argv, nullptr , handler_sock.get (), false , nullptr )) {
471484 return false ;
472485 }
@@ -501,6 +514,21 @@ int CrashpadClient::ConsecutiveCrashesCount(const base::FilePath& database)
501514}
502515#endif
503516
517+ bool CrashpadClient::OverrideGuid (const std::string& uuid)
518+ {
519+ UUID new_uuid;
520+ if (!new_uuid.InitializeFromString (uuid))
521+ return false ;
522+ return OverrideGuid (new_uuid);
523+ }
524+
525+ bool CrashpadClient::OverrideGuid (const UUID& uuid)
526+ {
527+ uuid_override_enabled_ = true ;
528+ uuid_override_ = uuid;
529+ return true ;
530+ }
531+
504532#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
505533// static
506534bool CrashpadClient::GetHandlerSocket (int * sock, pid_t * pid) {
@@ -707,13 +735,22 @@ bool CrashpadClient::StartHandlerAtCrash(
707735 std::vector<std::string> argv = BuildHandlerArgvStrings (
708736 handler, database, metrics_dir, url, annotations, arguments, attachments);
709737
738+ #if defined(CRASHPAD_USE_BORINGSSL) && BUILDFLAG(IS_ANDROID)
739+ backtrace::android_cert_store::create (database);
740+ #endif
741+
710742 if (crash_loop_detection_) {
711743 namespace clc = backtrace::crash_loop_detection;
712744 bool ok = clc::CrashLoopDetectionAppend (database, run_uuid_);
713745 DCHECK (ok);
714746 argv.push_back (" --annotation=run-uuid=" + run_uuid_.ToString ());
715747 }
716748
749+ if (uuid_override_enabled_) {
750+ argv.push_back (" --annotation=_backtrace_internal_guid_override=" +
751+ uuid_override_.ToString ());
752+ }
753+
717754 auto signal_handler = LaunchAtCrashHandler::Get ();
718755 return signal_handler->Initialize (&argv, nullptr , &unhandled_signals_);
719756}
0 commit comments