Skip to content

Commit f0c6d28

Browse files
misc(unwind): update to the new panic message format
https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html#cleaner-panic-messages Signed-off-by: Anhad Singh <[email protected]>
1 parent c558b79 commit f0c6d28

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/aero_kernel/src/unwind.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ use crate::utils::sync::IrqGuard;
163163
fn rust_begin_unwind(info: &PanicInfo) -> ! {
164164
prepare_panic();
165165

166-
let default_panic = &format_args!("");
167-
let panic_message = info.message().unwrap_or(default_panic);
166+
let message = info.message().unwrap();
167+
let location = info.location().unwrap();
168168

169169
// Get the CPU ID where this panic happened and if PANIC_HOOK_READY is false
170170
// then we cannot get the CPU where this panic happened.
@@ -174,14 +174,8 @@ fn rust_begin_unwind(info: &PanicInfo) -> ! {
174174
0x00
175175
};
176176

177-
log::error!("cpu '{}' panicked at '{}'", cpu_id, panic_message);
178-
179-
// Print the panic location if it is available.
180-
if let Some(panic_location) = info.location() {
181-
log::error!("{}", panic_location);
182-
}
183-
184-
// Add a new line to make the stack trace more readable.
177+
log::error!("cpu '{cpu_id}' panicked at {location}:");
178+
log::error!("{message}");
185179
log::error!("");
186180

187181
unwind_stack_trace();

0 commit comments

Comments
 (0)