iOS – Symbolicate crash logs from published application

A simple memo on how to symbolicate and read the crash logs from Apple in order to identify where your crash happened.

When you download a crashlog from iTunes Connect (.txt or .crash file), you receive something like this:

Incident Identifier: F92C4FEF-9A35-E8C23D7E6D20
CrashReporter Key: 74725efae7b9a59c25df22db0bbe934c
Hardware Model: xxx
Process: AppName [19645]
Path: /private/var/containers/Bundle/Application/2260797C-8492-41C0-9A88-6DF237806065/AppName.app/AppName
Identifier: it.appname
Version: 9 (1.0)
AppStoreTools: 11E146
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: it.appname [1932]
[…]
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000104b351a8
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [19645]
Triggered by Thread: 0

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 AppName 0x0000000104b351a8 0x104b24000 + 70056
1 AppName 0x0000000104b38edc 0x104b24000 + 85724
2 AppName 0x0000000104b3c458 0x104b24000 + 99416
3 AppName 0x0000000104b3f464 0x104b24000 + 111716
4 libdispatch.dylib 0x00000001b32089a8 0x1b31ae000 + 371112
5 libdispatch.dylib 0x00000001b3209524 0x1b31ae000 + 374052
6 libdispatch.dylib 0x00000001b31bb5b4 0x1b31ae000 + 54708
7 CoreFoundation 0x00000001b34c1748 0x1b3419000 + 689992
8 CoreFoundation 0x00000001b34bc61c 0x1b3419000 + 669212
9 CoreFoundation 0x00000001b34bbc34 0x1b3419000 + 666676
10 GraphicsServices 0x00000001bd60538c 0x1bd602000 + 13196
11 UIKitCore 0x00000001b75ee22c 0x1b6bc2000 + 10666540
12 AppName 0x0000000104b28e00 0x104b24000 + 19968
13 libdyld.dylib 0x00000001b3343800 0x1b3342000 + 6144
[…]

But you are unable to read the file because you need to symbolicate the file…


Retrieve the DSYM file

The DSYM file can be founded in the XCode -> Organizer, selecting your build and next “Show in finder“.

Symbolicate the crash log

XCode has an integrated tool that helps you with symbolication. You can find it in the XCode folder:

/Applications/Xcode.app/Contents/SharedFrameworks/
  DVTFoundation.framework/Versions/A/Resources/symbolicatecrash

Basically you should run it with your unsymbolicated file as input parameter:

[~/Desktop]$ 
/Applications/Xcode.app/Contents/SharedFrameworks/
 DVTFoundation.framework/Versions/A/
 Resources/symbolicatecrash unsymb-crashlog.crash > symbolicated.crash

[~/Desktop]$

*Remember to export the DEVELOPER_DIR in your .bash_profile or .zshrc that you have before.

export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"

Symbolicated!

Now your file is read and symbolicated!

Open it, you should see something like this:

Incident Identifier: F92C4FEF-9A35-E8C23D7E6D20
CrashReporter Key: 74725efae7b9a59c25df22db0bbe934c
Hardware Model: xxx
Process: AppName [19645]
Path: /private/var/containers/Bundle/Application/2260797C-8492-41C0-9A88-6DF237806065/AppName.app/AppName
Identifier: it.appname
Version: 9 (1.0)
AppStoreTools: 11E146
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: it.appname [1932]
[…]

Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000104b351a8
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [19645]
Triggered by Thread: 0

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 AppName 0x0000000104b351a8 specialized Enemy.randomVirus(position:actions:) + 70056 (EnemyModel.swift:82)
1 AppName 0x0000000104b38edc GameViewController.drawEnemy(x:y:z:) + 85724 (GameViewController.swift:272)
2 AppName 0x0000000104b3c458 partial apply for closure #1 in GameViewController.addEnemies(total:) + 99416 (:0)
3 AppName 0x0000000104b3f464 thunk for @escaping @callee_guaranteed () -> () + 111716 (:0)
4 libdispatch.dylib 0x00000001b32089a8 _dispatch_call_block_and_release + 24
5 libdispatch.dylib 0x00000001b3209524 _dispatch_client_callout + 16
6 libdispatch.dylib 0x00000001b31bb5b4 _dispatch_main_queue_callback_4CF$VARIANT$mp + 904
7 CoreFoundation 0x00000001b34c1748 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
8 CoreFoundation 0x00000001b34bc61c __CFRunLoopRun + 1724
9 CoreFoundation 0x00000001b34bbc34 CFRunLoopRunSpecific + 424
10 GraphicsServices 0x00000001bd60538c GSEventRunModal + 160
11 UIKitCore 0x00000001b75ee22c UIApplicationMain + 1932
12 AppName 0x0000000104b28e00 main + 19968 (LevelModel.swift:21)
13 libdyld.dylib 0x00000001b3343800 start + 4
[…]

Of course, it remains complex to read but is a little bit more clear.

Enjoy symbols!

 

Alberto Pasca

Software engineer @ Pirelli & C. S.p.A. with a strong passion for mobile  development, security, and connected things.