xcode 如何象征苹果发布的 Mac OSX 崩溃报告?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5842147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to symbolicate Mac OSX crash reports issued by Apple?
提问by Regis_AG
For iOS crash reports, it is sufficient to drag and drop the crash report to the Organizer.
对于 iOS 崩溃报告,将崩溃报告拖放到 Organizer 就足够了。
Symbolicating iPhone App Crash Reports
But this method doesn't work for Mac OSX crash reports.
但此方法不适用于 Mac OSX 崩溃报告。
How can I symbolicate my Mac OSX crash report ?
如何表示我的 Mac OSX 崩溃报告?
Thanks !!
谢谢 !!
回答by A.Badger
You can use the atos command to get the line number where the app crashed.
您可以使用 atos 命令获取应用程序崩溃的行号。
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]
- 为您的工作文件创建一个目录
- 打开 Xcode,选择 Window->Organizer,转到 Archive 选项卡,然后找到发生崩溃的应用程序版本。
- 右键单击应用存档并选择“在 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 [加载地址] [地址]
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 + 13
I 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:
我可以看到“代码类型”是 x86_64,线程 2 崩溃了,并且在第 4 行我的代码正在运行,所以我们有我们需要的地址。使用这些信息,我运行以下命令:
$ atos -o MyApp.app/Contents/MacOS/MyApp -arch x86_64 -l 0x10356e000 0x0000000103580606
This 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
告诉我我的应用程序在 somefile.c 的第 135 行崩溃了
回答by Confused Vorlon
@inkjet 's comment above deserves its own answer. He built an app that does a full symbolication from your dsym and .crash file.
@inkjet 上面的评论值得自己回答。他构建了一个应用程序,可以根据您的 dsym 和 .crash 文件进行完整的符号化。
A free alternative to Sumbolon that I made: bch.us.to/apps/macsymbolicator — It uses atos in the same way described by Rich Able below. – inket Dec 24 '13 at 4:39
我制作的 Sumbolon 的免费替代品:bch.us.to/apps/macsymbolicator — 它以下面 Rich Able 描述的相同方式使用 atos。– inket 2013 年 12 月 24 日 4:39
putting it all together:
把它们放在一起:
download Mac Symbolicator from here
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
Drag your .crash file and AppName.dsym to Sumbolon
Magic happens
从这里下载 Mac Symbolicator
打开 Xcode,选择 Window->Organizer,转到 Archive 选项卡,然后找到发生崩溃的应用程序版本。
右键单击应用存档并选择“在 Finder 中显示”
右键单击 .xarchive,选择“显示内容”并找到 AppName.dSYM 目录
将您的 .crash 文件和 AppName.dsym 拖到 Sumbolon
魔法发生
回答by Anurag Soni
this link explains everything to symbolicate the crash log with the line no of crash. you just need to have .dsyms file, .app file and crash log in same folder
这个链接解释了用崩溃行号来象征崩溃日志的一切。你只需要在同一个文件夹中有 .dsyms 文件、.app 文件和崩溃日志
i looked around and find nothing better than this. so i am posting it by hoping this will help others.
我环顾四周,发现没有比这更好的了。所以我发布它希望这会帮助其他人。