search by tags

for the user

adventures into the land of the command line

how to symbolicate an ios crash log

for reference.

step 1, on the mac, in Xcode

- click on app - click on build settings - click on debug information format - make sure debug value is DWARF with dSYM File - right click on Products > myApp.app - select Show in Finder

you will be brought somewhere like this:

$ ls -l ~/Library/Developer/Xcode/DerivedData/The_Mountain-akqjdityjuazzabislsvjdmelxew/Build/Products/Debug-iphonesimulator/
total 0
drwxr-xr-x   3 sebastian  staff   102  9 Feb 21:50 KSCrash
drwxr-xr-x   7 sebastian  staff   238  9 Feb 21:54 Pods_The_Mountain.framework
drwxr-xr-x   3 sebastian  staff   102  9 Feb 21:54 Sentry
drwxr-xr-x  37 sebastian  staff  1258 21 Feb 22:28 The Mountain.app
drwxr-xr-x   3 sebastian  staff   102 21 Feb 22:27 The Mountain.app.dSYM <----------- VOILA
drwxr-xr-x   4 sebastian  staff   136  9 Feb 21:54 The_Mountain.swiftmodule

step 2, on the iPhone

settings > privacy > analysis > analysis data

here you will find crash logs from all the apps on your device. find the crash report that interests you and save it. you can alternatively:

- Connect an iOS device to your Mac - Choose "Devices & Simulators" from the "Window" menu - Under the "DEVICES" section in the left column, choose a device - Click the "View Device Logs" button under the "Device Information" section on the right hand panel

Xcode will automatically symbolicate the crash report and display the results, however if you have no dSYM file, the crash report will only be partially symbolicated.

Unsymbolicated

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libswiftCore.dylib            	0x006c6df0 0x491000 + 2317808
1   The Mountain                  	0x0012e50c 0x77000 + 750860
2   The Mountain                  	0x0012e1bc 0x77000 + 750012
3   The Mountain                  	0x0012e210 0x77000 + 750096
4   The Mountain                  	0x00096898 0x77000 + 129176
5   The Mountain                  	0x00099b54 0x77000 + 142164
6   UIKit                         	0x22b89eb6 0x22b7b000 + 61110
7   UIKit                         	0x22b89ad8 0x22b7b000 + 60120
8   UIKit                         	0x22cf3894 0x22b7b000 + 1542292
9   UIKit                         	0x22bf9a48 0x22b7b000 + 518728
10  UIKit                         	0x22bf956c 0x22b7b000 + 517484
11  UIKit                         	0x22dfaa4a 0x22b7b000 + 2619978
12  UIKit                         	0x22dffc1c 0x22b7b000 + 2640924
13  UIKit                         	0x22e127c4 0x22b7b000 + 2717636
14  UIKit                         	0x22dfd35a 0x22b7b000 + 2630490
15  FrontBoardServices            	0x1f238c12 0x1f203000 + 220178
16  FrontBoardServices            	0x1f238acc 0x1f203000 + 219852
17  FrontBoardServices            	0x1f238db6 0x1f203000 + 220598
18  CoreFoundation                	0x1d913fdc 0x1d85d000 + 749532
19  CoreFoundation                	0x1d913b04 0x1d85d000 + 748292
20  CoreFoundation                	0x1d911f50 0x1d85d000 + 741200
21  CoreFoundation                	0x1d8651ae 0x1d85d000 + 33198
22  CoreFoundation                	0x1d864fd0 0x1d85d000 + 32720
23  UIKit                         	0x22bf2e2c 0x22b7b000 + 491052
24  UIKit                         	0x22beda52 0x22b7b000 + 469586
25  The Mountain                  	0x001a0b50 0x77000 + 1219408
26  libdyld.dylib                 	0x1d0524ea 0x1d04f000 + 13546
.
.

Binary Images:
0x77000 - 0x1b6fff The Mountain armv7  <677599238e16378bbfab242d143d8ada> /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/The Mountain
0x29f000 - 0x2a6fff libswiftCoreFoundation.dylib armv7s  <6296cf8da0e43a0d9f670facc01ac40c> /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftCoreFoundation.dylib
0x2af000 - 0x2c2fff libswiftCoreGraphics.dylib armv7s   /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftCoreGraphics.dylib
0x2dd000 - 0x2e4fff libswiftCoreImage.dylib armv7s   /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftCoreImage.dylib
0x2ed000 - 0x2f4fff libswiftDarwin.dylib armv7s  <0b8aa04b74bc38bfbd6f895d9f96850e> /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftDarwin.dylib
0x304000 - 0x30bfff libswiftMetal.dylib armv7s  <5bcb6005a8323842887e311f8fff7f3f> /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftMetal.dylib
0x325000 - 0x350fff dyld armv7s   /usr/lib/dyld
0x491000 - 0x880fff libswiftCore.dylib armv7s  <6b675da05be83835afe731bcb0ab0a93> /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftCore.dylib
0xb9e000 - 0xbbdfff libswiftDispatch.dylib armv7s  <71eb68d6724c3ceda52f6260df1bfc0e> /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftDispatch.dylib
0xbed000 - 0xd7cfff libswiftFoundation.dylib armv7s  <3a708b33f4de362fb769cfbdff462a35> /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftFoundation.dylib
0xeb9000 - 0xec0fff libswiftObjectiveC.dylib armv7s  <8f05af83accb346896b35d9fbccb678b> /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftObjectiveC.dylib
0xecd000 - 0xed4fff libswiftQuartzCore.dylib armv7s   /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftQuartzCore.dylib
0xedd000 - 0xf14fff libswiftSwiftOnoneSupport.dylib armv7s  <31f1b564b37b3a30a1ba08be036d3f0c> /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftSwiftOnoneSupport.dylib
0xf62000 - 0xf6dfff libswiftUIKit.dylib armv7s  <0688048cc8b038df9c3b7974a1ebd9e4> /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftUIKit.dylib
0xf7f000 - 0xf86fff libswiftos.dylib armv7s   /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/Frameworks/libswiftos.dylib
0x1cb70000 - 0x1cb71fff libSystem.B.dylib armv7s   /usr/lib/libSystem.B.dylib
0x1cb72000 - 0x1cbbdfff libc++.1.dylib armv7s  <818c230dfc88357ab249302107b831f0> /usr/lib/libc++.1.dylib
0x1cbbe000 - 0x1cbd7fff libc++abi.dylib armv7s  <33f0c699025730d4b0ad607272fe7ddb> /usr/lib/libc++abi.dylib
0x1cbd8000 - 0x1cfaefff libobjc.A.dylib armv7s  <233c8b2bca853098ac1d022d34bdcc3b> /usr/lib/libobjc.A.dylib
0x1cfaf000 - 0x1cfb3fff libcache.dylib armv7s  <7e1f8d6da16637e68e52fae288ffe811> /usr/lib/system/libcache.dylib
0x1cfb4000 - 0x1cfbcfff libcommonCrypto.dylib armv7s  <0055e658e5573c3eb05c661e1deb2f44> /usr/lib/system/libcommonCrypto.dylib
0x1cfbd000 - 0x1cfc5fff libcompiler_rt.dylib armv7s  <182facee469e3b9eacfbdcad641e7ff0> /usr/lib/system/libcompiler_rt.dylib
0x1cfc6000 - 0x1cfccfff libcopyfile.dylib armv7s  <24e8017bf649395f9afe530bf82f1504> /usr/lib/system/libcopyfile.dylib
0x1cfcd000 - 0x1d023fff libcorecrypto.dylib armv7s   /usr/lib/system/libcorecrypto.dylib
0x1d024000 - 0x1d04efff libdispatch.dylib armv7s  <5f9fcd5d9ef73609a4d2c3b31982e7a3> /usr/lib/system/libdispatch.dylib
0x1d04f000 - 0x1d052fff libdyld.dylib armv7s   /usr/lib/system/libdyld.dylib
.
.

Partially Symbolicated

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libswiftCore.dylib            	0x006c6df0 0x491000 + 2317808
1   The Mountain                  	0x0012e50c 0x77000 + 750860
2   The Mountain                  	0x0012e1bc 0x77000 + 750012
3   The Mountain                  	0x0012e210 0x77000 + 750096
4   The Mountain                  	0x00096898 0x77000 + 129176
5   The Mountain                  	0x00099b54 0x77000 + 142164
6   UIKit                         	0x22b89eb6 -[UIViewController loadViewIfRequired] + 966
7   UIKit                         	0x22b89ad8 -[UIViewController view] + 22
8   UIKit                         	0x22cf3894 -[UIApplication+ 1542292 (StateRestoration) _restoreApplicationPreservationStateWithSessionIdentifier:beginHandler:completionHandler:] + 5888
9   UIKit                         	0x22bf9a48 -[UIApplication+ 518728 (StateRestoration) _doRestorationIfNecessary] + 308
10  UIKit                         	0x22bf956c -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 288
11  UIKit                         	0x22dfaa4a -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3706
12  UIKit                         	0x22dffc1c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1640
13  UIKit                         	0x22e127c4 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3149 + 40
14  UIKit                         	0x22dfd35a -[UIApplication workspaceDidEndTransaction:] + 142
15  FrontBoardServices            	0x1f238c12 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 18
16  FrontBoardServices            	0x1f238acc -[FBSSerialQueue _performNext] + 220
17  FrontBoardServices            	0x1f238db6 -[FBSSerialQueue _performNextFromRunLoopSource] + 44
18  CoreFoundation                	0x1d913fdc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
19  CoreFoundation                	0x1d913b04 __CFRunLoopDoSources0 + 424
20  CoreFoundation                	0x1d911f50 __CFRunLoopRun + 1160
21  CoreFoundation                	0x1d8651ae CFRunLoopRunSpecific + 470
22  CoreFoundation                	0x1d864fd0 CFRunLoopRunInMode + 104
23  UIKit                         	0x22bf2e2c -[UIApplication _run] + 660
24  UIKit                         	0x22beda52 UIApplicationMain + 150
25  The Mountain                  	0x001a0b50 0x77000 + 1219408
26  libdyld.dylib                 	0x1d0524ea start + 2

copy the .app, the .dSYM, the .crash log to a folder. use the atos utility

$ atos
[invalid usage]: no processes or executables specified
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [-fullPath] [address ...]
	--fullPath  show full path to source file

$ ls -l ~/Desktop/symbogo/
total 128
[email protected]  1 sebastian  staff  30438 21 Feb 22:58 The Mountain  19-1-18, 23-13.crash
drwxr-xr-x  37 sebastian  staff   1258 21 Feb 22:28 The Mountain.app
drwxr-xr-x   3 sebastian  staff    102 21 Feb 22:27 The Mountain.app.dSYM
[email protected]  1 sebastian  staff  31324 21 Feb 22:58 crash1_symbolicated.crash


$ export DEVELOPER_DIR='/Applications/Xcode.app/Contents/Developer'
$ find /Applications/Xcode.app -name symbolicatecrash -type f


$ /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/Library/PrivateFrameworks/DVTFoundation.framework/symbolicatecrash The\ Mountain\ \ 19-1-18\,\ 23-13.crash The\ Mountain.app.dSYM

If we take the first line of the thread and binary stack trace:

Thread 0 Crashed:
0   libswiftCore.dylib            	0x006c6df0 0x491000 + 2317808

Binary Images:
0x77000 - 0x1b6fff The Mountain armv7  <677599238e16378bbfab242d143d8ada> /var/containers/Bundle/Application/DD7FC906-724B-4574-AADC-010D3D0E7C94/The Mountain.app/The Mountain

Load Address: 0x77000
Address to symbolicate: 0x006c6df0
Binary Architecture: armv7

we can symbolicate it line by line:

$ atos -arch armv7 -o The\ Mountain.app.dSYM/Contents/Resources/DWARF/The\ Mountain -l 0x491000 0x006c6df0