iOS: How to generate symbolicated crash logs

Prelude:
To know what are symbolicated crash logs go through

In this post, we will know how to generate symbolicated crash logs.

Symbolicating crash logs for iPhone or iPad apps involves translating raw crash logs into human-readable stack traces that identify where the crash occurred in the code.

Locate the Crash Log

  • On the device:
  • From a crash report file:
    • If you received a .crash file (e.g., from a user or the App Store), ensure you have it accessible on your computer.

Ensure You Have the Matching dSYM File

  • A dSYM file (Debug Symbol file) is needed to symbolicate the crash log. It is generated during the app’s build process.
  • To find the dSYM:
    1. Open Xcode.
    2. Go to your project and open Organizer (Window > Organizer).
    3. Select the app version that matches the crash.
    4. Download the corresponding dSYM if it’s not already available.

Symbolicate Using Xcode

  • Open the .crash file in Xcode:
    1. Drag and drop the .crash file into the Device Logs window (or use the View Device Logs window).
    2. If Xcode can locate the matching dSYM and app binary, it will automatically symbolicate the crash log.
  • If the log doesn’t symbolicate automatically:
    • Ensure you have the correct version of the app binary and dSYM.
    • Rebuild the app with the same settings (if needed).

Manually Symbolicate Using atos

If automatic symbolication fails, you can use the atos tool:

  1. Locate the app’s dSYM file and binary:
  • dSYM: Typically in ~/Library/Developer/Xcode/Archives/
  • Binary: In the app’s .app file (right-click and Show Package Contents).
  1. Identify the memory address from the crash log.
  2. Use the atos command:
atos -arch arm64 -o /path/to/AppBinary -l <Load Address> <Crash Address>

Replace <Load Address> and <Crash Address> with the addresses from the log.

Mac symbolicator and Firebase crashlytics can help us in automatically handling crash log symbolication and reporting.

Once symbolication of crash log is done, crash log will now show function names, file names, and line numbers, making it easier to debug.

Tips

  • Always keep dSYM files for all app versions released.
  • Use version control to manage releases and associated debug symbols.
  • For App Store crashes, download dSYM files from the App Store Connect under Crashes in the TestFlight/Analytics section.
1 Like