-
Notifications
You must be signed in to change notification settings - Fork 348
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
Support unwinding after a panic #693
Conversation
Please also add a test that check whether double panics cause an abort and don't confuse miri. Something like struct Foo;
impl Drop for Foo {
fn drop(&mut self) {
panic!("second");
}
}
fn main() {
let foo = Foo;
panic!("first");
} |
@oli-obk: Double-panics are handled correctly, but end up causing an error due to Should we look into building libstd without the |
That seems doable since we're building a libstd anyway. But you don't have to do that in this PR, adding the test so we see the failure is enough for me right now. |
Where is that happening? The |
1d26324
to
4893036
Compare
859366f
to
6d195bc
Compare
@RalfJung: I've updated this PR (and the corresponding rustc PR) to move more of the unwinding logic into rustc. Now, the implementation doesn't manually step through |
634bf34
to
b909669
Compare
This is going to require the ability to read wide strings, which appears to be currently being worked on in rust-lang/rust#66470. @RalfJung: Is there any chance that we could just disable unwinding tests on Windows for now? Getting this working is going to require rust-lang/rust#66470 to be merged, after which we will need to implement |
Seems fine to me, if you open an issue. |
Miri currently does not support `GetProcAddress` and `GetModuleHandleW`, both of which end up getting invoked by the libstd panic hook.
@Aaron1011 I pushed a commit with a bunch of comments, but also some simplifications in Then this is ready to land IMO, modulo my question about @oli-obk any comments/concerns? |
@RalfJung: This should now be ready to merge. |
@RalfJung: I've fixed the two comments you mentioned. |
@bors r+ |
📌 Commit 2750f60 has been approved by |
Support unwinding after a panic Fixes #658 This commit adds support for unwinding after a panic. It requires a companion rustc PR to be merged, in order for the necessary hooks to work properly. Currently implemented: * Selecting between unwind/abort mode based on the rustc Session * Properly popping off stack frames, unwinding back the caller * Running 'unwind' blocks in Mir terminators Not yet implemented: * 'Abort' terminators This PR was getting fairly large, so I decided to open it for review without implementing 'Abort' terminator support. This could either be added on to this PR, or merged separately. I've a test to exercise several different aspects of unwind panicking. Ideally, we would run Miri against the libstd panic tests, but I haven't yet figured out how to do that. This depends on rust-lang/rust#60026
💔 Test failed - status-appveyor |
We should re-enable this once rust-lang#1059 is fixed
@oli-obk: I had forgotten to disable one of the panic tests on Windows. Can you re-try the build? |
@bors r+ |
📌 Commit 6fe89e4 has been approved by |
Support unwinding after a panic Fixes #658 This commit adds support for unwinding after a panic. It requires a companion rustc PR to be merged, in order for the necessary hooks to work properly. Currently implemented: * Selecting between unwind/abort mode based on the rustc Session * Properly popping off stack frames, unwinding back the caller * Running 'unwind' blocks in Mir terminators Not yet implemented: * 'Abort' terminators This PR was getting fairly large, so I decided to open it for review without implementing 'Abort' terminator support. This could either be added on to this PR, or merged separately. I've a test to exercise several different aspects of unwind panicking. Ideally, we would run Miri against the libstd panic tests, but I haven't yet figured out how to do that. This depends on rust-lang/rust#60026
☀️ Test successful - checks-travis, status-appveyor |
Finally, after around half a year, this landed. Thanks @Aaron1011, this is awesome! |
Fixes #658
This commit adds support for unwinding after a panic. It requires a
companion rustc PR to be merged, in order for the necessary hooks to
work properly.
Currently implemented:
Not yet implemented:
This PR was getting fairly large, so I decided to open it for review without
implementing 'Abort' terminator support. This could either be added on
to this PR, or merged separately.
I've a test to exercise several different aspects of unwind panicking. Ideally, we would run Miri against the libstd panic tests, but I haven't yet figured out how to do that.
This depends on rust-lang/rust#60026