iOS-利用XX.app.dYSM文件符号化崩溃日志

Log 日志如下

Incident Identifier: 0A729A42-1B76-45D9-B46F-1E194B59492B
CrashReporter Key:   7581bb8f2057657b8b592683fdc07932d0d287d8
Hardware Model:      iPhone7,2
Process:             LC [4900]
Path:                /private/var/containers/Bundle/Application/4B3FB0BF-4B29-4477-B45F-441DAC54755D/LC.app/LC
Identifier:          com.xxx.xxx(your boundle id)
Version:             1 (2.0.2)
Code Type:           ARM-64 (Native)
Role:                Non UI
Parent Process:      launchd [1]
Coalition:           com.xxx.xxx(your boundle id) [7472]


Date/Time:           2019-06-05 11:34:45.9511 +0800
Launch Time:         2019-06-05 11:18:28.5471 +0800
OS Version:          iPhone OS 12.2 (16E227)
Baseband Version:    7.55.01
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Application Specific Information:
abort() called

Last Exception Backtrace:
0   CoreFoundation                  0x1d738c518 __exceptionPreprocess + 228
1   libobjc.A.dylib                 0x1d65679f8 objc_exception_throw + 55
2   CoreFoundation                  0x1d72a6148 +[NSException raise:format:arguments:] + 103
3   Foundation                      0x1d7d691c8 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 111
4   LC                              0x1013c3d10 0x101088000 + 3390736
5   LC                              0x1013bf3e8 0x101088000 + 3372008
6   LC                              0x1013c8f20 0x101088000 + 3411744
7   LC                              0x1010ea6b8 0x101088000 + 403128
8   LC                              0x10122f61c 0x101088000 + 1734172
9   LC                              0x101117e50 0x101088000 + 589392
10  LC                              0x1012106fc 0x101088000 + 1607420
11  LC                              0x10114fc8c 0x101088000 + 818316
12  LC                              0x101120fe4 0x101088000 + 626660
13  LC                              0x1011208fc 0x101088000 + 624892
14  LC                              0x101332308 0x101088000 + 2794248
15  LC                              0x101352ce0 0x101088000 + 2927840
16  libdispatch.dylib               0x101fcb6f0 0x101fc8000 + 14064
17  libdispatch.dylib               0x101fccc74 0x101fc8000 + 19572
18  libdispatch.dylib               0x101fda49c 0x101fc8000 + 74908
19  CoreFoundation                  0x1d731dec0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 11
20  CoreFoundation                  0x1d7318df8 __CFRunLoopRun + 1923
21  CoreFoundation                  0x1d7318354 CFRunLoopRunSpecific + 435
22  GraphicsServices                0x1d951879c GSEventRunModal + 103
23  UIKitCore                       0x20378bb68 UIApplicationMain + 211
24  LC                              0x1010e5998 0x101088000 + 383384
25  libdyld.dylib                   0x1d6dde8e0 start + 3

开始符号化

解析上面第8行如下:

8   LC                              0x10122f61c 0x101088000 + 1734172
# 运行时地址 = 运行时起始地址+偏移地址

验证 (运行时地址 = 运行时起始地址+偏移地址)

# python 中hex()函数转换10进制为16进制,int('0x10',16)函数转16进制为10进制
# 如:hex(16)  ==>  0x10 int('0x10', 16)  ==>  16
$ python
Python 2.7.10 (default, Feb 22 2019, 21:55:15) 
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> hex(0x101088000 + 1734172)
'0x10122f61c'
>>> 

输入格式如下

# atos -arch arm64 -o LC.app.dSYM/Contents/Resources/DWARF/LC -l 堆栈起始地址  运行时地址 运行时地址 运行时地址
# 多个运行时地址以空格隔开
# 只输入堆栈起始地址会进入交互模式,然后输入一个运行时地址就会符号化一行
# -arch arm64 指定某个架构 
$ atos -arch arm64 -o LC.app.dSYM/Contents/Resources/DWARF/LC -l 0x101088000  0x10122f61c 

输出结果,可以看出在HqUserSetPsVC.m的第171行出现了问题

-[HqUserSetPsVC getSetPsCheckCode:] (in LC) (HqUserSetPsVC.m:171)

脚本代码

#!/bin/bash 
#  0x104c84000  0x0000000104cae4b4
echo  "Enter App Info -> app_name start_address runtime_address" 
read  app_name start_address runtime_address
# xcrun dwarfdump --uuid ${app_name}.app.dSYM
atos -arch arm64 -o ${app_name}.app.dSYM/Contents/Resources/DWARF/${app_name} -l \
 ${start_address}  ${runtime_address}
 

你可能感兴趣的:(iOS-利用XX.app.dYSM文件符号化崩溃日志)