Show context name and syscall when panicking
This commit is contained in:
16
src/panic.rs
16
src/panic.rs
@@ -3,7 +3,7 @@
|
||||
use core::alloc::Layout;
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
use crate::{cpu_id, context, interrupt};
|
||||
use crate::{cpu_id, context, interrupt, syscall};
|
||||
|
||||
#[lang = "eh_personality"]
|
||||
#[no_mangle]
|
||||
@@ -18,7 +18,19 @@ pub extern "C" fn rust_begin_unwind(info: &PanicInfo) -> ! {
|
||||
unsafe { interrupt::stack_trace(); }
|
||||
|
||||
println!("CPU {}, PID {:?}", cpu_id(), context::context_id());
|
||||
//WARNING: name cannot be grabed, it may deadlock
|
||||
|
||||
// This could deadlock, but at this point we are going to halt anyways
|
||||
{
|
||||
let contexts = context::contexts();
|
||||
if let Some(context_lock) = contexts.current() {
|
||||
let context = context_lock.read();
|
||||
println!("NAME: {}", *context.name.read());
|
||||
|
||||
if let Some((a, b, c, d, e, f)) = context.syscall {
|
||||
println!("SYSCALL: {}", syscall::debug::format_call(a, b, c, d, e, f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println!("HALT");
|
||||
loop {
|
||||
|
||||
Reference in New Issue
Block a user