-
Notifications
You must be signed in to change notification settings - Fork 385
Add an fn_ptr
field to MiriFrame
#1580
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
The `backtrace-rs` crate can use this to implement `Frame::symbol_address`, which is used to skip frames above the call to `Backtrace::capture` on the stack. The function pointer will not be useable for comparison purposes if the function is generic, as CTFE creates a new function pointer for each cast of a (monomorphized) generic function. However, this already affects code running under Miri, and isn't a problem for `backtrace-rs` (which only casts a non-generic function). I've added logic to allow `MiriFrame` to have either 4 or 5 fields - if a 5th field is present, we write the function pointer to it.
@RalfJung: Would you like me to add any kind of deprecation warning for the 4-field case, or should we just remove it later without a warning? |
Co-authored-by: Ralf Jung <[email protected]>
182f5f3
to
6a6767f
Compare
It's probably not worth it given the low usage. But please add a comment in the code saying that this is deprecated and slated for removal. You say it is for "backwards compatibility", but that might well mean "we will support this forever due to backwards compatibility". |
Thanks for the PR! |
📌 Commit c889eba has been approved by |
☀️ Test successful - checks-actions, checks-travis, status-appveyor |
The
backtrace-rs
crate can use this to implementFrame::symbol_address
, which is used to skip framesabove the call to
Backtrace::capture
on the stack.The function pointer will not be useable for comparison purposes if the
function is generic, as CTFE creates a new function pointer for each
cast of a (monomorphized) generic function. However, this already
affects code running under Miri, and isn't a problem for
backtrace-rs
(which only casts a non-generic function).
I've added logic to allow
MiriFrame
to have either 4 or 5 fields - ifa 5th field is present, we write the function pointer to it.