赞
踩
将 .ips crash report 文件拖放到 Xcode > Window > Devices and Simulators > View Device Logs
中, 然后导出 .crash 符号化文件.
使用条件: crash report 对应的 Archive 包是在本机构建的
symbolicatecrash 是一个 exec (可执行文件), Xcode自带, iOS 15 之前的系统产生的 crash report, 可以直接被整个符号化, 文件路径可以通过 find
来查找1 , 结果是:
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash
使用方式参考如下示例:
// 若执行路径与文件路径不同, 需要补充完整的URI绝对路径
$ symbolicatecrash xxx.ips xxx.dSYM > symbolicated.crash
DEVELOPER_DIR
是执行所依赖的环境变量, 解决办法如下:
```shell
$ export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
```
iOS 15 及之后的版本产生的 crash report, 格式有变, 已经无法使用 symbolicatecrash 符号化
> **Xcode 13 Release Notes > Instruments > New Features**
> To support the new JSON-format crash logs generated in macOS Monterey and iOS 15, Instruments includes a new CrashSymbolicator.py script. This Python 3 script replaces the symbolicatecrash utility for JSON-format logs and supports inlined frames with its default options. For more information, see: CrashSymbolicator.py --help. CrashSymbolicator.py is located in the Contents/SharedFrameworks/CoreSymbolicationDT.framework/Resources/ subdirectory within Xcode 13. (78891800)
// 查看dSYM文件的UUID
$ dwarfdump --uuid <dSYM path>
The atos command converts numeric (数字的) addresses to their symbolic (符号的) equivalents (复数, 等同物, 对应物). If full debug symbol information is available, for example in a .app.dSYM
sitting beside a .app, then the output of atos will include file name and source line number information.
-o <binary-image-file> | <dSYM>
The path to a binary image file or dSYM in which to look up symbols.
-l <load-address>
The load address of the binary image. This value is always assumed to be in hex, even without a “0x” prefix. The input addresses are assumed to be in a binary image
with that load address. Load addresses for binary images can be found in the Binary Images: section at the bottom of crash, sample, leaks, and malloc_history reports.
-arch architecture
The particular architecure of a binary image file in which to look up symbols.
// atos -arch 指令集 -0 dsym -l 调用地址 符号模块地址
// load adress:可执行指令部分相对镜像文件中的起始加载地址 address to symbolicate:调用函数的地址
atos -arch <Binary Architecture> -o <Path to dSYM file>/Contents/Resources/DWARF/<binary image name> -l <load address> <address to symbolicate>
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libswiftCore.dylib 0x00000001cb264b00 specialized _fatalErrorMessage+ 2112256 (_:_:file:line:flags:) + 296
1 libswiftCore.dylib 0x00000001cb264b00 specialized _fatalErrorMessage+ 2112256 (_:_:file:line:flags:) + 296
2 libswiftCore.dylib 0x00000001cb070524 _ArrayBuffer._checkInoutAndNativeTypeCheckedBounds+ 62756 (_:wasNativeTypeChecked:) + 232
3 libswiftCore.dylib 0x00000001cb073510 Array.subscript.getter + 84
4 appName 0x00000001005feba0 0x1004f0000 + 1108896
5 appName 0x00000001005fcc88 0x1004f0000 + 1100936
6 appName 0x00000001005fce84 0x1004f0000 + 1101444
7 UIKitCore 0x00000001c9f180f0 -[UIApplication
// 执行如下命令
$ xcrun atos -o appName.dSYM/Contents/Resources/DWARF/appName -l 0x1004f0000 -arch arm64
// 然后在换行处输入
0x00000001005feba0
// 终端输出
AppDelegate.updateRootViewController() (in ) (AppDelegate.swift:104)
// 解析整个
atos -o xxx.app.dSYM/Contents/Resources/DWARF/xxx -l 0x00000001c4fe7000 -arch arm64
// 解析单行
atos -arch arm64 -o xxx.app.dSYM/Contents/Resources/DWARF/xxx -l 0x00000001c4fe7000 0x00000001a2d6e29c
/Applications/Xcode.app/Contents/SharedFrameworks/CoreSymbolicationDT.framework/Versions/A/Resources/CrashSymbolicator.py
// -d: dSYM符号表文件, -o: 输出符号化的文件, -p: iOS系统生成的crashReport
$ python3 CrashSymbolicator.py -d <dSYM> -o <symbolicated.crash> -p <xxx.ips>
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。