iphone崩溃日志分析工具symbolicatecrash用法
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