I have an iOS app that uses Objective C++ with some external C++ libraries, the app uses Crashlytics to track possible user crashes.
Crashlytics happily handles all exceptions coming from Objective C land, which has helped me a lot in the past to track down issues, I would like to get the same kind of crash logs from the C++ end, whenever anything throws.
Unfortunately when std::exception is called, all I get in Crashlytics is a generic stack trace that does not include the origin, this doesn't help in fixing these issues and doesn't help the fact that any std exception goes into the same one-size-fits-all accumulated "crash" type.
Can I catch these exceptions and redirect them somehow so they appear next to the Objective C originating crashes?
I am trying something along the lines of this, but I can't seem to be able to get it to work, whilst keeping Crashlytics in the same working state, am I missing anything?
https://stackoverflow.com/a/36733626/5199634
Another possible solution that I am considering is catching C++ exceptions and logging them using Crashlytics itself as errors, and then re-throw them from the wrapper.
https://docs.fabric.io/apple/crashlytics/logged-errors.html
Example stack trace after unhandled C++ exception:
Crashed: com.twitter.crashlytics.ios.exception
0 MyApp 0x100d9baac CLSProcessRecordAllThreads + 4312709804
1 MyApp 0x100d9baac CLSProcessRecordAllThreads + 4312709804
2 MyApp 0x100d9b968 CLSProcessRecordAllThreads + 4312709480
3 MyApp 0x100d8b6b8 CLSHandler + 4312643256
4 MyApp 0x100d99ac4 __CLSExceptionRecord_block_invoke + 4312701636
5 libdispatch.dylib 0x182556a14 _dispatch_client_callout + 16
6 libdispatch.dylib 0x18255f618 _dispatch_queue_barrier_sync_invoke_and_complete + 56
7 MyApp 0x100d99558 CLSExceptionRecord + 4312700248
8 MyApp 0x100d99068 CLSTerminateHandler() + 4312698984
9 libc++abi.dylib 0x181e0f54c std::__terminate(void (*)()) + 16
10 libc++abi.dylib 0x181e0f5b8 std::terminate() + 60
11 libobjc.A.dylib 0x181e2076c _destroyAltHandlerList + 10
12 libdispatch.dylib 0x182556a28 _dispatch_client_callout + 36
13 libdispatch.dylib 0x18255e200 _dispatch_block_invoke_direct$VARIANT$mp + 288
14 FrontBoardServices 0x1852d27f8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
15 FrontBoardServices 0x1852d249c -[FBSSerialQueue _performNext] + 404
16 FrontBoardServices 0x1852d2a38 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
17 CoreFoundation 0x182b8297c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
18 CoreFoundation 0x182b828fc __CFRunLoopDoSource0 + 88
19 CoreFoundation 0x182b82184 __CFRunLoopDoSources0 + 204
20 CoreFoundation 0x182b7fd5c __CFRunLoopRun + 1048
21 CoreFoundation 0x182a9fe58 CFRunLoopRunSpecific + 436
22 GraphicsServices 0x18494cf84 GSEventRunModal + 100
23 UIKit 0x18c11f67c UIApplicationMain + 236
24 MyApp 0x100cec768 main (main.m:14)
25 libdyld.dylib 0x1825bc56c start + 4