From ac43589e9d7dc29300cafa2756708bf1cfae2f42 Mon Sep 17 00:00:00 2001 From: Spxg Date: Sun, 7 Mar 2021 11:58:14 +0800 Subject: [PATCH] panic_handler: update msg format and add column location --- os/src/lang_items.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/os/src/lang_items.rs b/os/src/lang_items.rs index 3f5462a..f01f862 100644 --- a/os/src/lang_items.rs +++ b/os/src/lang_items.rs @@ -3,10 +3,16 @@ use crate::sbi::shutdown; #[panic_handler] fn panic(info: &PanicInfo) -> ! { - if let Some(location) = info.location() { - println!("[kernel] Panicked at {}:{} {}", location.file(), location.line(), info.message().unwrap()); - } else { - println!("[kernel] Panicked: {}", info.message().unwrap()); + match info.location() { + Some(location) => { + println!("[kernel] panicked at '{}', {}:{}:{}", + info.message().unwrap(), + location.file(), + location.line(), + location.column() + ); + } + None => println!("[kernel] panicked at '{}'", info.message().unwrap()) } shutdown() }