@@ -167,3 +167,57 @@ require memory allocation, fetching and reading remote files and so on).
167167You shouldn't try to run ``swift-backtrace `` yourself; it has unusual
168168requirements, which vary from platform to platform. Instead, it will be
169169triggered automatically by the runtime.
170+
171+ System specifics
172+ ----------------
173+
174+ macOS
175+ ^^^^^
176+
177+ On macOS, we catch crashes and other events using a signal handler. At time of
178+ writing, this is installed for the following signals:
179+
180+ +--------------+--------------------------+-------------------------------------+
181+ | Signal | Description | Comment |
182+ +====+=========+==========================+=====================================+
183+ | 3 | SIGQUIT | Quit program | |
184+ +----+---------+--------------------------+-------------------------------------+
185+ | 4 | SIGILL | Illegal instruction | |
186+ +----+---------+--------------------------+-------------------------------------+
187+ | 5 | SIGTRAP | Trace trap | |
188+ +----+---------+--------------------------+-------------------------------------+
189+ | 6 | SIGABRT | Abort program | |
190+ +----+---------+--------------------------+-------------------------------------+
191+ | 8 | SIGFPE | Floating point exception | On Intel, integer divide by zero |
192+ | | | | also triggers this. |
193+ +----+---------+--------------------------+-------------------------------------+
194+ | 10 | SIGBUS | Bus error | |
195+ +----+---------+--------------------------+-------------------------------------+
196+ | 11 | SIGSEGV | Segmentation violation | |
197+ +----+---------+--------------------------+-------------------------------------+
198+
199+ If crash catching is enabled, the signal handler will be installed for any
200+ process that links the Swift runtime. If you replace the handlers for any of
201+ these signals, your program will no longer produce backtraces for program
202+ failures that lead to the handler you have replaced.
203+
204+ Additionally, the runtime will configure an alternate signal handling stack, so
205+ that stack overflows can be successfully trapped.
206+
207+ Note that the runtime will not install its signal handlers for a signal if it
208+ finds that there is already a handler for that signal. Similarly if something
209+ else has already configured an alternate signal stack, it will leave that
210+ stack alone.
211+
212+ Once the backtracer has finished handling the crash, it will allow the crashing
213+ program to continue and crash normally, which will result in the usual Crash
214+ Reporter log file being generated.
215+
216+ Crash catching *cannot * be enabled for setuid binaries. This is intentional as
217+ doing so might create a security hole.
218+
219+ Other Darwin (iOS, tvOS)
220+ ^^^^^^^^^^^^^^^^^^^^^^^^
221+
222+ Crash catching is not enabled for non-macOS Darwin. You should continue to look
223+ at the system-provided crash logs.
0 commit comments