Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教使用BSBacktraceLogger的意义 #68

Closed
lefex opened this issue Feb 15, 2019 · 0 comments
Closed

请教使用BSBacktraceLogger的意义 #68

lefex opened this issue Feb 15, 2019 · 0 comments

Comments

@lefex
Copy link

lefex commented Feb 15, 2019

请教一下为什么要引入 BSBacktraceLogger 这个库来获取调用堆栈,不直接使用系统提供的方法,是有什么深意吗?[NSThread callStackSymbols] 这个API我觉得完全可以胜任。

使用 BSBacktraceLogger 打印的堆栈信息:

BSBacktraceLogger: Backtrace of Thread 14851:
libsystem_kernel.dylib 0x1091c820a mach_msg_trap + 10
libsystem_kernel.dylib 0x1091c43b3 thread_get_state + 403
BeeHiveDemo 0x103548a1a bs_mach_copyMem + 58
BeeHiveDemo 0x103548103 _bs_backtraceOfThread + 675
BeeHiveDemo 0x103547e2b +[BSBacktraceLogger bs_backtraceOfNSThread:] + 59
BeeHiveDemo 0x103548729 +[BSBacktraceLogger bs_backtraceOfCurrentThread] + 89
BeeHiveDemo 0x103601f7a -[UIView(DoraemonSubThreadUICheck) uiCheck] + 170
BeeHiveDemo 0x103601e58 -[UIView(DoraemonSubThreadUICheck) doraemon_setNeedsDisplay] + 72
UIKitCore 0x10efce01e -[UILabel setNeedsDisplay] + 53
UIKitCore 0x10f43ee4e -[UIView _createLayerWithFrame:] + 937
UIKitCore 0x10f43f817 UIViewCommonInitWithFrame + 856
UIKitCore 0x10f43f481 -[UIView initWithFrame:] + 98
UIKitCore 0x10efc4b06 -[UILabel initWithFrame:] + 62
UIKitCore 0x10f43ea9f -[UIView init] + 44
UIKitCore 0x10f714b00 -[_UINavigationBarContentView _setupTitleViewAnimated:] + 778
UIKitCore 0x10f71690e -[_UINavigationBarContentView updateContentAnimated:] + 86
UIKitCore 0x10f74d417 -[_UINavigationBarVisualProviderModernIOS _updateContentForTopItem:backItem:animated:] + 1926
UIKitCore 0x10f751105 -[_UINavigationBarVisualProviderModernIOS navigationItemUpdatedTitleContent:animated:] + 214
UIKitCore 0x10f05a9f3 -[UINavigationItem _notifyObserver_navigationItemUpdatedTitleContentAnimated:] + 62
UIKitCore 0x10f05a849 -[UINavigationItem setTitle:] + 247
UIKitCore 0x10f48b56e -[UIViewController setTitle:] + 127
BeeHiveDemo 0x10350db51 __29-[ViewController viewDidLoad]_block_invoke + 49
libdispatch.dylib 0x108e1d5d1 _dispatch_call_block_and_release + 12
libdispatch.dylib 0x108e1e63e _dispatch_client_callout + 8
libdispatch.dylib 0x108e210a0 _dispatch_queue_override_invoke + 1028
libdispatch.dylib 0x108e2f028 _dispatch_root_queue_drain + 351
libdispatch.dylib 0x108e2f9cd _dispatch_worker_thread2 + 130
libsystem_pthread.dylib 0x109208169 _pthread_wqthread + 1387
libsystem_pthread.dylib 0x109207be9 start_wqthread + 13

使用 [NSThread callStackSymbols] 打印的堆栈信息:
callStackSymbols: (
0 BeeHiveDemo 0x0000000103601fbd -[UIView(DoraemonSubThreadUICheck) uiCheck] + 237
1 BeeHiveDemo 0x0000000103601e58 -[UIView(DoraemonSubThreadUICheck) doraemon_setNeedsDisplay] + 72
2 UIKitCore 0x000000010efce01e -[UILabel setNeedsDisplay] + 53
3 UIKitCore 0x000000010f43ee4e -[UIView _createLayerWithFrame:] + 937
4 UIKitCore 0x000000010f43f817 UIViewCommonInitWithFrame + 856
5 UIKitCore 0x000000010f43f481 -[UIView initWithFrame:] + 98
6 UIKitCore 0x000000010efc4b06 -[UILabel initWithFrame:] + 62
7 UIKitCore 0x000000010f43ea9f -[UIView init] + 44
8 UIKitCore 0x000000010f714b00 -[_UINavigationBarContentView _setupTitleViewAnimated:] + 778
9 UIKitCore 0x000000010f71690e -[_UINavigationBarContentView updateContentAnimated:] + 86
10 UIKitCore 0x000000010f74d417 -[_UINavigationBarVisualProviderModernIOS _updateContentForTopItem:backItem:animated:] + 1926
11 UIKitCore 0x000000010f751105 -[_UINavigationBarVisualProviderModernIOS navigationItemUpdatedTitleContent:animated:] + 214
12 UIKitCore 0x000000010f05a9f3 -[UINavigationItem _notifyObserver_navigationItemUpdatedTitleContentAnimated:] + 62
13 UIKitCore 0x000000010f05a849 -[UINavigationItem setTitle:] + 247
14 UIKitCore 0x000000010f48b56e -[UIViewController setTitle:] + 127
15 BeeHiveDemo 0x000000010350db51 __29-[ViewController viewDidLoad]_block_invoke + 49
16 libdispatch.dylib 0x0000000108e1d5d1 _dispatch_call_block_and_release + 12
17 libdispatch.dylib 0x0000000108e1e63e _dispatch_client_callout + 8
18 libdispatch.dylib 0x0000000108e210a0 _dispatch_queue_override_invoke + 1028
19 libdispatch.dylib 0x0000000108e2f028 _dispatch_root_queue_drain + 351
20 libdispatch.dylib 0x0000000108e2f9cd _dispatch_worker_thread2 + 130
21 libsystem_pthread.dylib 0x0000000109208169 _pthread_wqthread + 1387
22 libsystem_pthread.dylib 0x0000000109207be9 start_wqthread + 13
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants