分析iOS Crash文件:符号化iOS Crash文件的3种方法
iOS手动解析Crash_Log崩溃日志符号表
ios 崩溃日志分析 苹果崩溃日志解读
1.将/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecras复制到crash文件夹中,
然后将符号表demo.app.dSYM和崩溃日志.crash(Xcode导出)文件或者.ips(手机分析数据中)文件放入crash文件中
2.设置symbolicatecrash的环境变量,终端下发指令:
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
3.符号表,终端下发指令:
./symbolicatecrash demo.ips demo.app.dSYM > dsym.app.ips
./symbolicatecrash demo.crash demo.app.dSYM > dsym.app.crash
//查看UUID和崩溃日志中里面的是否一致
dwarfdump -uuid demo.app.dSYM
4.解析成原方法:
atos -arch 架构 -o 符号表 -l 模块地址 方法地址
或者:
atos -o 符号表 -l 模块地址 方法地址
模块地址 = 方法地址-偏移地址(需要10进制转16进制)
案例:
Heaviest stack for the target process:
87 ??? (libsystem_pthread.dylib + 2952) [0x21b5d5b88]
87 ??? (libsystem_pthread.dylib + 5816) [0x21b5d66b8]
76 ??? (Foundation + 374052) [0x1b5ab4524]
76 ??? (demo + 41192428) [0x1067b8bec]
76 ??? (CoreFoundation + 521196) [0x1bb81a3ec]
37 ??? (CoreFoundation + 500304) [0x1bb815250]
37 ??? (CoreFoundation + 495652) [0x1bb814024]
37 ??? (libsystem_kernel.dylib + 4584) [0x1fa75b1e8]
37 ??? (libsystem_kernel.dylib + 81484) [0x1fa76de4c]
37 ??? (libsystem_kernel.dylib + 3236) [0x1fa75aca4]
解析过程:
87 ??? (libsystem_pthread.dylib + 2952) [0x21b5d5b88]
10进制偏移地址2952转十六进制0xB88
模块地址:0x21b5d5b88- 0xB88= 0x21B5D5000
解析:atos -arch arm64e -o demo.app.dSYM/Contents/Resources/DWARF/demo -l 0x21B5D5000 0x21b5d5b88
或者:
解析:atos -o demo.app.dSYM/Contents/Resources/DWARF/demo -l 0x21B5D5000 0x21b5d5b88
结果:解析失败
87 ??? (libsystem_pthread.dylib + 5816) [0x21b5d66b8]
10进制偏移地址5816转十六进制0x16B8
模块地址:0x21b5d66b8- 0x16B8= 0x21B5D5000
解析:atos -o demo.app.dSYM/Contents/Resources/DWARF/demo -l 0x21B5D5000 0x21b5d66b8
结果:解析失败
76 ??? (Foundation + 374052) [0x1b5ab4524]
模块地址:0x1b5ab4524 - 0x5B524 = 0x1B5A59000
解析:atos -o demo.app.dSYM/Contents/Resources/DWARF/demo -l 0x1B5A59000 0x1b5ab4524
结果:-[HPGrowingTextView initWithCoder:] (in demo) (HPGrowingTextView.m:156)
76 ??? (bizElife + 41192428) [0x1067b8bec]
模块地址:0x1067b8bec- 0x2748BEC= 0x104070000
解析:atos -o demo.app.dSYM/Contents/Resources/DWARF/demo -l 0x104070000 0x1067b8bec
结果:-[RCTBaseTextInputView setCustomInputAccessoryViewWithNativeID:] (in demo) (RCTBaseTextInputView.m:553)
76 ??? (CoreFoundation + 521196) [0x1bb81a3ec]
模块地址:0x1bb81a3ec - 0x7F3EC = 0x1BB79B000
解析:atos -o demo.app.dSYM/Contents/Resources/DWARF/demo -l 0x1BB79B000 0x1bb81a3ec
结果:-[SBJSON maxDepth] (in demo) (SBJSON.m:1826)
37 ??? (CoreFoundation + 500304) [0x1bb815250]
模块地址:0x1bb815250 - 0x7A250 = 0x1BB79B000
解析:atos -o demo.app.dSYM/Contents/Resources/DWARF/demo -l 0x1BB79B000 0x1bb815250
结果:-[SBJSON dealloc] (in demo) (SBJSON.m:504)
37 ??? (CoreFoundation + 495652) [0x1bb814024]
模块地址:0x1bb814024 - 0x79024 = 0x1BB79B000
解析:atos -o demo.app.dSYM/Contents/Resources/DWARF/demo -l 0x1BB79B000 0x1bb814024
结果:-[SBJSON init] (in demo) (SBJSON.m:165)
37 ??? (libsystem_kernel.dylib + 4584) [0x1fa75b1e8]
模块地址:0x1fa75b1e8 - 0x11E8 = 0x1FA75A000
解析:atos -o demo.app.dSYM/Contents/Resources/DWARF/demo -l 0x1FA75A000 0x1fa75b1e8
结果:解析失败
37 ??? (libsystem_kernel.dylib + 81484) [0x1fa76de4c]
模块地址:0x1fa76de4c - 0x13E4C = 0x1FA75A000
解析:atos -o demo.app.dSYM/Contents/Resources/DWARF/demo -l 0x1FA75A000 0x1fa76de4c
结果:__74+[NSAttributedString(OHCommodityConstructors) attributedStringWithString:]_block_invoke (in demo) (NSAttributedString+Attributes.m:125)
37 ??? (libsystem_kernel.dylib + 3236) [0x1fa75aca4]
模块地址:0x1fa75aca4 - 0xCA4 = 0x1FA75A000
解析:atos -o demo.app.dSYM/Contents/Resources/DWARF/demo -l 0x1FA75A000 0x1fa75aca4
结果:解析失败