Thursday, 18 December 2014

Resymbolicating crash reports for iOS

Resymbolication in Xcode 6.1

  • Get the crash report from Device via Xcode

  • From the crash report get the version of the app.
  • Get the IPA and dSYM file for the version from ios-ci.
  • Put the following in a common folder (named lets say XYZ, which should not be in /tmp):
    • The unsymbolicated crash report.
    • The binary extracted from the IPA.
    • The dSYM file for the related binary.
  • On the terminal now, execute the following command:
    DEVELOPER_DIR=`xcode-select -print-path` /Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash -v -o resymbolicated.crash crashreport.crash Talkto.app.dSYM
  • This should symbolicate your crash report and export the unsymbolicated version to resymbolicated.crash


Possible error case:

The whole file might not get symbolicated even with a successful run.
The verbose output in that case should end with something like:
Running /Applications/Xcode.app/Contents/Developer/usr/bin/atos -arch armv7 -l 0x91000 -o '/Users/ayushgoel/Downloads/11/Talkto' 0x001a3d44 0x0034f262 0x001188be 0x0031d23a 0x000978e2
Here symbolication of only 5 addresses has been tried. But in the crash report there are more addresses, which needed to be symbolicated. See code below.
Thread 5 name:  Session Background Thread  Dispatch queue: NSPersistentStoreCoordinator 0x166a8420
Thread 5 Attributed:
0   libsystem_kernel.dylib          0x338e6324 0x338e4000 + 8996
1   libsqlite3.dylib                0x335a31a0 0x3359c000 + 29088
2   libsqlite3.dylib                0x335bb7fe 0x3359c000 + 129022
3   libsqlite3.dylib                0x335ba720 0x3359c000 + 124704
4   libsqlite3.dylib                0x335d558e 0x3359c000 + 234894
5   libsqlite3.dylib                0x335dbab0 0x3359c000 + 260784
6   libsqlite3.dylib                0x335d5670 0x3359c000 + 235120
7   libsqlite3.dylib                0x335cb4aa 0x3359c000 + 193706
8   libsqlite3.dylib                0x335c9ed6 0x3359c000 + 188118
9   CoreData                        0x257ffab8 0x257ea000 + 88760
10  CoreData                        0x257ff7ae 0x257ea000 + 87982
11  CoreData                        0x258e72b2 0x257ea000 + 1036978
12  CoreData                        0x25805f0e 0x257ea000 + 114446
13  CoreData                        0x25805894 0x257ea000 + 112788
14  CoreData                        0x258b2520 0x257ea000 + 820512
15  CoreData                        0x258b97c8 0x257ea000 + 849864
16  libdispatch.dylib               0x338127a4 0x33811000 + 6052
17  libdispatch.dylib               0x33819ac4 0x33811000 + 35524
18  CoreData                        0x258ad302 0x257ea000 + 799490
19  CoreData                        0x25805512 0x257ea000 + 111890
20  CoreData                        0x258041da 0x257ea000 + 106970
21  Talkto                          0x0030fd0c 0x91000 + 2616588
22  Talkto                          0x0030f92e 0x91000 + 2615598
23  Talkto                          0x0030f9a2 0x91000 + 2615714
24  Talkto                          0x0011de7a 0x91000 + 577146
25  Talkto                          0x0011dce6 0x91000 + 576742
26  Talkto                          0x0013b77e 0x91000 + 698238
27  Talkto                          0x00128722 0x91000 + 620322
28  CoreFoundation                  0x25b00b10 0x259f6000 + 1092368
29  CoreFoundation                  0x25a2d690 0x259f6000 + 226960
30  Talkto                          0x00128324 0x91000 + 619300
31  Talkto                          0x0012769a 0x91000 + 616090
32  Talkto                          0x00127422 0x91000 + 615458
33  Talkto                          0x00126ea4 0x91000 + 614052
34  Talkto                          0x0030d2ee 0x91000 + 2605806
35  Talkto                          0x00126de2 0x91000 + 613858
36  Talkto                          0x00125fca 0x91000 + 610250
37  Talkto                          0x00311458 0x91000 + 2622552
38  Foundation                      0x2680cd6a 0x2673c000 + 855402
39  CoreFoundation                  0x25ac2d54 0x259f6000 + 838996
40  CoreFoundation                  0x25ac2162 0x259f6000 + 835938
41  CoreFoundation                  0x25ac07c8 0x259f6000 + 829384
42  CoreFoundation                  0x25a0e3bc 0x259f6000 + 99260
43  CoreFoundation                  0x25a0e1ce 0x259f6000 + 98766
44  Foundation                      0x26747bf8 0x2673c000 + 48120
45  Talkto                          0x000ebc42 0x91000 + 371778
46  Foundation                      0x2680cb56 0x2673c000 + 854870
47  libsystem_pthread.dylib         0x33975e90 0x33973000 + 11920
48  libsystem_pthread.dylib         0x33975e02 0x33973000 + 11778
49  libsystem_pthread.dylib         0x33973b8c 0x33973000 + 2956

This is because of the faulty parsing by the script.
To fix this convert: Thread 5 Attributed: -> Thread 5:.
And now run the script again to see the magic!