-
Notifications
You must be signed in to change notification settings - Fork 385
Make backtraces work with #[global_allocator] #1975
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
Conversation
So, afaict in order to land this you'll need to remove the backtrace memorykind again, then land it here, then update backtrace-rs, then bump everything in rustc, then add the memory kind again. Does that sound about right? |
Either that or special-casing this new memory kind so that it can be deallocated by the default allocator and removing that later, I think. |
Well, it is possible in principle, but it is really rather annoying... Is there any way that we could change the backtrace API so that allocation is done by the user? Like, the user has to first call |
Yeah, that's a much better idea actually. Since this would involve completely rewriting the PR, should I open a new PR or just force push over this one? |
Just force pushing is fine |
In terms of migrating to the new API, we do have a ( |
c0fbd01
to
62543c9
Compare
When updating the readme, should I keep documentation for the old api, or replace it completely with the new api? |
We want people to use the new one so probably it makes sense to only document that. |
Sorry that I took so long. The changes are done. |
No worries. :) |
Awesome, looks good. :) Can you squash the commits together? |
5848620
to
aeb4b13
Compare
aeb4b13
to
2c670b1
Compare
Whoops, forgot about the CI failure |
Thanks a lot for this PR. :-) |
📌 Commit 2c670b1 has been approved by |
☀️ Test successful - checks-actions |
Currently, backtraces break when the global allocator is overridden because the allocator will attempt to deallocate memory allocated directly by Miri.
This PR fixes that by using a new memory kind and providing a function to deallocate it. We can't call the custom allocator to allocate because it's not possible to call a function in the middle of a shim.This PR fixes that by adding a new version of the backtrace API accessible by setting
flags
to 1. Existing code still functions.backtrace-rs PR: rust-lang/backtrace-rs#462
Fixes #1996