iphone崩潰日志分析工具symbolicatecrash
Symbolicatecrash是Xcode自帶的一個分析工具,可以通過機器上的崩潰日志和應用的.dSYM文件定位發生崩潰的位置,把crash日志中的地址替換成代碼相應位置。
使用效果:
分析前:
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 CoreFoundation 0x3723b870 0x37180000 + 768112
1 CoreFoundation 0x37196648 0x37180000 + 91720
2 CoreFoundation 0x37181e90 0x37180000 + 7824
3 CoreFoundation 0x3718bb74 0x37180000 + 47988
4 CoreFoundation 0x3718ba8e 0x37180000 + 47758
5 UIKit 0x30f0f866 0x30f0a000 + 22630
6 UIKit 0x30f0f98a 0x30f0a000 + 22922
7 UIKit 0x30f0f98a 0x30f0a000 + 22922
8 UIKit 0x310cdf3e 0x30f0a000 + 1851198
9 UIKit 0x30f0ecb6 0x30f0a000 + 19638
10 UIKit 0x30fe7b80 0x30f0a000 + 908160
11 UIKit 0x30fe7ab2 0x30f0a000 + 907954
12 UIKit 0x30f5f452 0x30f0a000 + 349266
13 UIKit 0x30fbf936 0x30f0a000 + 743734
分析后:
0 CoreFoundation 0x3723b870 ___forwarding___ + 136
1 CoreFoundation 0x37196648 _CF_forwarding_prep_0 + 40
2 CoreFoundation 0x37181e90 CFRetain + 76
3 CoreFoundation 0x3718bb74 +[__NSArrayI __new::] + 48
4 CoreFoundation 0x3718ba8e -[__NSPlaceholderArray initWithObjects:count:] + 294
5 UIKit 0x30f0f866 -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 70
6 UIKit 0x30f0f98a -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 362
7 UIKit 0x30f0f98a -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 362
8 UIKit 0x310cdf3e __UIViewWillBeRemovedFromSuperview + 298
9 UIKit 0x30f0ecb6 -[UIView(Hierarchy) removeFromSuperview] + 50
10 UIKit 0x30fe7b80 -[UITableViewCell removeFromSuperview] + 124
11 UIKit 0x30fe7ab2 -[UITableView(_UITableViewPrivate) _reuseTableViewCell:] + 398
12 UIKit 0x30f5f452 -[UITableView reloadData] + 530
13 UIKit 0x30fbf936 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 938
使用方法:
1. 找到Symbolicatecrash文件
Xcode 4.3的之后
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/
Xcode 4.3之前
/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash
(附:Mac系統顯示隱藏文件
終端中輸入以下命令
顯示Mac隱藏文件的命令:defaults write com.apple.finder AppleShowAllFiles -bool true
隱藏Mac隱藏文件的命令:defaults write com.apple.finder AppleShowAllFiles -bool false
輸入完回車,重啟Finder:左上角的蘋果標志-->強制退出-->Finder-->重新啟動
)
2. Symbolicatecrash文件獨立於Xcode,可以拷出來使用,附件中為Xcode4.5中的Symbolicatecrash文件
3. 命終端中輸入命令,命令格式:Symbolicatecrash .crash .dSYM > aa.log
即:Symbolicatecrash + 崩潰日志 + APP對應的.dSYM文件 + > + 輸出到的文件
4. 如果提示"DEVELOPER_DIR" is not defined
Xcode4.3之后 在終端中輸入: export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
Xcode4.3之前 在終端中輸入: export DEVELOPER_DIR=/Applications/Xcode.app
建議:每次打出版本后備份相應的.dSYM文件,對應版本崩潰后可根據此文件分析崩潰日志
- by yuzhang2
