问题描述
对于iOS崩溃报告,只需将崩溃报告拖放到管理器中即可.
但是此方法不适用于Mac OSX崩溃报告.
如何表示我的Mac OSX崩溃报告?
谢谢!!
您可以使用atos命令获取应用崩溃的行号.
这里有一个快速指南:
- 为您的工作文件创建目录
- 打开Xcode,选择窗口"->整理器",转到存档"标签,然后找到遇到崩溃的应用版本.
- 右键单击应用程序存档,然后选择在Finder中显示"
- 右键单击.xarchive,选择显示目录",然后找到AppName.dSYM目录和该应用,并将其复制到您的工作文件夹中
- 将堆栈跟踪复制到您的工作文件夹中
- 打开终端并转到您的工作文件夹. ls应该显示YourApp.app YourApp.app.dSYM stacktrace.txt
- 在TextEdit中打开堆栈跟踪.您需要从标题(系统体系结构-例如X86-64)和崩溃的地址中找到代码类型.搜索线程以查找崩溃的线程(它会说类似线程2崩溃"),然后找到您的对象.您需要该行中的两个地址(十六进制数字)才能获得代码行.
-
获得所有信息后,您需要在终端中运行以下内容:
atos -o YourApp.app/Contents/MacOS/YourApp -arch x86_64 -l [load-address] [address]
例如,以下是从堆栈跟踪中提取的内容:
For iOS crash reports, it is sufficient to drag and drop the crash report to the Organizer.
Symbolicating iPhone App Crash Reports
But this method doesn't work for Mac OSX crash reports.
How can I symbolicate my Mac OSX crash report ?
Thanks !!
解决方案You can use the atos command to get the line number where the app crashed.
Heres a quick guide:
- Create a directory for your working files
- Open Xcode, select Window->Organizer, goto the Archive tab and find the version of your app that experienced the crash.
- Right click on the app archive and select "Show in Finder"
- Right click on the .xarchive, select "Show Contents" and find the AppName.dSYM directory and the app and copy them to your working folder
- Copy the stack trace to your working folder
- Open terminal and change to your working folder. An ls should show YourApp.app YourApp.app.dSYM stacktrace.txt
- Open your stack trace in TextEdit. Your going to need to find the Code Type from the header (system architecture - eg. X86-64) and the addresses of the crash. Search through the threads to find the one that crashed (it will say something like "Thread 2 Crashed") then find your objects. You need the two addresses (hex numbers) from that line to get the code line.
Once you've got all the information you need to run the following in the terminal:
atos -o YourApp.app/Contents/MacOS/YourApp -arch x86_64 -l [load-address] [address]
For example, heres an extract from a stacktrace:
Process: MyApp [228] Path: /Applications/MyApp.app/Contents/MacOS/MyApp Identifier: uk.co.company.app Version: 1.0 (1) App Item ID: 774943227 App External ID: 218062633 Code Type: X86-64 (Native) Parent Process: launchd [154] Responsible: MyApp [228] User ID: 501 Date/Time: 2013-12-17 10:20:45.816 +0100 OS Version: Mac OS X 10.9 (13A603) Report Version: 11 Anonymous UUID: 7AA662B1-7696-A2C5-AF56-9D4BA2CE9515 Crashed Thread: 2 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 <snip> Thread 2 Crashed: 0 libsystem_kernel.dylib 0x00007fff8b95a866 __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff8bf4f35c pthread_kill + 92 2 libsystem_c.dylib 0x00007fff87571bba abort + 125 3 libsystem_malloc.dylib 0x00007fff897ae093 free + 411 4 uk.co.company.app 0x0000000103580606 0x10356e000 + 75270 5 uk.co.company.app 0x00000001035803da 0x10356e000 + 74714 6 com.apple.Foundation 0x00007fff8d00970b __NSThread__main__ + 1318 7 libsystem_pthread.dylib 0x00007fff8bf4e899 _pthread_body + 138 8 libsystem_pthread.dylib 0x00007fff8bf4e72a _pthread_start + 137 9 libsystem_pthread.dylib 0x00007fff8bf52fc9 thread_start + 13I can see that the "Code Type" is x86_64, that Thread 2 crashed, and that on line 4 my code was running so we have the addresses we need. Using this information I run the following:
$ atos -o MyApp.app/Contents/MacOS/MyApp -arch x86_64 -l 0x10356e000 0x0000000103580606This returns:
got symbolicator for MyApp.app/Contents/MacOS/MyApp, base address 100000000 obj_free (in MyApp) (somefile.c:135)Telling me my app crashed at line 135 of somefile.c
这篇关于如何象征苹果发布的Mac OSX崩溃报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!