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