Rollup merge of #44384 - alexcrichton:osx-segfault, r=estebank
std: Fix a segfault on OSX with backtraces Apparently `dladdr` can succeed but still give you NULL pointers! Closes #44379
This commit is contained in:
commit
0e2dac7eba
@ -22,7 +22,8 @@ pub fn resolve_symname<F>(frame: Frame,
|
||||
{
|
||||
unsafe {
|
||||
let mut info: Dl_info = intrinsics::init();
|
||||
let symname = if dladdr(frame.exact_position, &mut info) == 0 {
|
||||
let symname = if dladdr(frame.exact_position, &mut info) == 0 ||
|
||||
info.dli_sname.is_null() {
|
||||
None
|
||||
} else {
|
||||
CStr::from_ptr(info.dli_sname).to_str().ok()
|
||||
|
Loading…
Reference in New Issue
Block a user