崩溃堆栈的几个来源
真机上APP崩溃时,操作系统收集到的
1 | 0 libsystem_kernel.dylib 0x00000001a24b70f4 0x1a249f000 + 98548 |
上面是IOS操作系统记录的原始崩溃堆栈信息,此时还未经由符号表符号化。看到的都是十六进制的内存地址,如果想要找到崩溃的地方对应于哪个文件、哪个函数、哪一行,就需要符号化才行
分析堆栈格式:
- 第一列:栈帧
- 第二列:二进制的应用程序名或者库名
- 第三列:被调用的函数的地址
- 第四列:是以基址+偏移量的形式表示的,前半部分指向某个源文件,后半部分指向这个源文件的某一行。
bugly上收集的
下面是bugly收集的原始堆栈信息,同样未经未符号化。
1 | 0 SimpleGame iOS 0x00000001050ae238 __cxa_throw + 8825280 |
下面是上面的原始堆栈信息经过符号化后的样子。
1 | 0 SimpleGame iOS cocos2d::GLView::getScaleX() const |
一些列外情况
下面这样的:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
290 SimpleGame iOS 0x0000000103469820 __cxa_throw + 6463400
1 SimpleGame iOS 0x00000001034697b8 __cxa_throw + 6463296
2 SimpleGame iOS 0x00000001033e6898 __cxa_throw + 5926944
3 SimpleGame iOS 0x0000000103427c1c __cxa_throw + 6194084
4 SimpleGame iOS 0x00000001033e6c6c __cxa_throw + 5927924
5 SimpleGame iOS 0x00000001033e62bc __cxa_throw + 5925444
6 SimpleGame iOS 0x00000001033e6f40 __cxa_throw + 5928648
7 SimpleGame iOS 0x000000010344eb38 __cxa_throw + 6353600
8 SimpleGame iOS 0x00000001033b97c8 __cxa_throw + 5742416
9 SimpleGame iOS 0x00000001033b98c0 __cxa_throw + 5742664
10 SimpleGame iOS 0x0000000103382ef8 __cxa_throw + 5518976
11 SimpleGame iOS 0x00000001034fb724 __cxa_throw + 7061164
12 SimpleGame iOS 0x00000001034fa994 __cxa_throw + 7057692
13 SimpleGame iOS 0x00000001034fdbd0 __cxa_throw + 7070552
14 SimpleGame iOS 0x00000001034fd924 __cxa_throw + 7069868
15 SimpleGame iOS 0x000000010355e300 __cxa_throw + 7465608
16 SimpleGame iOS 0x0000000103581a0c __cxa_throw + 7610772
17 SimpleGame iOS 0x0000000103583478 __cxa_throw + 7617536
18 QuartzCore 0x00000001fcf18f90 0x00000001fcf08000 + 69520
19 QuartzCore 0x00000001fcfe2b10 0x00000001fcf08000 + 895760
20 CoreFoundation 0x00000001f8afca8c 0x00000001f8a79000 + 539276
21 CoreFoundation 0x00000001f8b23690 0x00000001f8a79000 + 698000
22 CoreFoundation 0x00000001f8b22ddc 0x00000001f8a79000 + 695772
23 CoreFoundation 0x00000001f8b1dc00 0x00000001f8a79000 + 674816
24 CoreFoundation 0x00000001f8b1d0b0 CFRunLoopRunSpecific + 436
25 GraphicsServices 0x00000001fad1d79c GSEventRunModal + 104
26 UIKitCore 0x0000000225389978 UIApplicationMain + 212
27 SimpleGame iOS 0x0000000102ef560c __cxa_throw + 744852
28 libdyld.dylib 0x00000001f85e28e0 0x00000001f85e1000 + 6368
符号化后,变成这样了:只有部分栈帧被符号化成有用的信息,但还有一部分和符号化之前的形式差不多!1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
290 SimpleGame iOS __cxa_throw + 6463400
1 SimpleGame iOS __cxa_throw + 6463296
2 SimpleGame iOS __cxa_throw + 5926944
3 SimpleGame iOS __cxa_throw + 6194084
4 SimpleGame iOS __cxa_throw + 5927924
5 SimpleGame iOS __cxa_throw + 5925444
6 SimpleGame iOS __cxa_throw + 5928648
7 SimpleGame iOS __cxa_throw + 6353600
8 SimpleGame iOS __cxa_throw + 5742416
9 SimpleGame iOS __cxa_throw + 5742664
10 SimpleGame iOS __cxa_throw + 5518976
11 SimpleGame iOS __cxa_throw + 7061164
12 SimpleGame iOS __cxa_throw + 7057692
13 SimpleGame iOS __cxa_throw + 7070552
14 SimpleGame iOS __cxa_throw + 7069868
15 SimpleGame iOS __cxa_throw + 7465608
16 SimpleGame iOS __cxa_throw + 7610772
17 SimpleGame iOS __cxa_throw + 7617536
18 QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 636
19 QuartzCore display_timer_callback(__CFMachPort*, void*, long, void*) + 272
20 CoreFoundation ___CFMachPortPerform + 188
21 CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
22 CoreFoundation ___CFRunLoopDoSource1 + 440
23 CoreFoundation ___CFRunLoopRun + 2096
24 CoreFoundation CFRunLoopRunSpecific + 436
25 GraphicsServices GSEventRunModal + 104
26 UIKitCore UIApplicationMain + 212
27 SimpleGame iOS __cxa_throw + 744852
28 libdyld.dylib _start + 4
疑惑
- 符号化后的堆栈信息依然带有
+ number
的形式,不清楚是什么意思。(行数应该以main (main.m:6)
的形式标识的) - 某些堆栈经过符号化后,和未符号化的差不多,依然看不到有用的信息
- 内存不足或者用户强制杀死app,bugly也会搜集信息吗?
- 暂时先这样吧,后面有空有机会再填这些坑。。。
因为要查找线上IOS APP的一个崩溃问题,我查阅了很多相关的网页。发现一个现象:好多好多的中文内容其实都是雷同,甚至复制粘贴的。后来我又发现:尼玛,这些中文内容竟然还是翻译的同一篇英文文章!
参考
- 最初的英文文章:https://www.raywenderlich.com/2805-demystifying-ios-application-crash-logs
- 下面是雷同或者相似的中文文章:
- https://www.jianshu.com/p/3261493e6d9e
- https://www.jianshu.com/p/12a2402b29c2
- https://blog.csdn.net/hello_hwc/article/details/80946318
- https://www.jianshu.com/p/104c362189d8
- https://www.jianshu.com/p/5efbb02ca6c3
- https://blog.csdn.net/jasonblog/article/details/19031517
- https://cloud.tencent.com/developer/article/1070400