Skip to content

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

Merged
merged 3 commits into from
Oct 11, 2020

Conversation

Aaron1011
Copy link
Member

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.

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.
@Aaron1011
Copy link
Member Author

@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?

@Aaron1011 Aaron1011 force-pushed the feature/backtrace-fn-ptr branch from 182f5f3 to 6a6767f Compare October 11, 2020 17:40
@RalfJung
Copy link
Member

@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?

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".

@RalfJung
Copy link
Member

Thanks for the PR!
@bors r+

@bors
Copy link
Contributor

bors commented Oct 11, 2020

📌 Commit c889eba has been approved by RalfJung

@bors
Copy link
Contributor

bors commented Oct 11, 2020

⌛ Testing commit c889eba with merge 73d5c42...

@bors
Copy link
Contributor

bors commented Oct 11, 2020

☀️ Test successful - checks-actions, checks-travis, status-appveyor
Approved by: RalfJung
Pushing 73d5c42 to master...

@bors bors merged commit 73d5c42 into rust-lang:master Oct 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants