From 496d522cc43957bf3e8e645d8d3224f2c279c21c Mon Sep 17 00:00:00 2001 From: Justin Cohen Date: Thu, 20 Jan 2022 13:26:49 -0500 Subject: [PATCH] ios: Add comment explaining why iOS only installs a SIGABRT handler. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xnu turns hardware faults into Mach exceptions, so the only signal left to register is SIGABRT, which never starts off as a hardware fault. Installing a handler for other signals would lead to recording exceptions twice. As a consequence, Crashpad will not generate intermediate dumps for anything manually calling raise(SIG*). In practice, this doesn’t actually happen for crash signals that originate as hardware faults. Change-Id: I1be669d10e89b8e8ebcc69cfdf79c1ee20c96f76 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3403042 Reviewed-by: Mark Mentovai Commit-Queue: Justin Cohen --- client/crashpad_client_ios.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/crashpad_client_ios.cc b/client/crashpad_client_ios.cc index 467cc0cf..7c378ba7 100644 --- a/client/crashpad_client_ios.cc +++ b/client/crashpad_client_ios.cc @@ -71,6 +71,13 @@ class CrashHandler : public Thread, if (!in_process_handler_.Initialize( database, url, annotations, system_data_) || !InstallMachExceptionHandler() || + // xnu turns hardware faults into Mach exceptions, so the only signal + // left to register is SIGABRT, which never starts off as a hardware + // fault. Installing a handler for other signals would lead to + // recording exceptions twice. As a consequence, Crashpad will not + // generate intermediate dumps for anything manually calling + // raise(SIG*). In practice, this doesn’t actually happen for crash + // signals that originate as hardware faults. !Signals::InstallHandler(SIGABRT, CatchSignal, 0, &old_action_)) { LOG(ERROR) << "Unable to initialize Crashpad."; return false;