Browse Source

Provide trap frame on rustsbi core panic

luojia65 4 years ago
parent
commit
dc832b1717
1 changed files with 7 additions and 4 deletions
  1. 7 4
      platform/qemu/src/main.rs

+ 7 - 4
platform/qemu/src/main.rs

@@ -298,6 +298,7 @@ pub unsafe extern "C" fn start_trap() {
 // }
 
 #[allow(unused)]
+#[derive(Debug)]
 struct TrapFrame {
     ra: usize,
     t0: usize,
@@ -398,17 +399,19 @@ extern "C" fn start_trap_rust(trap_frame: &mut TrapFrame) {
         }
         #[cfg(target_pointer_width = "64")]
         cause => panic!(
-            "Unhandled exception! mcause: {:?}, mepc: {:016x?}, mtval: {:016x?}",
+            "Unhandled exception! mcause: {:?}, mepc: {:016x?}, mtval: {:016x?}, trap frame: {:x?}",
             cause,
             mepc::read(),
-            mtval::read()
+            mtval::read(),
+            trap_frame
         ),
         #[cfg(target_pointer_width = "32")]
         cause => panic!(
-            "Unhandled exception! mcause: {:?}, mepc: {:08x?}, mtval: {:08x?}",
+            "Unhandled exception! mcause: {:?}, mepc: {:08x?}, mtval: {:08x?}, trap frame: {:x?}",
             cause,
             mepc::read(),
-            mtval::read()
+            mtval::read(),
+            trap_frame
         ),
     }
 }