1#![doc = include_str!("../README.md")]
4#![deny(missing_docs, missing_debug_implementations)]
5#![no_std]
6
7#[cfg(not(test))]
8use core::panic::PanicInfo;
9#[cfg(not(test))]
10use mc_sgx_panic_sys::panic_count;
11
12#[cfg(feature = "log")]
13mod log;
14
15#[cfg(not(test))]
16#[panic_handler]
17fn panic(_info: &PanicInfo) -> ! {
18 extern "C" {
19 fn abort() -> !;
20 }
21
22 let panics = panic_count::increase();
23
24 if panics > 1 {
28 unsafe { abort() }
29 }
30
31 #[cfg(feature = "log")]
32 log::log_panic_info(_info);
33
34 unsafe { abort() }
35}