Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

lib: Pretty-print PanicInfo #5

Merged
merged 2 commits into from
Aug 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,21 @@ pub mod arch;
fn panic_handler(info: &core::panic::PanicInfo) -> ! {
use esp_println::*;

println!("{:?}", info);
println!(" ");
println!(" ");

if let Some(location) = info.location() {
let (file, line, column) = (location.file(), location.line(), location.column());
println!("!! A panic occured in '{file}', at line {line}, column {column}");
} else {
println!("!! A panic occured at an unknown location");
}

println!(" ");
println!("{:#?}", info);
println!(" ");
println!("Backtrace:");
println!(" ");

let backtrace = crate::arch::backtrace();
for e in backtrace {
Expand Down