2022-01-23 12:13:53 +04:00
|
|
|
use super::{getpid, kill, SignalFlags};
|
2020-12-14 12:18:33 +04:00
|
|
|
|
2020-11-18 10:48:13 +04:00
|
|
|
#[panic_handler]
|
|
|
|
fn panic_handler(panic_info: &core::panic::PanicInfo) -> ! {
|
|
|
|
let err = panic_info.message().unwrap();
|
|
|
|
if let Some(location) = panic_info.location() {
|
2022-01-22 23:54:09 +04:00
|
|
|
println!(
|
|
|
|
"Panicked at {}:{}, {}",
|
|
|
|
location.file(),
|
|
|
|
location.line(),
|
|
|
|
err
|
|
|
|
);
|
2020-11-18 10:48:13 +04:00
|
|
|
} else {
|
|
|
|
println!("Panicked: {}", err);
|
|
|
|
}
|
2022-01-23 12:13:53 +04:00
|
|
|
kill(getpid() as usize, SignalFlags::SIGABRT.bits());
|
|
|
|
unreachable!()
|
2022-01-22 23:54:09 +04:00
|
|
|
}
|