I notice that in my app's crash log on OS X that one of the first sections is "Application Specific Backtrace". It shows something like this:
Application Specific Backtrace 1:
0 CoreFoundation 0x00007fff8acef716 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff8d723470 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8ad7df07 -[__NSDictionaryM setObject:forKey:] + 135
3 My App 0x00000001030c6f72 My App + 81778
4 My App 0x00000001030c7969 My App + 84329
5 AppKit 0x00007fff8c3d5afa -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1012
6 AppKit 0x00007fff8c5ec1d6 -[NSNib _instantiateNibWithExternalNameTable:] + 610
7 AppKit 0x00007fff8c5ebf43 -[NSNib instantiateNibWithOwner:topLevelObjects:] + 254
8 AppKit 0x00007fff8c5eb4f7 -[NSViewController loadView] + 184
9 AppKit 0x00007fff8c593349 -[NSViewController view] + 41
10 My App 0x00000001030cae69 My App + 97897
11 My App 0x00000001030cbb3a My App + 101178
12 AppKit 0x00007fff8c590322 -[NSTableView _sendDelegateHeightOfRow:] + 130
13 AppKit 0x00007fff8c5900db -[NSTableView _uncachedRectHeightOfRow:] + 197
14 AppKit 0x00007fff8c58ff2c -[_NSTableRowHeightStorage _cacheRowHeights] + 163
15 AppKit 0x00007fff8c54a6f5 -[_NSTableRowHeightStorage _ensureRowHeights] + 80
16 AppKit 0x00007fff8c5680cb -[_NSTableRowHeightStorage computeRowAtPoint:] + 38
17 AppKit 0x00007fff8c567fd9 -[NSTableView rowAtPoint:] + 306
18 AppKit 0x00007fff8c566af7 -[NSTableView rowsInRect:] + 375
19 AppKit 0x00007fff8c597ca4 _NSTVVisibleRowsForUpdate + 673
20 AppKit 0x00007fff8c5971e5 -[NSTableRowData _unsafeUpdateVisibleRowEntries] + 96
21 AppKit 0x00007fff8c597001 -[NSTableRowData updateVisibleRowViews] + 119
22 AppKit 0x00007fff8c56f0fb -[NSTableView viewWillDraw] + 165
23 AppKit 0x00007fff8c44cbed __22-[NSView viewWillDraw]_block_invoke_0 + 307
24 CoreFoundation 0x00007fff8ace80b6 __NSArrayEnumerate + 582
25 AppKit 0x00007fff8c44c92d -[NSView viewWillDraw] + 244
26 AppKit 0x00007fff8c44bf84 -[NSView _sendViewWillDrawInRect:clipRootView:] + 1525
27 AppKit 0x00007fff8c4183f1 -[NSView displayIfNeeded] + 1044
28 AppKit 0x00007fff8c4c429e -[NSClipView _immediateScrollToPoint:] + 7852
29 AppKit 0x00007fff8c4c2342 -[NSClipView scrollToPoint:] + 268
30 AppKit 0x00007fff8c58acdd -[NSScrollView scrollClipView:toPoint:] + 426
31 AppKit 0x00007fff8c4c20cc -[NSClipView _scrollTo:animateScroll:flashScrollerKnobs:] + 1626
32 AppKit 0x00007fff8c39d579 -[NSClipView _scrollTo:animate:] + 28
33 AppKit 0x00007fff8caab2a1 __31-[NSScrollView _snapRubberBand]_block_invoke_0610 + 1989
34 AppKit 0x00007fff8ca2412a ____NSPeriodicInvokerScheduled_block_invoke_0 + 57
35 libdispatch.dylib 0x00007fff8a013f3d _dispatch_call_block_and_release + 15
36 libdispatch.dylib 0x00007fff8a0100fa _dispatch_client_callout + 8
37 libdispatch.dylib 0x00007fff8a0149ab _dispatch_after_timer_callback + 22
38 libdispatch.dylib 0x00007fff8a0100fa _dispatch_client_callout + 8
39 libdispatch.dylib 0x00007fff8a0122d7 _dispatch_source_invoke + 691
40 libdispatch.dylib 0x00007fff8a011349 _dispatch_queue_invoke + 72
41 libdispatch.dylib 0x00007fff8a0150cd _dispatch_main_queue_callback_4CF + 220
42 CoreFoundation 0x00007fff8ac9181e __CFRunLoopRun + 1614
43 CoreFoundation 0x00007fff8ac90dd2 CFRunLoopRunSpecific + 290
44 HIToolbox 0x00007fff85323774 RunCurrentEventLoopInMode + 209
45 HIToolbox 0x00007fff85323512 ReceiveNextEventCommon + 356
46 HIToolbox 0x00007fff853233a3 BlockUntilNextEventMatchingListInMode + 62
47 AppKit 0x00007fff8c414fa3 _DPSNextEvent + 685
48 AppKit 0x00007fff8c414862 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
49 AppKit 0x00007fff8c40bc03 -[NSApplication run] + 517
50 AppKit 0x00007fff8c3b0656 NSApplicationMain + 869
51 My App 0x00000001030b4554 My App + 5460
52 ??? 0x0000000000000002 0x0 + 2
I know that's code that was running on the main thread, but yet it's shown in that section and NOT in the Thread 0 backtrace, which looks something like this:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff8588d212 __pthread_kill + 10
1 libsystem_c.dylib 0x00007fff8e1fab34 pthread_kill + 90
2 libsystem_c.dylib 0x00007fff8e23edfa abort + 143
3 libc++abi.dylib 0x00007fff888abf87 abort_message + 257
4 libc++abi.dylib 0x00007fff888a9936 default_terminate() + 28
5 libobjc.A.dylib 0x00007fff8d7238f3 _objc_terminate() + 91
6 libc++.1.dylib 0x00007fff8694c8fe std::terminate() + 20
7 libobjc.A.dylib 0x00007fff8d72365e objc_terminate + 9
8 libdispatch.dylib 0x00007fff8a01010e _dispatch_client_callout + 28
9 libdispatch.dylib 0x00007fff8a0149ab _dispatch_after_timer_callback + 22
10 libdispatch.dylib 0x00007fff8a0100fa _dispatch_client_callout + 8
11 libdispatch.dylib 0x00007fff8a0122d7 _dispatch_source_invoke + 691
12 libdispatch.dylib 0x00007fff8a011349 _dispatch_queue_invoke + 72
13 libdispatch.dylib 0x00007fff8a0150cd _dispatch_main_queue_callback_4CF + 220
14 com.apple.CoreFoundation 0x00007fff8ac9181e __CFRunLoopRun + 1614
15 com.apple.CoreFoundation 0x00007fff8ac90dd2 CFRunLoopRunSpecific + 290
16 com.apple.HIToolbox 0x00007fff85323774 RunCurrentEventLoopInMode + 209
17 com.apple.HIToolbox 0x00007fff85323512 ReceiveNextEventCommon + 356
18 com.apple.HIToolbox 0x00007fff853233a3 BlockUntilNextEventMatchingListInMode + 62
19 com.apple.AppKit 0x00007fff8c414fa3 _DPSNextEvent + 685
20 com.apple.AppKit 0x00007fff8c414862 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
21 com.apple.AppKit 0x00007fff8c40bc03 -[NSApplication run] + 517
22 com.apple.AppKit 0x00007fff8c3b0656 NSApplicationMain + 869
23 com.mycompany.myapp 0x00000001030b4554 0x1030b3000 + 5460
What's the significance of "Application Specific Backtrace" and why isn't that code included in the main thread backtrace?
(To be clear, I'm not asking how to debug this code, I'm just looking for an explanation on the structure and meaning of the crash log itself. Thanks!)
This is how exception handling works. You have an exception on the main thread, where the NSException is created (it holds all info about exception including current stack trace). After throwing an exception object control is passed to the closest handler in the call stack, unwinding the stack between throw and catch point. If an exception is not caught, it is intercepted by a function called the uncaught exception handler. The uncaught exception handler always causes the program to exit but may perform some task before this happens. The default uncaught exception handler logs a message to the console before it exits the program.
So in your case Application Specific Backtrace is the stacktrace when exception was thrown and Thread 0 Crashed:: Dispatch queue: com.apple.main-thread is the stack trace when the app was killed.
Notice that up to this point the stack trace is identical:
10 libdispatch.dylib 0x00007fff8a0100fa _dispatch_client_callout + 8
11 libdispatch.dylib 0x00007fff8a0122d7 _dispatch_source_invoke + 691
12 libdispatch.dylib 0x00007fff8a011349 _dispatch_queue_invoke + 72
13 libdispatch.dylib 0x00007fff8a0150cd _dispatch_main_queue_callback_4CF + 220
14 com.apple.CoreFoundation 0x00007fff8ac9181e __CFRunLoopRun + 1614
15 com.apple.CoreFoundation 0x00007fff8ac90dd2 CFRunLoopRunSpecific + 290
16 com.apple.HIToolbox 0x00007fff85323774 RunCurrentEventLoopInMode + 209
17 com.apple.HIToolbox 0x00007fff85323512 ReceiveNextEventCommon + 356
18 com.apple.HIToolbox 0x00007fff853233a3 BlockUntilNextEventMatchingListInMode + 62
19 com.apple.AppKit 0x00007fff8c414fa3 _DPSNextEvent + 685
20 com.apple.AppKit 0x00007fff8c414862 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
21 com.apple.AppKit 0x00007fff8c40bc03 -[NSApplication run] + 517
22 com.apple.AppKit 0x00007fff8c3b0656 NSApplicationMain + 869
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With