-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Unable to instrument rust debug software #107033
Comments
I tried this today, and this issue is still relevant (though it is not specific to Rust, a basic C file compiled with Clang outside of Xcode exhibits the same problem). Something that really confused me is that Instruments (at least in Xcode 15.3 using the Leaks tool) seems to cache certain information related to code signing, so you might have to restart Instruments if you tried to debug the application before adding the entitlement. Also noting that another workaround is to disable SIP (which is bad advice in general, but still, it's a possibility). I think it should be sufficient to only disable the debugging restrictions, something like |
Maybe this should be a I considered fixing this late last year but got sidetracked. I wanted Cargo to generate the same debugging entitlements XCode does (like shown above) when they aren't explicitly provided for Mach-O binaries and link them in when not compiling in release mode (a per-profile setting). |
I think it's a good idea to consider how this may be integrated into Cargo! I'll note too that the open-source reimplementation of |
When trying to instrument rust software built in debug mode under macOS, the instrument tool will throw
Required kernel recording resources are in use by another document
. Essentially you can't do any advanced instrumentation with debug executables built by rustc because rustc is not adding the proper entitlements to the built binary. It actually needs to add the get-task-allow entitlement when building in debug.Meta
rustc --version --verbose
:Workaround
Currently it is possible to workaround the issue but it's a pain. it's not possible to integrate this in Cargo as it requires accessing zsh.
Paste the following code in a zsh terminal opened at the target directory:
Unfortunately you must run the same pain every time you build the software.
The text was updated successfully, but these errors were encountered: