mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-24 02:16:23 +04:00
19 lines
493 B
Rust
19 lines
493 B
Rust
use super::{getpid, kill, SignalFlags};
|
|
|
|
#[panic_handler]
|
|
fn panic_handler(panic_info: &core::panic::PanicInfo) -> ! {
|
|
let err = panic_info.message().unwrap();
|
|
if let Some(location) = panic_info.location() {
|
|
println!(
|
|
"Panicked at {}:{}, {}",
|
|
location.file(),
|
|
location.line(),
|
|
err
|
|
);
|
|
} else {
|
|
println!("Panicked: {}", err);
|
|
}
|
|
kill(getpid() as usize, SignalFlags::SIGABRT.bits());
|
|
unreachable!()
|
|
}
|