Added a shim around rust_panic to update panic counter

This commit is contained in:
Nikhil Shagrithaya 2016-07-20 18:35:25 +05:30
parent 221000abbe
commit 00b1e88680
2 changed files with 11 additions and 1 deletions

View File

@ -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)
}

View File

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