1. crashReport.txt
0 EAMInventory 0x00000001011760ac EAMInventory + 5447852
1 EAMInventory 0x0000000101176c90 EAMInventory + 5450896
2 libsystem_platform.dylib 0x00000001bceb7884 09A51269-D3C5-3ECE-87B7-F32C096AF8E7 + 34948
3 EAMInventory 0x0000000101084fa8 EAMInventory + 4460456
4 UIKitCore 0x00000001c0daedf4 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 6196724
5 UIKitCore 0x00000001c0db73f4 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 6231028
6 UIKitCore 0x00000001c0db4bec 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 6220780
7 UIKitCore 0x00000001c0db414c 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 6218060
8 UIKitCore 0x00000001c0da815c 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 6168924
9 UIKitCore 0x00000001c0da78d4 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 6166740
10 UIKitCore 0x00000001c0da7698 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 6166168
11 UIKitCore 0x00000001c11f208c 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 10666124
12 UIKitCore 0x00000001c11ceae8 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 10521320
13 UIKitCore 0x00000001c124623c 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 11010620
14 UIKitCore 0x00000001c1248798 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 11020184
15 UIKitCore 0x00000001c1248ae4 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 11021028
16 UIKitCore 0x00000001c124160c 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 10991116
17 CoreFoundation 0x00000001bd1267e0 DA838E75-6B30-360E-9661-C4800A7E1BF6 + 694240
18 CoreFoundation 0x00000001bd126738 DA838E75-6B30-360E-9661-C4800A7E1BF6 + 694072
19 CoreFoundation 0x00000001bd125ed0 DA838E75-6B30-360E-9661-C4800A7E1BF6 + 691920
20 CoreFoundation 0x00000001bd12101c DA838E75-6B30-360E-9661-C4800A7E1BF6 + 671772
21 CoreFoundation 0x00000001bd1208bc CFRunLoopRunSpecific + 464
22 GraphicsServices 0x00000001c6f8c328 GSEventRunModal + 104
23 UIKitCore 0x00000001c11b66d4 UIApplicationMain + 1936
24 EAMInventory 0x0000000100d26aa0 EAMInventory + 928416
25 libdyld.dylib 0x00000001bcfab460 E1637502-BFCB-3BBC-B3E1-CCF78617E0E4 + 5216
2. 读取crashReport文件
#read crashReport.txt one line by one line
#cd ../crash
cat ./crashReport.txt|while read line
do
#get stackAddress left string
EAMStr="EAMInventory"
#EAMInventoryLine: 每行的字符串(且字符串中包含EAMInventory)
EAMInventoryLine=$(echo $line | grep "${EAMStr}")
#判断EAMInventory是否有值
if [ -n "$EAMInventoryLine" ]; then
#left:取出EAMInventoryLine中字符串%0x0000000前面的字符串
left=${line%0x0000000*}
#leftAheadLength:left字符串的长度
leftAheadLength=${#left}
#stackAddress:基于line字符串从leftAheadLength字符串开始向右得到一个18个字符的字符串
stackAddress=${line: $leftAheadLength: 18}
#offsetDecimal:基于line字符串匹配到"+ "字符串开始向右得到一个字符串
offsetDecimal=${line#*+ }
#decimalAddress:得到stackAddress的十进制数
decimalAddress=$((stackAddress))
#decimalFristAddr:两个十进制数相减得到新的十进制数
decimalFristAddr=$(($decimalAddress-$offsetDecimal))
#hexadecimalFirstAddr:十进制数转化成16进制数
hexadecimalFirstAddr=$(echo "$decimalFristAddr 16 o p" | dc)
atos -arch arm64 -o ./EAMInventory.app.dSYM/Contents/Resources/DWARF/EAMInventory -l $hexadecimalFirstAddr $stackAddress
else
echo "$line"
fi
done
3. cd到该文件夹下面,打开终端
./analyseCrash.sh