mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Added a shim around rust_panic to update panic counter
This commit is contained in:
parent
221000abbe
commit
00b1e88680
@ -340,5 +340,5 @@ pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> {
|
||||
/// ```
|
||||
#[stable(feature = "resume_unwind", since = "1.9.0")]
|
||||
pub fn resume_unwind(payload: Box<Any + Send>) -> ! {
|
||||
panicking::rust_panic(payload)
|
||||
panicking::update_count_then_panic(payload)
|
||||
}
|
||||
|
@ -398,6 +398,16 @@ fn rust_panic_with_hook(msg: Box<Any + Send>,
|
||||
rust_panic(msg)
|
||||
}
|
||||
|
||||
/// Shim around rust_panic. Called by resume_unwind.
|
||||
pub fn update_count_then_panic(msg: Box<Any + Send>) -> ! {
|
||||
PANIC_COUNT.with(|c| {
|
||||
let prev = c.get();
|
||||
c.set(prev + 1);
|
||||
});
|
||||
|
||||
rust_panic(msg)
|
||||
}
|
||||
|
||||
/// A private no-mangle function on which to slap yer breakpoints.
|
||||
#[no_mangle]
|
||||
#[allow(private_no_mangle_fns)] // yes we get it, but we like breakpoints
|
||||
|
Loading…
Reference in New Issue
Block a user