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

循环一个子线程,第一次打印的堆栈有时候只有一条 #6

Open
ganvinalix opened this issue Oct 28, 2016 · 1 comment

Comments

@ganvinalix
Copy link

dispatch_async(dispatch_get_global_queue(0, 0), ^{ // something for (NSInteger i = 0; i < 5000 ; i ++) { NSLog(@"index----- %@",@(i)); NSString * ddd = [KGPrintThreadSnapshoot bs_backtraceOfCurrentThread]; NSLog(@"bs_backtraceOfCurrentThread----- %@",ddd); } });

打印结果:
index==1
bs_backtraceOfCurrentThread----- Backtrace of Thread 3587:
libsystem_kernel.dylib 0x111127f72 mach_msg_trap + 10
index==2的时候 就准确了

@ganvinalix
Copy link
Author

@bestswifter 在第一次打印时候 bs_mach_copyMem(frame.previous, &frame, sizeof(frame)) 为 1 循环break出去了。问下 vm_read_overwrite 是macOS (10.0 and later)的函数 在iOS上好使?

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

1 participant