Analyze iOS Crash file: 3 ways to symbolize iOS crash files

Source: Internet
Author: User

Transferred from: http://www.cocoachina.com/industry/20140514/8418.html

Transfer from Wufawei's blog

When your app is submitted to the App store or various channels, how often do you get the crash file? How do you analyze the crash file?

Upload crash fileYour app should have modules that can upload crash information when the application crash. Either through user feedback to get the crash file, or the use of their own or 3rd party crash upload module to get crash files. The scenario to be analyzed today is 3 ways to conform to the crash file (symbolicating crash logs) After you get the user's. crash file. Help find crash cause as soon as possible. Crash file ExamplesPart of the crash file:
last Exception backtrace:0 Corefoundation 0x30acaf46 exceptionpreprocess + 1261 LIBOBJC. A.dylib 0x3af0b6aa Objc_exception_throw + 342 corefoundation 0x30a0152e-[__nsarraym objectAtIndex:] + 2263 appName 0x000f 462a 0x4000 + 9846184 appName 0x00352aee 0x4000 + 3468014 ... AppName 0x00009404 0x4000 + 21508
You can see at a glance:
2 corefoundation 0x30a0152e-[__nsarraym objectatindex:] + 226
There is a problem with this line. However, lines 3rd and 4th are:
3 appName 0x000f462a 0x4000 + 9846184 appName 0x00352aee 0x4000 + 3468014
Did not point out that the app is the module caused by the problem, how to troubleshoot it? There are 3 ways Method 1 using XcodeThis approach is probably the easiest way to do it. To symbolize crash log with Xcode, you need the 3 files listed below: 1. Crash report (. crash file) 2. symbol file (. dsymb file) 3. Application files (appname.app file, change the IPA file suffix to zip, and then extract the Appname.app file under the payload directory), The appname Here is the name of your application。 Put the 3 files in the same directory, open the organizer under Xcode's Window menu, then click Devices tab, then select Device Logs on the left. Then drag the. crash file to device logs or select Import the. crash file below. So you can see the detailed log of crash. Such as: Method 2 Using the command-line tool SymbolicatecrashSometimes Xcode is not able to symbolize crash files well. Here we describe how to manually symbolize crash log with Symbolicatecrash. Before processing, keep the ". App", ". DSYM" and ". Crash" files in the same directory. Now open the terminal (Terminal) and enter the following command:
    1. Export Developer_dir=/applications/xcode.app/contents/developer
Then enter the command:
    1. /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/library/privateframeworks/ Dtdevicekitbase.framework/versions/a/resources/symbolicatecrash Appname.crash AppName.app > AppName.log
Now, the symbolic crash log is saved in the AppName.log. Method 3 Using the command-line tool AtosIf you have multiple ". IPA" files, multiple ". Dsymb" files, you are not sure exactly which ". IPA" File the "dsymb" file corresponds to, so this method is perfect for you. especially when your app is published to multiple channels, you need to write an automated analysis script for different channels of crash files, which is extremely useful.  Here we introduce a concept: UUID What is a uuid?Each executable program has a build UUID that uniquely identifies it. The crash log contains the [build UUID] of all library files loaded by the application (APP) build uuid that occurred crash and the time that the crash occurred. How do you know the UUID of the crash file? Can be used:
    1. grep "AppName armv" *crash
Or
    1. grep--after-context=2 "Binary Images:" *crash
You can get a result similar to the following:
    1. APPNAME.CRASH-0X4000-0X9E7FFF appName armv7 <8bdeaf1a0b233ac199728c2a0ebb4165>/var/mobile/applications/ A0f8ab29-35d1-4e6e-84e2-954de7d21ca1/appname.crash.app/appname
(Please note that the 0x4000 here is the load address of the module, which will be used when Atos is used later) How to find the app's UUIDYou can use the command:
    1. Xcrun dwarfdump-–uuid <AppName.app/ExecutableName>
Like what:
    1. Xcrun dwarfdump--uuid Appname.app/appname
The results are as follows:
    1. uuid:8bdeaf1a-0b23-3ac1-9972-8c2a0ebb4165 (ARMV7) appname.app/appname
    2. Uuid:5ea16bac-bb52-3519-b218-342455a52e11 (armv7s) appname.app/appname
The app has 2 uuid, indicating it is a fat binnary. It can take advantage of the latest hardware features, but also compatible with older devices. Compare the UUID of the crash file and app file above to find that they are matched:
    1. 8bdeaf1a-0b23-3ac1-9972-8c2a0ebb4165
use the Atos command to symbolize a specific module load addressThe command is:
    1. Atos [-O appname.app/appname] [-l loadaddress] [-arch architecture]
Pro-Test, the following 3 kinds can be:
    1. Xcrun atos-o appname.app.dsym/contents/resources/dwarf/appname-l 0x4000-arch armv7
    2. Xcrun Atos-o Appname.app.dsym/contents/resources/dwarf/appname-arch armv7
    3. Xcrun Atos-o Appname.app/appname-arch armv7
(Note: These 3 lines select any line of execution can achieve the purpose, where 0x4000 is the module's load address, from the above section can find how to get this address.) The following two lines are mentioned in the crash file at the beginning of the article
    1. * 3 appName 0x000f462a 0x4000 + 984618
    2. * 4 appName **0x00352aee** 0x4000 + 3468014
In the execution of the above:
    1. Xcrun atos-o appname.app.dsym/contents/resources/dwarf/appname-l 0x4000-arch armv7
After that, enter the following address:
    1. 0x00352aee
(line 4th in the crash file: 4 appName **0x00352aee** 0x4000 + 3468014) results can be obtained:
    1. -[uiscrollview (Uitouch) Touchesended:withevent:] (inappName) (uiscrollview+uitouch.h:26)
This will find out which module of the application is causing the crash problem. SummaryThis article analyzes the 3 ways to conform to the crash file after getting the user's. crash file, respectively, with its applicable scenarios, and Method 3 for automated crash file analysis. See also: [1]: How to Match a Crash report to a build[2]: Understanding and analyzing IOS application Crash reports[3]: fixing Bu Gs:using OS X crash logs and Atos to Symbolicate and find line numbers[4]: symbolicating crash logs[5]: symbolicating iPh One App Crash Reports

Analyze iOS Crash file: 3 ways to symbolize iOS crash files

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.