iOS.Crash.CrashCommon

解决Crash的通用技术

1. symbolicatecrash 

1.1 symbolicatecrash 的路径

/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources

在终端中设定别名

alias symbolicate="/Developer/Platforms/iPhoneOS.platform/Developer/Library/\ PrivateFrameworks/DTDeviceKit.framework/Versions/A/\ Resources/symbolicatecrash -v"

alias symbolicate="/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash -v"

使用方法

symbolicate "MyApp_2011-05-10-170924-iPhone.crash" "MyApp.app"

1.2 symbolicatecrash on Xcode 8

"./Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash" in the Xcode.app folder.

find . -name symbolicatecrash

https://stackoverflow.com/questions/39858554/where-is-located-symbolicatecrash-in-xcode-8

1.3 DEVELOPER_DIR not defined in symbolicatecrash

"Error: "DEVELOPER_DIR" is not defined at /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash line 69. "

Solution: Objective c-Symbolication issue Error: “DEVELOPER_DIR” is not defined at ./symbolicatecrash line 60

Follow two steps to find and export missing DEVELOPER_DIR

    • Output of xcode-select --print-path on terminal is the value of DEVELOPER_DIR, something like, /Applications/Xcode.app/Contents/Developer
    • Run the following command in the Terminal app, or insert into ~/.bashrc if using Bash:
      export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer

2. otool

otool

3. atos的使用

3.1 atos中 -l 参数

http://stackoverflow.com/questions/13364648/what-determines-the-load-address-for-an-ios-app

Q: -l <load-address>, 那么load-address是什么呢?

A:在iOS App的.crash文件中, "Binary Images" section下面一行就是类似:"0xddd - 0xdee YourAppName arch <UUID> path"

其中"0xddd" 就是需要的load-address.

4. How to find crash logs for iPhone applications on Mac, Vista and XP

http://aplus.rs/apple/how-to-find-crash-logs-for-iphone-applications-on-mac-vista-and-xp/

/*

0   CoreFoundation                      0x310fa64f __exceptionPreprocess + 114

1   libobjc.A.dylib                     0x35df3c5d objc_exception_throw + 24

2   CoreFoundation                      0x310fe1bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102

3   CoreFoundation                      0x310fd649 ___forwarding___ + 508

4   CoreFoundation                      0x31074180 _CF_forwarding_prep_0 + 48

5   CoreData                            0x30de0f11 -[_NSSQLCoreConnectionObsever _purgeCaches:] + 124

6   Foundation                          0x30147183 _nsnote_callback + 142

7   CoreFoundation                      0x310c920f __CFXNotificationPost_old + 402

8   CoreFoundation                      0x31063eeb _CFXNotificationPostNotification + 118

9   Foundation                          0x301445d3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70

10  UIKit                               0x32809cb9 -[UIApplication _handleApplicationSuspend:eventInfo:] + 428

11  UIKit                               0x327a3af9 -[UIApplication handleEvent:withNewEvent:] + 1916

12  UIKit                               0x327a3215 -[UIApplication sendEvent:] + 44

13  UIKit                               0x327a2c53 _UIApplicationHandleEvent + 5090

14  GraphicsServices                    0x3224de77 PurpleEventCallback + 666

15  CoreFoundation                      0x310d1a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26

16  CoreFoundation                      0x310d383f __CFRunLoopDoSource1 + 166

17  CoreFoundation                      0x310d460d __CFRunLoopRun + 520

18  CoreFoundation                      0x31064ec3 CFRunLoopRunSpecific + 230

19  CoreFoundation                      0x31064dcb CFRunLoopRunInMode + 58

20  GraphicsServices                    0x3224d41f GSEventRunModal + 114

21  GraphicsServices                    0x3224d4cb GSEventRun + 62

22  UIKit                               0x327cdd69 -[UIApplication _run] + 404

23  UIKit                               0x327cb807 UIApplicationMain + 670

24  WeiBoPad                            0x000036b7 main + 90

25  WeiBoPad                            0x00003608 start + 40

*/ 

 

5. 总结的各种Crash

http://www.raywenderlich.com/23704/demystifying-ios-application-crash-logs 

 

6. 如何判断.crash文件是否和YourAppName.app以及YourAppName.app.dSYM匹配?

 

Ref[6]

6.1 从Crash Report中找到Build UUID

.crash 文件中的section "Binary Images:"

" The first line in the "Binary Images:" section of a crash report includes the build UUID, inside <>, of the app that crashed.

The line ends with the full path of the app's executable on the system. "

6.2 从app binary中找到Build UUID

$ xcrun dwarfdump --uuid <PATH_TO_APP_EXECUTABLE>

6.3 从.dSYM文件中找到Build UUID

$ xcrun dwarfdump --uuid <PATH_TO_DSYM_FILE>

http://zcg9033586.blog.163.com/blog/static/175217310201142410503203/

需要注意命令: dwarfdump


Reference

1. http://kevincupp.com/2011/05/12/symbolicating-ios-crash-logs.html 

2. Exploring iOS Crash Reports

http://www.plausible.coop/blog/?p=176 (推荐阅读)

3. 如何解读.crash文件中的"ARM Thread State" section

http://www.sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html

4. Understanding and Analyzing iOS Application Crash Reports  

https://developer.apple.com/library/ios/technotes/tn2151/_index.html

5. How to reproduce bugs reported against App Store submissions

https://developer.apple.com/library/ios/qa/qa1764/_index.html

6. How to Match a Crash Report to a Build

https://developer.apple.com/library/ios/qa/qa1765/_index.html


Where To Go:

1. iOS ABI Function Call Guide

https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html

2. 命令学习

2.1 mdfind

mdfind "com_apple_xcode_dsym_uuids == someUUID"

2.2 dwarfdump 

------------------

人老了,需要记点东西

原文地址:https://www.cnblogs.com/cwgk/p/2360505.html