How to symbolicate crash log Xcode?
Xcode 5 organizer had a view which would list all the crash logs. and we could drag drop crash logs here. But since Xcode 6, I know they have moved devices out of organize and have a new window for the same. But I do not find a place where I view the crash logs which i drag-dropped in Xcode 5 after upping to Xcode 6. Anybody knows the answer ?
Writing this answer as much for the community as for myself.
If there ever are problems symbolicating a crash report, one can overcome them as follows:
Create a separate folder, copy
Foo.app
andFoo.app.dSYM
from the corresponding.xcarchive
into the folder. Also copy the.crash
report into the folder.Open the crash report in TextEdit or elsewhere, go to the
Binary Images:
section, and copy the first address there (e.g.0xd7000
).-
cd
into the folder. Now you can run the following command:xcrun atos -o Foo.app/Foo -arch arm64 -l 0xd7000 0x0033f9bb
This will symbolicate the symbol at address 0x0033f9bb
. Please make sure to pick the correct value for the -arch
option (can be obtaned from the first line in the Binary Images:
section, or figured out from the Hardware Model:
in the crash report and the app's supported archs).
You can also copy the necessary addresses (e.g. a thread call stack) from the crash report directly into a text file (in TextEdit, hold Option and select the necessary text block, or copy and cut), to get something like this:
0x000f12fb
0x002726b7
0x0026d415
0x001f933b
0x001f86d3
Now you can save this into a text file, e.g. addr.txt
, and run the following command:
xcrun atos -o Foo.app/Foo -arch arm64 -l 0xd7000 -f addr.txt
This will give a nice symbolication for all the addresses at once.
P.S.
Before doing the above, it's worth checking that everything is set up correctly (as atos
will happily report something for basically any supplied address).
To do the checking, open the crash report, and go to the end of the call stack for Thread 0
. The first line from the end to list your app (usually the second one), e.g.:
34 Foo 0x0033f9bb 0xd7000 + 2525627
should be the main()
call. Symbolicating the address (0x0033f9bb
in this case) as described above should confirm that this is indeed main()
and not some random method or function.
If the address is not that of main()
, check your load address (-l
option) and arch (-arch
option).
P.P.S.
If the above doesn't work due to bitcode, download the dSYM for your build from iTunes Connect, extract the executable binary from the dSYM (Finder > Show Package Contents), copy it into the directory, and use it (i.e. Foo
) as the argument to atos
, instead of the Foo.app/Foo
.
You can refer this one too, I have written step by step procedure of Manual Crash Re-Symbolication.
Crash Re-Symbolication
STEP 1
Move all the above files (MyApp.app, MyApp-dSYM.dSYM and MyApp-Crash-log.crash) into a Folder with a convenient name wherever you can go using Terminal easily.
For me, Desktop is the most easily reachable place ;) So, I have moved these three files into a folder MyApp at Desktop.
STEP 2
Now its turn of Finder, Go to the path from following whichever is applicable for your XCODE version.
Use this command to find the symbolicatecrash
script file,find /Applications/Xcode.app -name symbolicatecrash
Xcode 8, Xcode 9, Xcode 11 /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash
Xcode 7.3
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash
XCode 7 /Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash
Xcode 6 /Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources
Lower then Xcode 6
Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/A/Resources
Or
Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources
STEP 3
Add the found symbolicatecrash script file's directory to $PATH
env variable like this: sudo vim /etc/paths.d/Xcode-symbolicatecrash
and paste the script file's directory and save the file. When opening a new terminal, you can call symbolicatecrash
at any folder as commands located in /usr/bin
.
Or
Copy symbolicatecrash file from this location, and paste it to the Desktop/MyApp (Wait… Don’t blindly follow me, I am pasting sybolicatecrash file in folder MyApp, one that you created in step one at your favorite location, having three files.)
STEP 4
Open Terminal, and CD to the MyApp Folder.
cd Desktop/MyApp — Press Enter
export DEVELOPER_DIR=$(xcode-select --print-path)
— Press Enter
./symbolicatecrash -v MyApp-Crash-log.crash MyApp.dSYM
— Press Enter
That’s it !! Symbolicated logs are on your terminal… now what are you waiting for? Now simply, Find out the Error and resolve it ;)
Ok I realised that you can do this:
- In
Xcode > Window > Devices
, select a connected iPhone/iPad/etc top left. - View Device Logs
- All Logs
You probably have a lot of logs there, and to make it easier to find your imported log later, you could just go ahead and delete all logs at this point... unless they mean money to you. Or unless you know the exact point of time the crash happened - it should be written in the file anyway... I'm lazy so I just delete all old logs (this actually took a while).
- Just drag and drop your file into that list. It worked for me.
For me the .crash file was enough. Without .dSYM file and .app file.
I ran these two commands on the mac where I build the archive and it worked:
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash /yourPath/crash1.crash > /yourPath/crash1_symbolicated.crash