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

请问为什么不用系统提供的dladdr方法,而需要自己写一个fl_dladdr呢? #8

Open
Dave1991 opened this issue Aug 18, 2017 · 4 comments

Comments

@Dave1991
Copy link

系统提供的dladdr方法是线程安全的,而代码中的fl_dladdr其实底层调用的也是系统提供的_dyld_get_image_header和_dyld_get_image_name等方法,而这些方法是线程不安全的,经过我本人的实验对比,fl_dladdr返回的symbolbuffer和dladdr返回的结果是一样的,不清楚作者是出于什么样的考虑自己重写了一个fl_dladdr方法。

@bestswifter
Copy link
Owner

这段代码是从 PLC 里面抄出来的

@Dave1991
Copy link
Author

PLC是?能给个地址吗?

@kobe1941
Copy link

@Dave1991 PLCrashReporter 某著名的iOS APP崩溃时收集堆栈信息的库

@chenzhengxu
Copy link

bool bs_dladdr(const uintptr_t address, Dl_info* const info) {
    dladdr((void *)address, info);
    return true;
}

的确,这个方法直接用dladdr好像也没啥问题

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

4 participants