Index: util/mach/mach_extensions.cc |
diff --git a/util/mach/mach_extensions.cc b/util/mach/mach_extensions.cc |
index a3e147cc3bee2b01d7f5c5fab6eb639f52dfa7f2..c2343c218085c5abe8b9d099c75c21cf698fb3ec 100644 |
--- a/util/mach/mach_extensions.cc |
+++ b/util/mach/mach_extensions.cc |
@@ -16,6 +16,7 @@ |
#include <AvailabilityMacros.h> |
#include <pthread.h> |
+#include <servers/bootstrap.h> |
#include "base/mac/mach_logging.h" |
#include "util/mac/mac_util.h" |
@@ -96,4 +97,19 @@ exception_mask_t ExcMaskValid() { |
return kExcMaskValid_10_11; |
} |
+base::mac::ScopedMachSendRight SystemCrashReporterHandler() { |
+ const char kSystemCrashReporterServiceName[] = "com.apple.ReportCrash"; |
+ exception_handler_t system_crash_reporter_handler; |
+ kern_return_t kr = bootstrap_look_up(bootstrap_port, |
+ kSystemCrashReporterServiceName, |
+ &system_crash_reporter_handler); |
+ if (kr != BOOTSTRAP_SUCCESS) { |
+ BOOTSTRAP_LOG(ERROR, kr) << "bootstrap_look_up " |
+ << kSystemCrashReporterServiceName; |
+ system_crash_reporter_handler = MACH_PORT_NULL; |
+ } |
+ |
+ return base::mac::ScopedMachSendRight(system_crash_reporter_handler); |
+} |
+ |
} // namespace crashpad |