Crash collection analysis

When a crash occurs in the app, a crash report will be generated. Checking the crash record is very helpful for us to locate the cause of the crash. Let’s take a look at how to symbolize and analyze the crash report.

  • Symbolization is replacing memory addresses with readable function names and line numbers,

The crash Report information we get is usually stack information, which is not readable, for example:If we want to read crash logs, we need to symbolize the logs,

Access to crash

The latest version of apple’s Crash collection service, iTunes Connect, has removed the Crash log from the APP and only the Window->Organizer->Crashes log is available in XCode.

When the program runs Crash, the system will record the running information at the last moment of running and store it in a file, which is called Crash file. However, collecting Crash function requires user Settings -> Privacy -> Diagnosis and dosage -> diagnosis and dosage data to be sent automatically and shared with the developer. Since not all users will turn on this function, it is not guaranteed that all Crash information will be collected. The recommended index is three stars.

2. Self-realization of the framework for Crash collection and reporting has been described in detail above. It is suitable for teams with sufficient manpower and technical reserves, and the recommended index is five stars.

3. Third-party crash collection services, such as Tencent Bugly and Umeng, are relatively perfect. As developers save worry and effort, they are suitable for individuals or teams with low requirements for privacy, with a recommended index of five stars.

Three ways of symbolizing

As the compiler converts your source code to machine code, it also generates a corresponding Debug symbol table. The Debug symbol table is actually a mapping table that maps each machine instruction hidden in the compiled binary information to each line of source code that generated them. Using the Debug Information Format(DEBUG_INFORMATION_FORMAT) in build Setting, these Debug symbol tables are either stored in compiled binary Information, Either store it in a separate Debug Symbol file (i.e., a dSYM file) : Generally speaking, apps built in Debug mode store the Debug symbol table ina compiled binary message, while apps built in release mode store the Debug symbol table ina dSYM file to save volume. At each build, the Debug symbol table and the app binary information are correlated by the build time UUID. Each build generates a new unique UUID that identifies that build, even if you use the same source code and compile the same setting. Correspondingly, dSYM files cannot be used to parse other binary information, even if built from the same source code

1. DSYM acquisition method

  • 1. Download dSYM files from Xcode

Xcode -> Window -> Organizer -> Right-click your app Show Finder -> Right-click. Xcarchive displays package contents ->dSYMs-> test.app.dysm

  • 2. Download the dSYM file from iTunes Connect

Open the App details page and click on the Activity. From all builds, select a version and click on the link to download the dSYM file

  • 3 Use mdFind to retrieve data

Query the UUID corresponding to crash on the Issue page of Bugly:

Then in Mac Shell, run mdfind to locate the dSYM file: mdfind “com_apple_xcode_dsym_uuids ==


Note that when using MDfind, the UUID requires format conversion (add "-") : 12345678-1234-1234-12334-XXXXXXXXXXXX For example, the UUID of the dSYM to be located is: E30FC309DF7B3C9F8AC57F0F6047D65F positioning dSYM file command is as follows

mdfind "com_apple_xcode_dsym_uuids == E30FC309-DF7B-3C9F-8AC5-7F0F6047D65F"
                                     |12345678-1234-1234-1234-xxxxxxxxxxxx|
Copy the code

It is recommended that you back up the dSYM file of the APP every time you build or release the APP version.

2. Symbolic process

  • Atos command

    The ATos command replaces the number in an address with an equivalent symbol. If the debug symbol information is complete, the output of ATOS will contain the file name and the corresponding resource line number. The atos command can be used to individually symbolise unsymbolised or partially symbolised crash reports (addresses in stack information).

To use ATOS to symbolize crash report, you can operate as follows:

  • 1. Find the line you want to symbolize and write down the binary name in the second column and the address in the third column.
  • 2, Find the name in the binary list at the bottom of the Crash report and write down the schema name and the loading address.

Atos [-ARCH architecture name] [-O symbol table] [-L module address] [method address]

  • Use Xcode to symbolize iOS Crash report

In general, Xcode will automatically attempt to symbolize all of its Crash reports. So you just need to add crash Report to Xcode Organizer. Note: Xcode only recognizes the suffix “crash report”. If you receive a crash report without a suffix or with a suffix of TXT, change it to.crash before performing the following steps.

Select Devices from the Window menu bar to the left of Devices, Select a Device and click on the right side of the "View Device Logs" button under "Device Information" to drag your Crash report to the left panel. Xcode will automatically symbolize the Crash report and display the resultsCopy the code

To symbolize a Crash report, Xcode needs to locate the following information:

The binary information of the crashed app and the dSYM files of the custom framework associated with all apps. If the framework is built from an app, their dYSM is copied into the Archive along with the APP’s dSYM file. If it’s a third party framework, you need to go to the author and ask for the dYSM file. Symbol table information of the OS on which the APP depends when a crash occurs. These symbol tables contain debugging information needed for the framework on a particular OS version, such as iOS9.3.3. The ARCHITECTURE of the OS symbol table is unique — a 64-bit iOS device will not include the ARMV7 symbol table. Xcode will automatically copy the symbol table of the particular version of the Mac to which you are connected.

In any of the above, you will not be able to symbolize a crash report without Xcode, or only partially symbolize a crash report.

Such as:

Understand and analyze iOS Crash Report