How do you add diagnostic information to iOS crash reports?

Viewed 11

I'd like to be able to include diagnostic information in an iOS crash report. Part of the motivation is to include more information about the cause of the error and earlier stack traces.

In my scenario I have control over an NSException object that is thrown. That is, the crashes aren't due to segfaults, for instance. However, the default crash report (e.g. from TestFlight) hides NSException fields like name, reason, and userInfo:

NSException *exception = [NSException exceptionWithName:name
                                                 reason:reason
                                               userInfo:userInfo];
@throw exception;

produces:

Incident Identifier: 00000000-0000-0000-0000-000000000000
Hardware Model:      iPhone13,3
Process:             Example [12345]
...

Date/Time:           2022-08-11 12:21:45.7780 +0000
Launch Time:         2022-08-11 12:20:45.7780 +0000
OS Version:          iPhone OS 15.6 (19G71)
...

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  5

Last Exception Backtrace:
0   CoreFoundation                  0x1951a5288 __exceptionPreprocess + 220 (NSException.m:200)
1   libobjc.A.dylib                 0x1aded4744 objc_exception_throw + 60 (objc-exception.mm:565)
2   Example                         0x102bc379c -[Example throwException:] + 24 (Example.m:422)
3   Example                         0x102bd7964 -[Example _crash] + 984 (Example.m:222)
...
8   libdispatch.dylib               0x194e14c80 _dispatch_lane_invoke + 392 (queue.c:3944)
9   libdispatch.dylib               0x194e1f500 _dispatch_workloop_worker_thread + 648 (queue.c:6732)
10  libsystem_pthread.dylib         0x206b050bc _pthread_wqthread + 288 (pthread.c:2599)
11  libsystem_pthread.dylib         0x206b04e5c start_wqthread + 8

Is there any way to add more diagnostics information to these crash reports?

0 Answers
Related