标签:
一个字符串,在iOS上每个可执行文件或库文件都包含至少一个UUID,目的是为了唯一识别这个文件。
苹果提供的命令行工具,其中一些功能就是查看可执行文件或库文件的UUID。示例:
dwarfdump --uuid 应用名称.app/应用名称 dwarfdump --uuid 应用名称.dSYM
苹果提供的命令行工具,可以将crash日志符号化为可读的堆栈信息。XCode6/XCode7版本中,其路径为/Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash
苹果提供的命令行工具,可以将crash的base_address和load_address转化为可读的堆栈信息。symbolicatecrash就是使用这个命令来做符号化的。
模拟器/Mac应用崩溃后可以在“~/Library/Logs/DiagnosticReports/”下找到crash日志。
手机和mac连接后,打开Xcode选择window进入 Devices标签栏。 如下图所示:
选择“View Device Logs”按钮,就可以看到崩溃日志:
日志存放的路径 ~/Library/Logs/CrashReporter/MobileDevice/DEVICE_NAME,DEVICE_NAME是你想要查看的设备。
app在真机设备上Crash后,我们可以让iOS设备和mac连接,然后打开Xcode选择window进入 Devices标签栏. 在左侧的导航面板上,选中设备,单击“View Device Logs”按钮,就可以看到已经符号化完毕的日志。如图所示:
symbolicatecrash是苹果随Xcode一起提供的专门用来做崩溃日志符号化的脚本工具(perl)。
symbolicatecrash存放路径是
“/Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash"
因为symbolicatecrash可以独立使用,因此我们可以把它复制到指定的目录下,如放到根目录的bin文件夹下面,然后将相应的crash和dsym文件拷贝到该目录下,如下图所示:
使用方法是:
./symbolicatecrash ./*.crash ./*.app.dSYM > symbol.crash
【注意】:终端有可能会出现:Error: "DEVELOPER_DIR" is not defined at ./symbolicatecrash line 60,遇到该错误的时候,在终端输入如下命令:
export DEVELOPER_DIR="/Applications/XCode.app/Contents/Developer"
如下图所示:
生成的symbol.crash如下图所示:
### 1.进程信息 ### Incident Identifier: 2F6FE1EF-0653-4CF1-A83B-27DF7D57D152 CrashReporter Key: 06a7a1ed53669f0375772f0765603cbd2d2cb414 Hardware Model: iPhone6,2 Process: newPatient [9506] Path: /private/var/mobile/Containers/Bundle/Application/00B0A0AD-628A-4795-9654-B9E440BA6F14/newPatient.app/newPatient Identifier: com.haodf.newPatient Version: 10840 (3.4.1) Code Type: ARM-64 (Native) Parent Process: launchd [1] ### 2.基本信息 ### Date/Time: 2016-03-16 16:59:41.41 +0800 Launch Time: 2016-03-16 16:59:39.39 +0800 OS Version: iOS 9.2.1 (13D15) Report Version: 105 ### 3.异常信息 ### Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0 Filtered syslog: None found ### 4.线程回溯 ### Last Exception Backtrace: 0 CoreFoundation 0x180e99900 __exceptionPreprocess + 124 1 libobjc.A.dylib 0x180507f80 objc_exception_throw + 56 2 CoreFoundation 0x180d7fac4 -[__NSArrayI objectAtIndex:] + 196 3 newPatient 0x100a7970c 0x100098000 + 10360588 4 newPatient 0x101083114 0x100098000 + 16691476 5 UIKit 0x185cc1f38 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1316 6 UIKit 0x185d80018 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 376 7 UIKit 0x185e3cb70 _runAfterCACommitDeferredBlocks + 292 8 UIKit 0x185e4a030 _cleanUpAfterCAFlushAndRunDeferredBlocks + 92 9 UIKit 0x185b7dc24 _afterCACommitHandler + 96 10 CoreFoundation 0x180e50588 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32 11 CoreFoundation 0x180e4e32c __CFRunLoopDoObservers + 372 12 CoreFoundation 0x180e4e75c __CFRunLoopRun + 928 13 CoreFoundation 0x180d7d680 CFRunLoopRunSpecific + 384 14 GraphicsServices 0x18228c088 GSEventRunModal + 180 15 UIKit 0x185bf4d90 UIApplicationMain + 204 16 newPatient 0x1008da544 0x100098000 + 8660292 17 libdyld.dylib 0x18091e8b8 start + 4 Global Trace Buffer (reverse chronological seconds): 1.076547 CFNetwork 0x0000000181513104 TCP Conn 0x1557dcd60 complete. fd: 14, err: 0 1.077687 CFNetwork 0x0000000181514630 TCP Conn 0x1557dcd60 event 1. err: 0 1.127049 CFNetwork 0x0000000181514708 TCP Conn 0x1557dcd60 started 1.198354 CFNetwork 0x0000000181513104 TCP Conn 0x15686f720 complete. fd: 14, err: 0 1.202190 CFNetwork 0x0000000181514630 TCP Conn 0x15686f720 event 1. err: 0 1.269881 CFNetwork 0x0000000181514708 TCP Conn 0x15686f720 started 1.329771 CFNetwork 0x0000000181513104 TCP Conn 0x1557abdc0 complete. fd: 14, err: 0 1.331608 CFNetwork 0x0000000181514630 TCP Conn 0x1557abdc0 event 1. err: 0 1.390077 CFNetwork 0x0000000181514708 TCP Conn 0x1557abdc0 started 1.390513 CFNetwork 0x0000000181513104 TCP Conn 0x1557b78e0 complete. fd: 15, err: 0 1.391615 CFNetwork 0x0000000181514630 TCP Conn 0x1557b78e0 event 1. err: 0 1.404025 CFNetwork 0x000000018147184c TCP Conn 0x15680f4b0 SSL Handshake DONE 1.438749 CFNetwork 0x000000018147175c TCP Conn 0x15680f4b0 starting SSL negotiation 1.439767 CFNetwork 0x0000000181513104 TCP Conn 0x15680f4b0 complete. fd: 17, err: 0 1.440554 CFNetwork 0x0000000181514708 TCP Conn 0x1557b78e0 started 1.440838 CFNetwork 0x0000000181514630 TCP Conn 0x15680f4b0 event 1. err: 0 1.444573 CFNetwork 0x0000000181513104 TCP Conn 0x156812200 complete. fd: 19, err: 0 1.446372 CFNetwork 0x0000000181514630 TCP Conn 0x156812200 event 1. err: 0 1.457398 CFNetwork 0x0000000181514708 TCP Conn 0x15680f4b0 started 1.458434 CFNetwork 0x0000000181514708 TCP Conn 0x156812200 started 1.483722 CFNetwork 0x000000018147184c TCP Conn 0x15680bbe0 SSL Handshake DONE 1.527764 CFNetwork 0x000000018147175c TCP Conn 0x15680bbe0 starting SSL negotiation 1.530029 CFNetwork 0x0000000181513104 TCP Conn 0x15680bbe0 complete. fd: 4, err: 0 1.532408 CFNetwork 0x0000000181514630 TCP Conn 0x15680bbe0 event 1. err: 0 1.574343 CFNetwork 0x0000000181514708 TCP Conn 0x15680bbe0 started 1.577344 CFNetwork 0x00000001815698bc Creating default cookie storage with default identifier 1.577438 CFNetwork 0x0000000181569888 Faulting in CFHTTPCookieStorage singleton 1.577438 CFNetwork 0x00000001815bb558 Faulting in NSHTTPCookieStorage singleton Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_kernel.dylib 0x0000000180a3c140 __pthread_kill + 8 1 libsystem_pthread.dylib 0x0000000180b04ef8 pthread_kill + 112 2 libsystem_c.dylib 0x00000001809addac abort + 140 3 libc++abi.dylib 0x00000001804e13f4 __cxa_bad_cast + 0 4 libc++abi.dylib 0x00000001804fde98 default_unexpected_handler() + 0 5 libobjc.A.dylib 0x0000000180508248 _objc_terminate() + 124 6 libc++abi.dylib 0x00000001804faf44 std::__terminate(void (*)()) + 16 7 libc++abi.dylib 0x00000001804fab10 __cxa_rethrow + 144 8 libobjc.A.dylib 0x0000000180508120 objc_exception_rethrow + 44 9 CoreFoundation 0x0000000180d7d728 CFRunLoopRunSpecific + 552 10 GraphicsServices 0x000000018228c088 GSEventRunModal + 180 11 UIKit 0x0000000185bf4d90 UIApplicationMain + 204 12 newPatient 0x00000001008da544 0x100098000 + 8660292 13 libdyld.dylib 0x000000018091e8b8 start + 4 Thread 1: 0 libsystem_kernel.dylib 0x0000000180a3cb6c __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x0000000180b01530 _pthread_wqthread + 1284 2 libsystem_pthread.dylib 0x0000000180b01020 start_wqthread + 4 Thread 2 name: Dispatch queue: com.apple.libdispatch-manager Thread 2: 0 libsystem_kernel.dylib 0x0000000180a3d4fc kevent_qos + 8 1 libdispatch.dylib 0x000000018090094c _dispatch_mgr_invoke + 232 2 libdispatch.dylib 0x00000001808ef7bc _dispatch_source_invoke + 0 //省略了部分线程日志 ### 5.线程状态 ### Thread 0 crashed with ARM Thread State (64-bit): x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x000000015578ece7 x4: 0x00000001804fee02 x5: 0x000000016fd674d0 x6: 0x000000000000006e x7: 0x0000000000000fa0 x8: 0x0000000008000000 x9: 0x0000000004000000 x10: 0x0000000000000002 x11: 0x0000000000000010 x12: 0x0000000000000000 x13: 0x0000000000000002 x14: 0x0000000000000000 x15: 0x0000030000000300 x16: 0x0000000000000148 x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x0000000000000006 x20: 0x000000019e4bc000 x21: 0x000000016fd674d0 x22: 0x0000000155516bf0 x23: 0x000000019e4c7b68 x24: 0x0000000000000001 x25: 0x87001a44017766b4 x26: 0x0000000155504e80 x27: 0x0000000000000000 x28: 0x0000000000000001 fp: 0x000000016fd67430 lr: 0x0000000180b04ef8 sp: 0x000000016fd67410 pc: 0x0000000180a3c140 cpsr: 0x00000000 ### 6.动态库信息 ### Binary Images: 0x100098000 - 0x1015cbfff newPatient arm64 <9d28622234923355a849412ab7062230> /var/mobile/Containers/Bundle/Application/00B0A0AD-628A-4795-9654-B9E440BA6F14/newPatient.app/newPatient 0x1200cc000 - 0x1200fbfff dyld arm64 <9e98992ceed735e2ac4784cb28efe7c1> /usr/lib/dyld 0x180488000 - 0x180489fff libSystem.B.dylib arm64 <c4cd04b37e5f34698856a9384aefff40> /usr/lib/libSystem.B.dylib 0x18048c000 - 0x1804dffff libc++.1.dylib arm64 <d430d0ad16893b76bbc52468f65d5906> /usr/lib/libc++.1.dylib 0x1804e0000 - 0x1804fffff libc++abi.dylib arm64 <1c0a8ef87e8c37b2a577dc1a44e2b16e> /usr/lib/libc++abi.dylib 0x180500000 - 0x18086cfff libobjc.A.dylib arm64 <da8e482b3e7d3c40a798a0c86a3d6890> /usr/lib/libobjc.A.dylib 0x180870000 - 0x180874fff libcache.dylib arm64 <242f50f854a1301fa6f76b4531101238> /usr/lib/system/libcache.dylib 0x180878000 - 0x180883fff libcommonCrypto.dylib arm64 <962b6da2f76d3b22afb83adeb2b030ef> /usr/lib/system/libcommonCrypto.dylib 0x180884000 - 0x180887fff libcompiler_rt.dylib arm64 <516b8400a98f3a4fb8f82780faca4b31> /usr/lib/system/libcompiler_rt.dylib 0x180888000 - 0x18088ffff libcopyfile.dylib arm64 <c027b29d770e3a5e83aa48463916d3ed> /usr/lib/system/libcopyfile.dylib 0x180890000 - 0x1808ebfff libcorecrypto.dylib arm64 <f3daba6e74753ddc9d7a3df953621d46> /usr/lib/system/libcorecrypto.dylib //省略了部分日志
这部分是闪退进程的相关信息。
这部分给出了一些基本信息,包括闪退发生的日期和时间,设备的iOS版本。如果有很多崩溃日志都来自iOS 6.0,说明问题只发生在iOS 6.0上。
在这部分,你可以看到闪退发生时抛出的异常类型。还能看到异常编码和抛出异常的线程。根据崩溃报告类型的不同,在这部分你还能看到一些另外的信息。
这部分提供应用中所有线程的回溯日志。 回溯是闪退发生时所有活动帧清单。它包含闪退发生时调用函数的清单。看下面这行日志:
2 CoreFoundation 0x34648e88 0x83000 + 224
这条调用栈包括下面四部分:
这部分是闪退时寄存器中的值。一般不需要这部分的信息,因为回溯部分的信息已经足够让你找出问题所在。
这些信息包括动态库名称、UUID、模块起始地址、模块结束地址、指令集种类、安装路径等信息。
这些信息都是在符号化堆栈用到的。
*** -[__NSArrayI objectAtIndex:]: index 3 beyond bounds [0 .. 2] (null) ( 0 CoreFoundation 0x00000001853142f4 <redacted> + 160 1 libobjc.A.dylib 0x0000000196f900e4 objc_exception_throw + 60 2 CoreFoundation 0x00000001851f7b34 CFRunLoopRemoveTimer + 0 3 ????????? 0x000000010005e9c4 ????????? + 338372 4 UIKit 0x0000000189dff124 <redacted> + 404 5 UIKit 0x000000018a0167e8 <redacted> + 2376 6 UIKit 0x000000018a01919c <redacted> + 1504 7 UIKit 0x000000018a01770c <redacted> + 184 8 FrontBoardServices 0x000000018db513c8 <redacted> + 32 9 CoreFoundation 0x00000001852cc27c <redacted> + 20 10 CoreFoundation 0x00000001852cb384 <redacted> + 312 11 CoreFoundation 0x00000001852c99a8 <redacted> + 1756 12 CoreFoundation 0x00000001851f52d4 CFRunLoopRunSpecific + 396 13 UIKit 0x0000000189df83d0 <redacted> + 552 14 UIKit 0x0000000189df2f40 UIApplicationMain + 1488 15 ????????? 0x00000001000cbb14 ????????? + 785172 16 libdyld.dylib 0x000000019763aa08 <redacted> + 4 ) dSYM UUID: 5FFF54D6-71B5-37F5-AB11-4D7111E27BE2 CPU Type: arm64 Slide Address: 0x0000000100000000 Binary Image: ??? Base Address: 0x000000010000c000
方法一:从友盟下载错误分析工具,按如下步骤操作:
./umcrashtool //Users/GofLee/crash/zhaibuzhu.csv
方法二:使用dSYM协助分析(我一般用这个),操作很简单,截图如下:
略
略
标签:
原文地址:http://www.cnblogs.com/isItOk/p/5838181.html