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

如何分析iOS app crash 报告

2012-11-25 22:32 295 查看
最近在玩《永恒战士2》游戏,经常崩溃,然后救想知道为什么崩溃,我救研究了下crash 报告,然后用xcode 打开 看了 的很迷茫啊,

其实也不是很难,研究下,学习下原理就好了。

 Xcode没有自动的进行符号化,这时候就需要自己去把地址解析成符号。

但是前提是,必须有相同版本xxx.app对应的.dSYM文件。(dSYM文件在build->Products->Debug-iphoneos下,就是debug的symbols文件,也就是将内存地址,转换成程序里的函数或变量和所属于的
文件名)

这时候打开Terminal,进入到build/Debug-iphoneos
使用命令:
atos -arch arm7 -o XXX.app/XXX
0xabcdef

atos
-o MyAPP 0Xxxxxxxx -arch armv7 -l XXXXX
-l 后面跟的是动态加载的初始地址

这样就会显示出你出现bug的确切的那一行,或者方法名字 。
(XXX是你的App名字,用需要解析的地址替换上面的0xabcdef
arm7是编译App时所用的Architecture,也可能是arm6,如果在simulator上的App,这个位置应该用i386)

$atos
的参考和用法:

atos -- convert numeric addresses to symbols of binary images or processes

SYNOPSIS

     atos [-o <binary-image-file>] [-p <pid> | <partial-executable-name>] [-arch architecture] [-l <load-address>] [-s <slide>] [-printHeader]

          [-f <address-input-file>] [<address> ...]

DESCRIPTION

     The atos command converts numeric addresses to their symbolic equivalents.  If full debug symbol information is available, for example in a
     .app.dSYM sitting beside a .app, then the output of atos will include file name and source line number information.

其他参考资料:
http://stackoverflow.com/questions/5175990/ambiguous-iphone-crash-report https://developer.apple.com/library/ios/#technotes/tn2008/tn2151.html http://stackoverflow.com/questions/3065149/iphone-crash-log-doesnt-contain-methods-or-line-numbers?rq=1 http://www.cocoachina.com/macdev/cocoa/2010/0427/1222.html   (推荐)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: