1. Crash日志收集平台简介
2. 手动还原符号表
2.1 准备资料
我们开发经常通过一些crash日志平台收集到一些crash日志,有时候这些日志并没有通过符号表来还原成我们想看到的具体是哪一行代码出错了,这个时候我们需要手动去还原符号表。

下面我以bugsplat平台为例,来讲解手动还原的过程:

首先我通过bugsplat平台日志分析到有一个crash问题,https://app.bugsplat.com/v2/crash?database=Wondershare_VideoEditor_Mac&id=807244 但是这个crash我能够看到的只有那些符号表,没有还原成对应的代码。我可以在网站上看到这么一行:

Explanation:
SIGABRT #0 at 0x7fff9b375f06 Application Specific Information: *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[NSTextView setAutomaticTextCompletionEnabled:]: unrecognized selector sent to instance 0x7fe8b929d420’

2.2 还原步骤
创建一个新的文件夹,mac下终端输入命令:
mkdir testcrash

导出symbolicatecrash 可执行文件:
执行下面这句命令后,可以打印出多个对应的文件路径:

find /Applications/Xcode.app -name symbolicatecrash -type f

输入命令的后的结果如下:

Crash find /Applications/Xcode.app -name symbolicatecrash -type f
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/iOSSupport/Library/PrivateFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash
/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/Library/PrivateFrameworks/DVTFoundation.framework/symbolicatecrash
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/Library/PrivateFrameworks/DVTFoundation.framework/symbolicatecrash
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/DVTFoundation.framework/symbolicatecrash
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash

选择一个对应的平台即可,我这里是macos 选择*个即可。

然后,再执行下面的命令,把symbolicatecrash文件拷贝到当前目录

cp /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash ./

把对应的.dSYM, .app, .crash, symbolicatecrash 文件放置在*步创建的文件夹同一目录中。

设置环境变量
终端输入:

export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer

还原符号表,导出崩溃日志
./symbolicatecrash plCrashReporter.crashlog test.dSYM > app.log