如何手动符号化 iOS 崩溃以查看崩溃日志
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3832900/
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 Manually Symbolicate iOS Crash to View Crash Logs
提问by butchcowboy
Trying to debug app. The trouble is I cannot find this program.
正在尝试调试应用程序。问题是我找不到这个程序。
symbolicatecrash.sh
符号崩溃.sh
sudo cp /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneRemoteDevice.xcodeplugin/Contents/Resources/symbolicatecrash /usr/local/bin/
Is it a separate download? I am using XCode 3.2.3
是单独下载吗?我正在使用 XCode 3.2.3
Thanks.
谢谢。
回答by Sam
EDIT :: XCode 4.3
编辑:: XCode 4.3
You will want to follow the same steps as outlined in the original answer (below) with a few exceptions.
除了一些例外,您将需要遵循原始答案(如下)中概述的相同步骤。
First, you need to fix the Xcode path. Open a terminal and run:
首先,您需要修复 Xcode 路径。打开终端并运行:
/usr/bin/xcode-select -print-path
/usr/bin/xcode-select -print-path
If it displays "/Developer" or anything but "/Applications/Xcode.app/Contents/Developer/" then it is wrong. To fix this run the command:
如果它显示“/Developer”或除“/Applications/Xcode.app/Contents/Developer/”以外的任何内容,那么它是错误的。要解决此问题,请运行以下命令:
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/
须藤/usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/
You can now run all the steps below, with the exception that the symbolicatecrash
command is in a new spot (again). This is because Xcode now installs as an app. To find symbolicatecrash
run this from the terminal:
您现在可以运行以下所有步骤,除了symbolicatecrash
命令位于新位置(再次)。这是因为 Xcode 现在作为应用程序安装。 要从symbolicatecrash
终端运行它:
find /Applications/Xcode.app -name symbolicatecrash -type f
find /Applications/Xcode.app -name Symbolatecrash -type f
This should return:
这应该返回:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash
Before running symbolicatecrash
you may wish to go to this directory like:
在运行之前,symbolicatecrash
您可能希望转到此目录,例如:
cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/
cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/
Original Answer :: Xcode < 4.3
原始答案 :: Xcode < 4.3
Path for symbolicatecrash
符号崩溃的路径
Search from a terminal using:
从终端搜索使用:
find /Developer -name symbolicatecrash -type f
find /Developer -namesymbolatecrash -type f
For me this returned:
对我来说,这返回了:
/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash
/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash
How to Manually Symbolicate a Crash Log
如何手动符号化崩溃日志
Run the symbolicatecrash
command with the crash log as the first argument and your dSYM file as your second argument. Note that if you will be running symbolicatecrash
from the current directory that you MUST put ./
in front like ./symbolicatecrash
unless your PATH environment variable includes the directory that the command resides in.
symbolicatecrash
使用崩溃日志作为第一个参数和您的 dSYM 文件作为您的第二个参数运行命令。请注意,如果您将从symbolicatecrash
当前目录运行,除非您的 PATH 环境变量包含命令所在的目录,否则您必须将其./
放在前面./symbolicatecrash
。
I changed to the directory that had the symbolicatecrash
command in it first (note: will be different for Xcode 4.3, see top):
我首先切换到包含symbolicatecrash
命令的目录(注意:Xcode 4.3 会有所不同,请参见顶部):
cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/
cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/
Then I executed the following command:
然后我执行了以下命令:
./symbolicatecrash /somePath/MyCrashLogFile.crash /somePath/MyAppName.app.dSYM
./symbolicatecrash /somePath/MyCrashLogFile.crash /somePath/MyAppName.app.dSYM
How to Find the dSYM file:
如何查找 dSYM 文件:
You must have the archive that was used to create the build with the crash to get the dSYM file.
您必须拥有用于在崩溃时创建构建的存档才能获取 dSYM 文件。
Here are the steps:
以下是步骤:
- Right click (or ctrlclick) the archive from organizer and choose "Show in Finder".
- From the xcarchive file in finder, right click (or ctrlclick) this file and choose "Show Package Contents". You will then see a "dSYMs" folder.
- Inside the "dSYMs" folder you will find "YourAppName.app.dSYM" file that you will need to symbolicate files.
- 右键单击(或ctrl单击)管理器中的存档,然后选择“在 Finder 中显示”。
- 从 finder 中的 xcarchive 文件中,右键单击(或ctrl单击)该文件并选择“显示包内容”。然后您将看到一个“dSYMs”文件夹。
- 在“dSYMs”文件夹中,您会找到“YourAppName.app.dSYM”文件,您需要用它来符号化文件。
回答by MaheshShanbhag
A plugin is available for Xcode under the Product menu. This plugin is available through Alcatraz package manageror can be directly downloaded from github.
产品菜单下有一个可用于 Xcode 的插件。这个插件可以通过Alcatraz 包管理器获得,也可以直接从 github下载。
This plugin internally incorporates a shell script that does the set up of running the following commands for manual crash symbolication.
该插件内部包含一个 shell 脚本,该脚本执行设置运行以下命令以进行手动崩溃符号化。
- Set an alias to symbolicatecrash.pl perl script
- 将别名设置为symbolicatecrash.pl perl 脚本
alias symbolicatecrash='/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash'
别名symbolicatecrash='/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash'
- To find symbolicatecrash, should it differ from the alias above:
- 要查找symbolicatecrash,它是否与上面的别名不同:
find /Applications/Xcode.app -name symbolicatecrash -type f
find /Applications/Xcode.app -name Symbolatecrash -type f
- Set the DEVELOPER_DIR variable:
- 设置DEVELOPER_DIR变量:
export DEVELOPER_DIR='/Applications/Xcode.app/Contents/Developer'
export DEVELOPER_DIR='/Applications/Xcode.app/Contents/Developer'
- With the dSYM the crash can be symbolicates as:
- 使用 dSYM,崩溃可以象征为:
symbolicatecrash /path/to/MyApp_2012-10-01_Device.crash /path/to/MyApp.app.dSYM.
Symbolatecrash /path/to/MyApp_2012-10-01_Device.crash /path/to/MyApp.app.dSYM。
回答by Kumar Summan
One way to symbolicate a crash log is to run the following command on terminal:
符号化崩溃日志的一种方法是在终端上运行以下命令:
xcrun atos -o MyApp.app/MyApp -arch armv7 -l 0xb7000 -f MyApp.crash
xcrun atos -o MyApp.app/MyApp -arch armv7 -l 0xb7000 -f MyApp.crash
Replace the example hexadecimal number(0xb700) in the command above with the base load address. Base load address is the first memory address in the line immediately after
将上面命令中的示例十六进制数 (0xb700) 替换为基本加载地址。基址加载地址是紧随其后的行中的第一个内存地址
"Binary Images:"
“二进制图像:”
To get the .app file:
要获取 .app 文件:
Right click on the xcarchive file and select Show Package Contents The .app file is in the Products/Applications directory.
右键单击 xcarchive 文件并选择 Show Package Contents .app 文件位于 Products/Applications 目录中。
回答by samwize
I just wrote a post on debugging crash log 5 min ago here: http://just2us.com/2010/10/reading-iphone-crashlog/
我刚刚在 5 分钟前在这里写了一篇关于调试崩溃日志的帖子:http: //just2us.com/2010/10/reading-iphone-crashlog/
You might not need symbolicatecrash.sh anymore if drag and drop the logs to Xcode is good enough for your purpose. I am using 3.2.4, and I can't find the script too.
如果将日志拖放到 Xcode 足以满足您的目的,您可能不再需要symbolatecrash.sh。我正在使用 3.2.4,我也找不到脚本。
回答by orkoden
As Apple explains, Xcode will try to symbolicate automatically.It uses symbolicatecrash
and spotlight to do that. However if the app wasn't built locally or it was deleted, then the necessary .app and .dsym files are not available.
正如 Apple 解释的那样,Xcode 将尝试自动进行符号化。它使用symbolicatecrash
和聚光灯来做到这一点。但是,如果应用程序不是在本地构建或被删除,则必要的 .app 和 .dsym 文件将不可用。
So keep around the dsym file and the app of released versions. Build tools will often zip the .dsym file to a .dsym.zip and package the .app as an .ipa. You can unzip both and copy .app and .dsym to the same folder. Then Xcode will be able to find them using spotlight.
因此,请保留 dsym 文件和已发布版本的应用程序。构建工具通常会将 .dsym 文件压缩为 .dsym.zip 并将 .app 打包为 .ipa。您可以将两者解压缩并将 .app 和 .dsym 复制到同一文件夹中。然后Xcode将能够使用spotlight找到它们。
回答by Charlie Seligman
Here is a simple method I use:
这是我使用的一个简单方法:
- Open Xcode 6
- Plug in your dev device
- Within Xcode, go to Window > Devices > Select your device
- Press 'View Device Logs'
- Drag your report into the window to view it
- 打开 Xcode 6
- 插入你的开发设备
- 在 Xcode 中,转到“窗口”>“设备”>“选择您的设备”
- 按“查看设备日志”
- 将您的报告拖入窗口进行查看