-
Notifications
You must be signed in to change notification settings - Fork 60
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
Use mach_vm_read_overwrite
to read image infos for dyld_images
#403
Conversation
samply/src/mac/proc_maps.rs
Outdated
mach_vm_read_overwrite(task, info_array_elem_addr, size, &mut image_info as *mut MaybeUninit<dyld_image_info> as u64, &mut size).into_result()?; | ||
} | ||
|
||
if size != mem::size_of::<dyld_image_info>() as u64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also check that the result of mach_vm_read_overwrite
was KERN_SUCCESS
, I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
into_result does it
Thank you @Maaarcocr for the patch, @ianks for the review and @casperisfine for testing! |
As I've explained in #389 (comment) it seems like the mapped memory that samply relies on to read image infos for dyld_images is no longer kept up to date with the newest version of macOS.
This results in samply not being able to reconcile from where an address is coming from (as it was shown in the issue I already linked) and thus then we get no symbolication whatsover.
I have a simple solution for this (which I understand may not be desirable from a perf POV): for image infos just read them directly from the other process memory using
mach_vm_read_overwrite
. This may be slower, but it at least get samply working again when people use dlopen in the application code. Also, even if it is slower, hopefully people are not constantly dlopen-ing new libraries so this code should only be called few times at startup and that should be it hopefully?