您的位置:首页 > 移动开发

利用.dSYM和.app文件准确定位Crash位置

2015-04-09 11:41 429 查看
首先,确保在release(Ad Hoc或者App Store)一个版本时,保存了对应的xxx.app和xxx.dSYM文件。

其次,验证xxx.crash、xxx.app和xxx.dSYM三者的uuid是否一致。

验证方法:

1)查看xxx.app的uuid。

[plain] view
plaincopyprint?





$ dwarfdump --uuid mobileguard.app/mobileguard

2)查看xxx.dSYM的uuid。

[plain] view
plaincopyprint?





$ dwarfdump --uuid mobileguard.app.dSYM/Contents/Resources/DWARF/mobileguard

3)xxx.crash。

Note:

在这之前,需要找到对应的app和dSYM文件。这两个文件是在后缀为.archive的文件中,在我的机器(Mac OS 10.9.1,Xcode5.0.2)上,.archive文件在“/Users/mikelin/Library/Developer/Xcode/Archives/”文件夹下对应的日期文件夹中,也可以从Xcode > Organizer > Archive 下找到对应的Archive包。

确保三者uuid一致以后,用symbolicatecrash工具生成易读的日志信息。

先准备环境:

1)链接symbollicatecrash到/usr/bin/中,就可以直接使用sybollicatecrash命令。

[plain] view
plaincopyprint?





$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash /usr/bin/symbolicatecrash

2)设置xcode DEVELOPER_DIR。

[plain] view
plaincopyprint?





export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"

然后执行命令:

[plain] view
plaincopyprint?





symbolicatecrash m.crash mobileguard.app.dSYM > n.crash

接下来是最重要的环节:

[plain] view
plaincopyprint?





$ xcrun atos -arch armv7 -o mobileguard.app/mobileguard 0x00037000

下面这个是我机器上看到的结果:

[plain] view
plaincopyprint?





$ xcrun atos -arch armv7 -o mobileguard.app/mobileguard 0x00037000

-[MobileLocationViewCtrl viewDidLoad] (in mobileguard) (MobileLocationViewCtrl.m:56)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: