Answers:
dSYM文件存储您的应用程序的调试符号
诸如crashlytics之类的服务使用它来使用适当的方法名称替换崩溃日志中的符号,从而使它可读且有意义。
使用dSYM的好处是,您不需要将其附带的符号带到您的App中,这使得对它进行反向工程和缩小二进制文件的大小变得更加困难。
为了用来表示崩溃日志,您需要将崩溃日志拖动到编译应用程序二进制文件的计算机(存储dSYM的计算机)的组织器中的设备的设备日志中
如果您有dSYM,但没有计算机,则按照以下链接中的说明编译应用程序二进制文件,以便将dSYM安装到计算机中
有关更多信息,请参阅苹果技术说明TN2151。
dSYM
Xcode Debugging Symbols的缩写,它是一种映射文件,例如,可以将堆栈跟踪解码为可读格式。这是Bundle
带有下一个结构的:
例如,崩溃日志如下所示:
//before
0 libswiftCore.dylib 0x000000018f3c9380 0x18f394000 + 217984
1 libswiftCore.dylib 0x000000018f3c9380 0x18f394000 + 217984
2 libswiftCore.dylib 0x000000018f3c8844 0x18f394000 + 215108
3 libswiftCore.dylib 0x000000018f3a74e0 0x18f394000 + 79072
4 libswiftCore.dylib 0x000000018f3ab0d8 0x18f394000 + 94424
5 F49088168M 0x00000001045ac750 0x104590000 + 116560
6 F49088168M 0x00000001045b7904 0x104590000 + 162052
7 F49088168M 0x00000001045b897c 0x104590000 + 166268
8 F49088168M 0x000000010459d914 0x104590000 + 55572
9 F49088168M 0x00000001045a0e70 0x104590000 + 69232
10 F49088168M 0x00000001045a0f4c 0x104590000 + 69452
dSYM
在行动
//after Symbolicating(dSYM is used)
0 libswiftCore.dylib 0x000000018f3c9380 closure #1 in closure #1 in closure #1 in _assertionFailure+ 217984 (_:_:file:line:flags:) + 452
1 libswiftCore.dylib 0x000000018f3c9380 closure #1 in closure #1 in closure #1 in _assertionFailure+ 217984 (_:_:file:line:flags:) + 452
2 libswiftCore.dylib 0x000000018f3c8844 _assertionFailure+ 215108 (_:_:file:line:flags:) + 468
3 libswiftCore.dylib 0x000000018f3a74e0 _ArrayBuffer._checkInoutAndNativeTypeCheckedBounds+ 79072 (_:wasNativeTypeChecked:) + 208
4 libswiftCore.dylib 0x000000018f3ab0d8 Array.subscript.getter + 84
5 F49088168M 0x00000001045ac750 static ELM327ResponseManager.getResponse(responseStr:obd2Protocol:) + 116560 (ELM327ResponseManager.swift:27)
6 F49088168M 0x00000001045b7904 ELM327Client.dataInput(_:characteristicUuidStr:) + 162052 (ELM327Client.swift:56)
7 F49088168M 0x00000001045b897c protocol witness for BLEClientInputPort.dataInput(_:characteristicUuidStr:) in conformance ELM327Client + 166268 (<compiler-generated>:0)
8 F49088168M 0x000000010459d914 BLEConnection.peripheralDataReceived(data:characteristicUuidStr:) + 55572 (BLEConnection.swift:124)
9 F49088168M 0x00000001045a0e70 BLEConnection.peripheral(_:didUpdateValueFor:error:) + 69232 (BLEConnection.swift:293)
10 F49088168M 0x00000001045a0f4c @objc BLEConnection.peripheral(_:didUpdateValueFor:error:) + 69452 (<compiler-generated>:0)
默认情况下dSYM
,默认情况下为发行版本生成。您可以检查一下:
Build Settings -> Generate Debug Symbols -> Yes
Build Settings -> Debug Information Format -> DWARF with dSYM File
您可以在Products
文件夹中找到的结果位置
dSYM
通过.app
使用手动生成文件dsymutil
dsymutil F49088168M.app/F49088168M -o F49088168M.app.dSYM
使用来象征崩溃 symbolicatecrash
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/Current/Resources/symbolicatecrash "<path>/F49088168M-2020-06-04-212904.crash" "<path>/F49088168M.app.dSYM" > symbolicated.crash
要dSYM
使用手动打开dwarfdump
dwarfdump --arch arm64 --debug-pubtypes F49088168M.app.dSYM
结果看起来像:
0x00000065 "PeripheralLogView"
0x000005cc "BLEConnection"
0x000005da "BLEPeripheral"
0x000005e9 "ELM327Client"