解析iOS崩溃日志(crash Log)
来源:互联网 发布:电路接线图软件 编辑:程序博客网 时间:2024/05/21 12:55
最近在解析umeng错误分析日志上有了重大突破!
很显然,我们的应用免不了crash,各种各样的crash,不过大部分在提交至appstore前经过严格的“消毒”后,所剩无几了。but(这个词..)漏网之鱼总是有的嘛(貌似很多..囧)。好吧,看下文:
首先看一些这些线上app crash 信息:
* Application received signal SIGSEGV* Application received signal SIGBUS* -[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds for empty array* -[JKArray objectAtIndex:]: index (0) beyond bounds (0)
SIGSEGV和SIGBUS一般是因为访问已被释放的内存或者调用不存在的方法导致的,余下两个就是数组越界的问题了这些你都知道的,然后来看看具体的log信息:
Application received signal SIGSEGV
Application received signal SIGSEGV(null)(0 CoreFoundation 0x32f1c3ff + 1861 libobjc.A.dylib 0x3ac17963 objc_exception_throw + 302 CoreFoundation 0x32f1c307 + 1063 appname 0x14e1e1 appname + 13644494 libsystem_c.dylib 0x3b08bd33 _sigtramp + 345 appname 0x97525 appname + 6157176 CoreFoundation 0x32e6d349 _CFXNotificationPost + 14207 Foundation 0x337879cd + 1688 Foundation 0x337876c1 + 1369 appname 0x96f2f appname + 61419110 Foundation 0x33858915 + 1611 Foundation 0x33798769 + 20012 Foundation 0x33798685 + 6013 CFNetwork 0x32bf964f + 2614 CFNetwork 0x32bf8d33 + 5415 CFNetwork 0x32c21013 + 1816 CoreFoundation 0x32e62acd CFArrayApplyFunction + 17617 CFNetwork 0x32c21473 + 7418 CFNetwork 0x32b85461 + 18819 CoreFoundation 0x32ef18f7 + 1420 CoreFoundation 0x32ef115d + 21221 CoreFoundation 0x32eeff2f + 64622 CoreFoundation 0x32e6323d CFRunLoopRunSpecific + 35623 CoreFoundation 0x32e630c9 CFRunLoopRunInMode + 10424 GraphicsServices 0x36a4233b GSEventRunModal + 7425 UIKit 0x34d7f2b9 UIApplicationMain + 112026 appname 0xf3df appname + 5833527 appname 0x3578 appname + 9592)dSYM UUID: 365EF56E-D598-3B94-AD36-BFA13772A4E3CPU Type: armv7sSlide Address: 0x00001000Binary Image: appnameBase Address: 0x000f7000
–[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds for empty array
*** -[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds for empty array(null)(0 CoreFoundation 0x330dc3ff + 1861 libobjc.A.dylib 0x3add7963 objc_exception_throw + 302 CoreFoundation 0x33027ef9 + 1643 appname 0xcbcaf appname + 8306394 appname 0x40bc1 appname + 2610575 appname 0x3d297 appname + 2464236 UIKit 0x34f36569 + 4087 UIKit 0x34f1b391 + 13168 UIKit 0x34f32827 + 2069 UIKit 0x34eee8c7 + 25810 QuartzCore 0x34c9a513 + 21411 QuartzCore 0x34c9a0b5 + 46012 QuartzCore 0x34c9afd9 + 1613 QuartzCore 0x34c9a9c3 + 23814 QuartzCore 0x34c9a7d5 + 31615 QuartzCore 0x34c9a639 + 6016 CoreFoundation 0x330b1941 + 2017 CoreFoundation 0x330afc39 + 27618 CoreFoundation 0x330aff93 + 74619 CoreFoundation 0x3302323d CFRunLoopRunSpecific + 35620 CoreFoundation 0x330230c9 CFRunLoopRunInMode + 10421 GraphicsServices 0x36c0233b GSEventRunModal + 7422 UIKit 0x34f3f2b9 UIApplicationMain + 112023 appname 0xf3df appname + 5833524 appname 0x3578 appname + 9592)dSYM UUID: 365EF56E-D598-3B94-AD36-BFA13772A4E3CPU Type: armv7sSlide Address: 0x00001000Binary Image: appnameBase Address: 0x000c3000
好了,相信你也看出来了,这些具体的crash log 什么都看不出来,都是一些内存地址,帧调用栈等,所以需要进一步的解析,看下文:
看一下上面的crash log,找到一句
5 appname 0x97525 appname + 615717
它指出了应用名称,崩溃时的调用方法的地址,文件的地址以及方法所在的行的位置(具体请看这篇文章),接下来就要符号化(Symbolication)这句,用dwarfdump来检测crash log中dSYM UUID和本地的dSYM文件是否匹配
打开终端:
cd /Users/username/Library/Developer/Xcode/Archives/2013-08-30/app 8-30-13 6.19 PM.xcarchive/dSYMsdwarfdump --uuid appname.app.dSYMUUID: 9F0AEFA6-4349-30AF-8420-BCEE739DA0B4 (armv7) appname.app.dSYM/Contents/Resources/DWARF/appnameUUID: 365EF56E-D598-3B94-AD36-BFA13772A4E3 (armv7s) appname.app.dSYM/Contents/Resources/DWARF/appname
OK,crash log中的dSYM UUID与本地的dYSM文件是相匹配的。好接下来就查一下0x97525这个地址是什么,
dwarfdump --arch=armv7 --lookup 0x97525 /Users/username/Library/Developer/Xcode/Archives/2013-08-30/appname\ 8-30-13\ 6.19\ PM.xcarchive/dSYMs/appname.app.dSYM/Contents/Resources/DWARF/appname
得到的结果:
----------------------------------------------------------------------File: /Users/username/Library/Developer/Xcode/ Archives/2013-08-30/appname 8-30-13 6.19 PM.xcarchive/dSYMs/appname.app.dSYM/Contents/ Resources/DWARF/appname (armv7)----------------------------------------------------------------------Looking up address: 0x0000000000097525 in .debug_info... found!0x00359c67: Compile Unit: length = 0x000066f1 version = 0x0002 abbr_offset = 0x00000000 addr_size = 0x04 (next CU at 0x0036035c)0x00359c72: TAG_compile_unit [1] * AT_producer( "Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)" ) AT_language( DW_LANG_ObjC ) AT_name( "xxx/EGOImageView.m" ) AT_low_pc( 0x0009710c ) AT_stmt_list( 0x000655c1 ) AT_comp_dir( "xxx" ) AT_APPLE_optimized( 0x01 ) AT_APPLE_major_runtime_vers( 0x02 )0x00359e57: TAG_subprogram [10] * AT_name( "-[EGOImageView imageLoaderDidFailToLoad:]" ) AT_decl_file( "xxx/EGOImageView.m" ) AT_decl_line( 96 ) AT_prototyped( 0x01 ) AT_APPLE_isa( 0x01 ) AT_low_pc( 0x00097490 ) AT_high_pc( 0x00097572 ) AT_frame_base( r7 ) AT_object_pointer( {0x00359e6e} )Line table dir : 'xxx'Line table file: 'EGOImageView.m' line 99, column 2 with start address 0x00000000000974feLooking up address: 0x0000000000097525 in .debug_frame... found!0x0000c620: FDE length: 0x0000000c CIE_pointer: 0x00000000 start_addr: 0x00097490 -[EGOImageView imageLoaderDidFailToLoad:]range_size: 0x000000e2 (end_addr = 0x00097572)Instructions: 0x00097490: CFA=4294967295+4294967295
看一下结果:发现有AT_name、Line table dir :、Line table file:,aha!找到了出错的地方(出错的这个文件是网上别人写的,有bug,现已不再使用)。
0 0
- 解析IOS崩溃日志(crash Log)
- 解析IOS崩溃日志(crash Log)
- 解析IOS崩溃日志(crash Log)
- 解析iOS崩溃日志(crash Log)
- 解析IOS崩溃日志(crash Log)
- crash Log- 解析IOS崩溃日志
- 友盟抓取crash Log- 解析IOS崩溃日志
- iOS 崩溃日志 Crash Log 分析汇总
- iOS开发-应用崩溃日志分析(Crash Log)
- iOS开发-应用崩溃日志分析(Crash Log)
- iOS 崩溃Crash解析
- iOS Crash 崩溃日志总结
- iOS崩溃crash大解析
- iOS崩溃crash大解析
- iOS崩溃crash大解析
- iOS崩溃crash大解析
- iOS崩溃crash大解析
- iOS崩溃crash大解析
- [从头学数学] 第220节 带着计算机去高考(十二)
- 数据库之SQL SERVER中使用函数去掉结果数据中的空格
- OPENJUDGE 4982 踩方格
- 利用redis + lua解决抢红包高并发的问题
- 了解一些ECMAScript 6
- 解析iOS崩溃日志(crash Log)
- 无敌版动画
- GCD的线程间通信
- C++:内联函数、重载函数、递归、补码
- viewpager 添加Fragment 每次滑动调接口 获取数据
- 使用Genymotion出现错误INSTALL_FAILED_CPU_ABI_INCOMPATIBLE解决方法
- java链表和递归算法学习
- HTML+CSS基础(七):CSS选择器
- 8、重写历史记录