mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-23 09:56:24 +04:00
Use error! instead of println! when panicking
This commit is contained in:
parent
a16b6651b1
commit
aa2db574e5
@ -2,18 +2,19 @@ use crate::sbi::shutdown;
|
||||
use crate::task::current_kstack_top;
|
||||
use core::arch::asm;
|
||||
use core::panic::PanicInfo;
|
||||
use log::*;
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
if let Some(location) = info.location() {
|
||||
println!(
|
||||
error!(
|
||||
"[kernel] Panicked at {}:{} {}",
|
||||
location.file(),
|
||||
location.line(),
|
||||
info.message().unwrap()
|
||||
);
|
||||
} else {
|
||||
println!("[kernel] Panicked: {}", info.message().unwrap());
|
||||
error!("[kernel] Panicked: {}", info.message().unwrap());
|
||||
}
|
||||
unsafe {
|
||||
backtrace();
|
||||
|
Loading…
Reference in New Issue
Block a user