-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add hooks for Miri panic unwinding #60026
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
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
187d05f
Add hooks for Miri panic unwinding
Aaron1011 1991018
Formatting improvements
Aaron1011 fa4f1b7
Fix incorrect unwrap of dest
Aaron1011 d87e2da
Remove old intrinsic check
Aaron1011 499eb5d
More fixes for rustc changes
Aaron1011 01c11f9
avoid the loop in unwinding stack popping
RalfJung 64a43f4
A few minor tweaks
Aaron1011 fe3e1c1
Add doc comment
Aaron1011 8df4248
Some cleanup
Aaron1011 4f25c91
Fix unwinding logic
Aaron1011 8ff4d41
Don't attempt to get cwd when printing backtrace under Miri
Aaron1011 caf3cc1
Add explicit Miri support to libpanic_unwind
Aaron1011 fe88fc0
Fix up intrinsic implementation
Aaron1011 848e1d8
More work on miri_start_panic
Aaron1011 5553476
Use proper intrinsic type
Aaron1011 b06c83c
Add miri trampoline, fix handling of intrinsic return
Aaron1011 d5c0aca
Add comment
Aaron1011 dac3011
Change TODO to FIXME
Aaron1011 c062afe
Make doc comment more accurate
Aaron1011 72b555c
Some code cleanup
Aaron1011 2390077
Move to miri.rs and re-export it
Aaron1011 6eea0ff
Add more detailed codegen comment
Aaron1011 607339f
Fix tidy
Aaron1011 4ecb80d
Remove trampoline, pass `ret` and `unwind` when handling intrinsics
Aaron1011 ee2dc4b
Fix debug assertion
Aaron1011 2ed1e89
Rename to
Aaron1011 68d9853
Fix rebase fallout
Aaron1011 c0b972a
Return Ok(false) instead of throwing when handling a diverging intrinsic
Aaron1011 b4545a4
Update
Aaron1011 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use core::any::Any; | ||
use alloc::boxed::Box; | ||
|
||
pub fn payload() -> *mut u8 { | ||
core::ptr::null_mut() | ||
} | ||
|
||
pub unsafe fn panic(data: Box<dyn Any + Send>) -> ! { | ||
core::intrinsics::miri_start_panic(Box::into_raw(data)) | ||
} | ||
|
||
pub unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> { | ||
Box::from_raw(ptr) | ||
} | ||
|
||
|
||
// This is required by the compiler to exist (e.g., it's a lang item), | ||
// but is never used by Miri. Therefore, we just use a stub here | ||
#[lang = "eh_personality"] | ||
#[cfg(not(test))] | ||
fn rust_eh_personality() { | ||
unsafe { core::intrinsics::abort() } | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.