How to symbolicate watchOS 2 extension crash logs from device
I’m working on the next version of Run 5k app, which includes standalone watchOS 2 app. In current Xcode 7 beta 4, it takes 30-40mins for the watch .app bundle to get copied from iPhone to the watch device.
No idea why it takes so long; it’s even called out as issue in Xcode 7 beta 4 release notes (they promise it will be resolved in future seeds).
The main problem with this is that debugging is next to impossible. Due to this you can’t realistically debug with the devices attached to Xcode so the only way is to install the iOS app, let it copy the watch bundle over and then use the app once it’s done.
My last-night test ended in a very repeatable crash. Great. Crashes from the Apple Watch are always copied to its paired iPhone and you can get them by connecting the iPhone, then opening Windows / Devices in Xcode, then tap “Show device logs” button.
Xcode then goes and symbolicate each .crash log file for you. However, in my case it symbolicated everything except my own code.
I did not have .xcarchive since I directly installed the iOS build to the iPhone. However, all the build files were still there (I have not done any build nor build & run afterwards), yet Xcode was apparently not trying to use them.
Here’s how to manually symbolicate the problematic lines.
(1) First export the .crash log to some folder.
(2) Then open Window/Projects, tap your project then tap the little arrow next to derived data for the project
(3) Open Debug-watchos folder and copy the Go5k watchOS2 Extension.appex file to the same folder where you .crash log file is.
(4) Open Terminal in that folder and first make sure that .appex file is the same one which generated the crash. You do this by comparing the UUIDs for the file with the one from the log file.
In the .crash log file, look for the Binary Images section below all the Thread X stuff. First line is your extension:
(Of course the terminal command goes all in one line, I added breaks so it’s easier to read)
Not sure is it relevant but I specifically used dwarfdump inside WatchOS.platform, just to be safe it understands .appex format.
Ok, 18A5BF9F-C409-34F2-829B-9BC29ACB8F21 == 18a5bf9fc40934f2829b9bc29acb8f21, architectures are the same, all is fine.
(5) Now let’s symbolicate. My crash lines are these: