苹果官方 Crash文件分析方法 (iOS系统Crash文件分析方法)

来源:互联网 发布:淘宝怎么代充话费 编辑:程序博客网 时间:2024/05/05 09:13

转自  http://www.tuicool.com/articles/VzEBBn



苹果官方 Crash文件分析方法 (iOS系统Crash文件分析方法) 

对于提交的苹果官方的app,在审核的时候会给我们一些crash文件,对于这些有用的文件,里面是关于我们的bug的一些信息,那么该如何去调试呢 
第一步:在任意目录创建一个目录,用来调试crash,我这里创建一个crash目录 
第二步:将之前Archive的文件copy到crash目录里面

其中包括两个文件.app和.app.dSYM

如果找不到的话可以按照下面的步骤进行

先到Organizer

1,找到提交那个时刻的Archive文件,选中,show in Finder 

2,然后到达这里,然后再选中红色区域,会出现3中所示的提示 

3,ok显示包内容,然后自己找找吧,肯定会有的 

copy就好了 

第三步:将symbolicatecrash工具copy到crash目录 

找不到这个文件可以去

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources

这里看看,应该就会有了。

第四步:将要调试的crash文件copy到crash目录

这个crash文件,这里是来自苹果官方的,其实有时候也是来自其他的用户的电脑上的。 
第五步:通过命令进行测试 
打开终端,转到crash目录 
执行如下命令: 

./symbolicatecrash ./2013-08-16-035933_DLiPad.crash ./appname.app.dSYM > symbol.crashcat ./symbol.crash

结果如下: 

Incident Identifier: 5434D911-E207-4D79-9139-40EA4EA76B45CrashReporter Key:   d11ed3a4adbb0d9ca4d6016e73e439640f95f289Hardware Model:      xxxProcess:         appname [8158]Path:            /var/mobile/Applications/2AB1E8EB-6ECE-44F4-8195-4042339DD359/appname.app/appnameIdentifier:      appnameVersion:         ??? (???)Code Type:       ARM (Native)Parent Process:  launchd [1]Date/Time:       2013-08-16 03:59:33.513 +0800OS Version:      iOS 6.1.3 (10B329)Report Version:  104Exception Type:  EXC_CRASH (SIGABRT)Exception Codes: 0x00000000000000000x0000000000000000Crashed Thread:  0Last Exception Backtrace:0   CoreFoundation                    0x3126029e 0x3119e000 + 7952941   libobjc.A.dylib               0x3910497a 0x390fc000 + 351942   UIKit                         0x333f537c 0x33065000 + 37364443   UIKit                         0x3323758e 0x33065000 + 19101584   UIKit                         0x330c079c 0x33065000 + 3746845   UIKit                         0x33068c34 0x33065000 + 154126   UIKit                         0x330686c8 0x33065000 + 140247   UIKit                         0x33068116 0x33065000 + 125668   GraphicsServices                  0x34d5c59e 0x34d56000 + 260149   GraphicsServices                  0x34d5c1ce 0x34d56000 + 2503810  CoreFoundation                    0x3123516e 0x3119e000 + 61886211  CoreFoundation                    0x31235112 0x3119e000 + 61877012  CoreFoundation                    0x31233f94 0x3119e000 + 61429213  CoreFoundation                    0x311a6eb8 0x3119e000 + 3653614  CoreFoundation                    0x311a6d44 0x3119e000 + 3616415  UIKit                         0x330bf480 0x33065000 + 36979216  UIKit                         0x330bc2fc 0x33065000 + 35711617  appname                            0x000cf358 0xce000 + 495218  libdyld.dylib                 0x3953bb1c 0x3953a000 + 6940Thread 0 name:  Dispatch queue: com.apple.main-threadThread 0 Crashed:0   libsystem_kernel.dylib            0x39602350 __pthread_kill + 81   libsystem_c.dylib             0x3957911e pthread_kill + 542   libsystem_c.dylib             0x395b596e abort + 903   libc++abi.dylib               0x38b53d4a abort_message + 704   libc++abi.dylib               0x38b50ff4 default_terminate() + 205   libobjc.A.dylib               0x39104a74 _objc_terminate() + 1446   libc++abi.dylib               0x38b51078 safe_handler_caller(void (*)()) + 767   libc++abi.dylib               0x38b51110 std::terminate() + 168   libc++abi.dylib               0x38b52594 __cxa_rethrow + 849   libobjc.A.dylib               0x391049cc objc_exception_rethrow + 810  CoreFoundation                    0x311a6f1c CFRunLoopRunSpecific + 45211  CoreFoundation                    0x311a6d44 CFRunLoopRunInMode + 10012  UIKit                         0x330bf480 -[UIApplication _run] + 66413  UIKit                         0x330bc2fc UIApplicationMain + 111614  appname                                0x000cf358 0xce000 + 495215  libdyld.dylib                 0x3953bb1c start + 0Thread 1:0   libsystem_kernel.dylib            0x39602d98 __workq_kernreturn + 81   libsystem_c.dylib             0x39550cf6 _pthread_workq_return + 142   libsystem_c.dylib             0x39550a12 _pthread_wqthread + 3623   libsystem_c.dylib             0x395508a0 start_wqthread + 4Thread 2 name:  Dispatch queue: com.apple.libdispatch-managerThread 2:0   libsystem_kernel.dylib            0x395f2648 kevent64 + 241   libdispatch.dylib             0x39522974 _dispatch_mgr_invoke + 7922   libdispatch.dylib             0x39522654 _dispatch_mgr_thread$VARIANT$mp 32Thread 3:0   libsystem_kernel.dylib            0x39602d98 __workq_kernreturn + 81   libsystem_c.dylib             0x39550cf6 _pthread_workq_return + 142   libsystem_c.dylib             0x39550a12 _pthread_wqthread + 3623   libsystem_c.dylib             0x395508a0 start_wqthread + 4Thread 4 name:  WebThreadThread 4:0   libsystem_kernel.dylib            0x395f1eb4 mach_msg_trap + 201   libsystem_kernel.dylib            0x395f2048 mach_msg + 362   CoreFoundation                    0x31235040 __CFRunLoopServiceMachPort + 1243   CoreFoundation                    0x31233d9e __CFRunLoopRun + 8784   CoreFoundation                    0x311a6eb8 CFRunLoopRunSpecific + 3525   CoreFoundation                    0x311a6d44 CFRunLoopRunInMode + 1006   WebCore                       0x37196500 RunWebThread(void*) + 4407   libsystem_c.dylib             0x3955b30e _pthread_start + 3068   libsystem_c.dylib             0x3955b1d4 thread_start + 4Thread 0 crashed with ARM Thread State (32-bit):    r0: 0x00000000    r1: 0x00000000      r2: 0x00000000      r3: 0x3b0f8534    r4: 0x00000006    r5: 0x3b0f8b88      r6: 0x1d844f24      r7: 0x2fd329f4    r8: 0x1d844f00    r9: 0x00000300     r10: 0x334de04b     r11: 0x1c535350    ip: 0x00000148    sp: 0x2fd329e8      lr: 0x39579123      pc: 0x39602350  cpsr: 0x00000010......

再执行如下命令: 

dwarfdump --lookup 0x000cf358 --arch armv7 appname.app.dSYM/

关键是在这里 0x000cf358 ,他是来自这里的

0   libsystem_kernel.dylib            0x39602350 __pthread_kill + 8 
1   libsystem_c.dylib             0x3957911e pthread_kill + 54 
2   libsystem_c.dylib             0x395b596e abort + 90 
3   libc++abi.dylib               0x38b53d4a abort_message + 70 
4   libc++abi.dylib               0x38b50ff4 default_terminate() + 20 
5   libobjc.A.dylib               0x39104a74 _objc_terminate() + 144 
6   libc++abi.dylib               0x38b51078 safe_handler_caller(void (*)()) + 76 
7   libc++abi.dylib               0x38b51110 std::terminate() + 16 
8   libc++abi.dylib               0x38b52594 __cxa_rethrow + 84 
9   libobjc.A.dylib               0x391049cc objc_exception_rethrow + 8 
10  CoreFoundation                    0x311a6f1c CFRunLoopRunSpecific + 452 
11  CoreFoundation                    0x311a6d44 CFRunLoopRunInMode + 100 
12  UIKit                         0x330bf480 -[UIApplication _run] + 664 
13  UIKit                         0x330bc2fc UIApplicationMain + 1116 
14  应用的名称                                0x000cf358 0xce000 + 4952 
15  libdyld.dylib                 0x3953bb1c start + 0

结果如下: 

---------------------------------------------------------------------- File: appname.app.dSYM/Contents/Resources/DWARF/appname (armv7)----------------------------------------------------------------------Looking up address: 0x00000000000cf358 in .debug_info... found!0x0015d390: Compile Unit: length = 0x00001fc6  version = 0x0002  abbr_offset = 0x00000000  addr_size = 0x04  (next CU at 0x0015f35a)0x0015d39b: TAG_compile_unit [1] *             AT_producer( "Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)" )             AT_language( DW_LANG_ObjC )             AT_name( "/Users/zhy/Downloads/ios/vlink_app_xunyi/xunYi7/library/ASIHttpRequest/ASIDownloadCache.m" )             AT_low_pc( 0x000ccfc0 )             AT_stmt_list( 0x0002cf0b )             AT_comp_dir( "/Users/zhy/Downloads/ios/vlink_app_xunyi" )             AT_APPLE_major_runtime_vers( 0x02 )0x0015dd38:     TAG_subprogram [53] *                 AT_name( "-[ASIDownloadCache isCachedDataCurrentForRequest:]" )                 AT_decl_file( "/Users/zhy/Downloads/ios/vlink_app_xunyi/xunYi7/library/ASIHttpRequest/ASIDownloadCache.m" )                 AT_decl_line( 315 )                 AT_prototyped( 0x01 )                 AT_type( {0x0015d490} ( BOOL ) )                 AT_APPLE_isa( 0x01 )                 AT_low_pc( 0x000cf278 )                 AT_high_pc( 0x000cf9e2 )                 AT_frame_base( r7 )                 AT_object_pointer( {0x0015dd54} )0x0015dd86:         TAG_lexical_block [10] *                     AT_low_pc( 0x000cf2ca )                     AT_high_pc( 0x000cf9de )Line table dir : '/Users/zhy/Downloads/ios/vlink_app_xunyi/xunYi7/library/ASIHttpRequest'Line table file: 'ASIDownloadCache.m' line 320column 3 with start address 0x00000000000cf340Looking up address: 0x00000000000cf358 in .debug_frame... found!0x00007290: FDE        length: 0x0000000c   CIE_pointer: 0x00000000    start_addr: 0x000cf278 -[ASIDownloadCache isCachedDataCurrentForRequest:]    range_size: 0x0000076a (end_addr = 0x000cf9e2)  Instructions: 0x000cf278: CFA=4294967295+4294967295

到这里就知道问题所在了吧

Line table dir : '/Users/zhy/Downloads/ios/vlink_app_xunyi/xunYi7/library/ASIHttpRequest'Line table file: 'ASIDownloadCache.m' line 320, column 3 with start address 0x00000000000cf340

如果有多个crash文件的话,可以重复操作一遍就好了。


0 0
原创粉丝点击