iOS Crash log analysis

Source: Internet
Author: User
<span id="Label3"></p><span style="font-size: 18px;"><span style="font-size: 18px;">-, get Carsh log</span></span><p><p></p></p>1.Xcode getting logs<p><p></p></p><p><p>After the phone and Mac are connected, open Xcode Select window to enter organizer (the shortcut is shift-cmd-2), and on the organizer window, Select the Devices tab bar. On the left navigation panel, select Device Logs, as shown in:<br><br>You can see the crash log by selecting the Device Logs menu for the corresponding devices.<br>Open the device logs menu at the top of the diagram to see the crash logs for iOS devices that your Mac has Synced.</p></p><p><p></p></p>2. Get logs manually<p><p></p></p><p><p>Log storage Path ~/library/logs/crashreporter/mobiledevice/device_name</p></p><p><p></p></p><p><p>Device_name is the device you want to See.<br>Here is the information for my terminal output:</p></p><p><p></p></p><pre><pre><code class="rainbow">? DiagnosticReports <span class="support command">pwd/Users/zhuolaiqiang/Library/Logs/DiagnosticReports? DiagnosticReports <span class="support command">lsQQ_2014-05-30-132026_Anyhacker.crash atosl_2014-06-04-151416_Anyhacker.crash eclipse_2014-05-29-192522_Anyhacker.crash eclipse_2014-06-02-145714_Anyhacker.crashSogouInput_2014-05-29-151154_Anyhacker.crash atosl_2014-06-04-151447_Anyhacker.crash </span></span></code></pre></pre><p><p></p></p><p><p><span style="font-family: ‘Microsoft YaHei‘; font-size: 18px; color: #000000;"><strong>Two Symbolized</strong></span></p></p>1. Using Xcode to symbolize<p><p>After the app is crash on the real device, we can connect the iOS device to the Mac and then open the Xcode Select window to enter organizer (the shortcut is shift-cmd-2), and on the organizer window, select the device Logs tag, and then find the corresponding app log file:<br><br>This will allow you to see the signed log.</p></p>2. Using the Symbolicatecrash script to symbolize<p><p>Symbolicatecrash is the Scripting tool (perl) that Apple provides with Xcode to symbolize the crash log.<br>Symbolicatecrash Storage Path is<br>"/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/library/privateframeworks/ Dtdevicekitbase.framework/versions/a/resources/symbolicatecrash ".</p></p><p><p>Use this method:<br>Symbolicatecrash Xx.crash Xx.app.dSYM<br>Xx.crash: a symbolic crash log file is required<br>Xx.app.dSYM: DSYM file generated when compiling the app, this file can not be specified, Symbolicatecrash will automatically search and match the file on the hard disk (if your hard disk memory has this File)</p></p><p><p></p></p><span style="font-size: 18px;"><span style="font-size: 18px;">1. Using Xcode to symbolize</span></span><span style="font-size: 18px;"><span style="font-size: 18px;">2. Using the Symbolicatecrash script to symbolize</span></span><p><p>In fact, both of these analysis methods use the same tool symbolized: ***atos***.<br>Atos is an apple-provided symbolic tool that is installed by default on Mac OS Systems.<br>Using ***atos*** notation requires dSYM files. dSYM files are generated when the project is compiled, and all archived application files can be found under the Archives tab bar of Xcode organizer. It holds detailed information about the compilation process, including symbolic Information.</p></p><pre><pre><code>注意: 你必需同时保留应用二进制文件和.dSYM文件才能将崩溃日志完整符号化。每次提交到iTunes Connect的构建都必需归档。.dSYM文件和二进制文件是特定绑定于每一次构建和后续构建的,即使来自相同的源代码文件,每一次构建也与其他构建不同,不能相互替换。如果你使用Build 和 Archive 命令,这些文件会自动放在适当位置。 如果不是使用Build 和 Archive命令,放在Spotlight能够搜索到的位置(比如Home目录)即可。</code></pre></pre><p><p><br><br>Let's use ***atos*** to symbolize a crash<br>Or look at the following example:</p></p><pre><code># # # 1. Process Information # # #Incident Identifier:e4201f10-6f5f-40f9-b938-bb3da8ed7d50crashreporter key:todohardware Model:iphon E4,1process:taobao4iphone [3538]path:/var/mobile/applications/e3b51e77-d44d-4b3e-8767-b7dc2008d138/ta Obao4iphone.app/taobao4iphoneidentifier:com.taobao.taobao4iphoneversion:4.8.1code type:armparent Pro CESS:LAUNCHD [1]### 2. Basic information # # #Date/time:2014-09-16 21:39:30 +0000os version:iphone OS 7.1.2 (11d257) Report version:104### 3. Exception Information # # #Exception type:sigsegvexception codes:segv_accerr at 0xa2400db3crashed thread:0### 4. Thread Backtracking # # #Thread 0 name:dispatch queue:com.apple.main-thread### 5.Crash Call Stack # # #Thread 0 crashed:0 libobjc. A.dylib 0x3838760c 0x38375000 + 752761 taobao4iphone 0x012c03e1 0x66000 + 1924 40012 taobao4iphone 0x012c054f 0x66000 + 192443673 Foundation 0x2e4de16 3 0x2e419000 + 8072674 corefoundation 0x2dac9167 0x2da2a000 + 6516235 corefoundation 0x2dac8d7f 0x2da2a000 + 6506236 Corefoundation 0x2dac711b 0x2da2a000 + 6433557 corefoundation 0x2da31ebf 0x2d a2a000 + 324478 corefoundation 0x2da31ca3 0x2da2a000 + 319079 graphicsservices 0x3298b663 0x32982000 + 3849910 UIKit 0x3037e14d 0x30310000 + 45089311 Taobao4iphone 0x0006b349 0x66000 + 2132112 taobao4iphone 0x0006a5e8 0x66000 + 17896Thread 1:0 Libsystem_kernel.dylib 0x38928808 0x38928000 + 20561 libdispatch.dylib 0x38869e03 0x3885 f000 + 44547### 5. Dynamic Library Information # # #Binary images:0x66000-0x19cdfff +taobao4iphone armv7 &LT;43EBE409980F31FD9BE165A64B002AF 5>/var/mobile/applications/e3b51e77-d44d-4b3e-8767-b7dc2008d138/taobao4iphone.app/taobao4iphone 0x9fa9000- 0X9FB4FFF Quickspeak ARMv7 <eda7aee380373fad88f17971512f2777>/system/library/accessibilitybundles/quickspeak.bundle/ QUICKSPEAK0X2C667000-0X2C669FFF axspeechimplementation armv7 <fceb6d31f58d3c41afa9ace822d266a7>/system/ Library/accessibilitybundles/axspeechimplementation.bundle/axspeechimplementation</code></pre><p><p>I select a call to Symbolize:</p></p><pre><pre><code>1 Taobao4iPhone 0x012c03e1 0x66000 + 19244001</code></pre></pre><p><p>Use the following command to Symbolize:</p></p><pre><pre><code>atos -arch armv7 -o "Taobao4iPhone.app.dSYM" -l 0x66000 0x012c03e1</code></pre></pre><p><p>Results:</p></p><pre><pre><code>1 Taobao4iPhone 0x012c03e1 -[TBSNSPagesContainerView subviewLayoutPage:] (in Taobao4iPhone) (TBSNSPagesContainer.m:227)</code></pre></pre><p><p>You can see that the crash class is tbsnspagescontainerview, the function is subviewlayoutpage, the file name is tbsnspagescontainer.m, and the row count is 227 rows.<br><br>Let's go back and look at the Atos Usage:</p></p><pre><pre><code>atos -o dysm文件路径 -l 模块load地址 -arch cpu指令集种类 调用方法的地址</code></pre></pre><p><p>Dysm file Path: All archived app files can be found under the Archives tab bar in Xcode organizer. It holds detailed information about the compilation process, including symbolic Information.<br>Module load Address: The base address of the module load, you can find the base address of the corresponding module in the dynamic library information * * * of the Log. This is 0x66000.<br>CPU instruction Set Type: can be armv6 armv7 armv7s arm64. specifically, You can refer to the corresponding module in the dynamic library information * * * to DETERMINE. Such as</p></p><pre><pre><code>0x66000 - 0x19cdfff +Taobao4iPhone armv7 <43ebe409980f31fd9be165a64b002af5> /var/mobile/Applications/E3B51E77-D44D-4B3E-8767-B7DC2008D138/Taobao4iPhone.app/Taobao4iPhone</code></pre></pre><p><p>Then the CPU instruction set of the Taobao4iphone module is ARMV7</p></p><p><p></p></p><p><p><span style="font-size: 18pt;">Note:</span></p></p><p><p><span style="font-size: 18pt;">1. Symbolicatecrash Position</span></p></p><p><p><span style="font-size: 16px;">Symbolicatecrash is a hidden tool that has the exact path in my Mac as follows (xcode6.1.app please change to your Xcode Name)</span></p></p><p><p>/applications/xcode6.1.app/contents/sharedframeworks/dtdevicekitbase.framework/versions/a/resources/ Symbolicatecrash</p></p><p><p>You can also enter a command search in the Terminal:</p></p><pre><pre>Find/applications/xcode6.1.app-name Symbolicatecrash-type F</pre></pre><p><p>Copy this path, then stick to the Finder's "go to folder" and go to see the Symbolicatecrash tool, and now copy it to the crash folder on the Desktop. At this point, the crash folder now has 4 files, respectively. app,. crash,. Dsym,symbolicatecrash. The next step is to use the terminal to knock commands to generate crash that are easier to analyze.</p></p><p><p>first, use the CD command to go to the crash folder and enter the following command</p></p><pre><pre>./symbolicatecrash/users/xxxx/desktop/crash/inorder.crash/users/xxxx/desktop/crash/inorder.app.dsym > Control _symbol.crash</pre></pre><p><p>In the above command, "xxxx" and "inorder" should be replaced by their respective names. run, this time the terminal may error error: "developer_dir" is not defined At/usr/local/bin/symbolicatecrash line 53. At this time, enter the following in the terminal (xcode6.1.app is still to replace the actual Name)</p></p><pre>Export developer_dir= "/applications/xcode6.1.app/contents/developer"<br><strong><strong> <span style="font-size: 14pt;">2</span><span style="font-size: 14pt;">. Location of The. App.dsym<br></span></strong></strong><span style="font-size: 14pt;"><span style="font-size: 14pt;"><span style="font-size: small;"><span style="font-family: verdana, arial, helvetica, sans-serif;">"use the Finder to go to the path</span></span></span></span><span style="font-size: 14pt;"><span style="font-size: 14pt;"><span style="font-size: small;"><span style="font-family: verdana, arial, helvetica, sans-serif;">~/library/developer/xcode/archives/</span></span> <span style="font-size: small;"> <span style="font-family: verdana, arial, helvetica, sans-serif;">, you can see the date directory, the directory has a suffix named xcarchive file, Select the file, the right-click menu Select "show Package content", you can see a dsyms directory, the directory of XXX.app.dsYM files copied out, The analysis will be used Later. "</span></span><br><span style="font-size: small;"><span style="font-family: verdana, arial, helvetica, sans-serif;">If you find the</span></span> <span style="font-size: small;"><span style="font-family: verdana, arial, helvetica, sans-serif;">dsyms directory, But the file is empty and</span></span> cannot be found. <span style="font-size: small;"><span style="font-family: verdana, arial, helvetica, sans-serif;">XXX.app.dsYM, then configure the Xcode project build Settings------>debug information Format----dwarf with DsYM File, You can then regenerate the target to find the XXX.app.dsYM file in the dsyms directory. </span></span></span></span></pre><pre><pre><strong><span style="font-size: 14pt;"></span></strong></pre></pre><p><p> iOS crash log analysis </p> </p></span>

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.