-
Notifications
You must be signed in to change notification settings - Fork 443
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
Native profiling on macOS #188
Comments
There was a dev release with OSX native profling: It didn't work all that well though, so I removed it =(. It was using a custom unwinder I wrote, built on top of gimli for dwarf unwinding. This frequently failed to unwind stack traces that I could unwind with llvm. Rather than ship known broken code, I pulled it out and just shipped the windows/linux version. The tricky thing here is unwinding the native stack of a thread in another process. To get this going we have a couple of options that I know of - and probably more that I don't:
|
@benfred I would be interested in taking a stab at this. Do you have more details on what went wrong with your custom unwinder? How were you testing the correctness of the unwinder against llvm? |
The incorrect unwinding was likely because macOS largely doesn't use DWARF CFI; it's only used as a last resort if Apple's own "Compact Unwinding Format" is insufficient to describe the unwind rule for a function. I'd like to encourage you to give |
For OSX - I had some code that attempted to read in the the compact unwinding format for OX, but I was seeing fairly high error rates and removed it entirely ages ago. I was verifying a paused process using my unwinder and using lldb (for the llvm unwinder), and wasn't able to get correct stack traces around 25% of the time iirc. Fwiw, the compact unwind code was here https://github.com/benfred/remoteprocess/blob/41e37740e4b7d4ea148bbf6abbe5fe674ef50cb9/src/osx/compact_unwind.rs @mstange - framehop looks great! I definitely am interested in giving it a go, potentially even using for linux as well instead of libunwind-ptrace . Does this include support for symbolication on OSX, or just unwinding? In terms of getting framehop integrated, from scanning the example https://github.com/mstange/framehop/#example, it looks to me like we need to:
@huguesb is this something you're interested in taking on? I'd love a PR if so, |
Oh, very neat!
Thank you! It only does unwinding, no symbolication.
That all sounds right!
Yup, I think that file even started with the proc-maps crate code originally. |
@benfred I am sufficiently interested in getting this feature that I will eventually take a stab at implementing it myself. It might take me a little while to get started though, since this would be my first time actually writing Rust... |
I'm a complete n00b when it comes to this sort of thing, but I saw enough overlapping keywords and thought maybe this might be useful for this??? IDK, just sharing in the chance it is useful: Python 3.12 is improving debugging for MacOS:
Even if it isn't directly helpful for stack unwinding, perhaps it is an interesting development for you folks. |
Any progress on this ? It would be amazing to be able to profile code on Apple Silicon ! |
It seems that there was at one time support for native profiling on macOS and nowadays it is disabled due to missing features. What is needed to get native profiling for macOS back again?
The text was updated successfully, but these errors were encountered: