kernel: allow debug of crashed processes

When a process crashes, report this in the kernel console and offer to
attach a debugger.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2023-04-20 13:06:02 +08:00
parent 5206da5296
commit 97da54437e
2 changed files with 5 additions and 6 deletions

View file

@ -411,7 +411,7 @@ pub extern "C" fn trap_handler(
ex
);
#[cfg(any(feature = "precursor", feature = "renode"))]
panic!(
println!(
"{}: CPU Exception on PID {}: {}",
if is_kernel_failure {
"!!! KERNEL FAILURE !!!"

View file

@ -295,7 +295,7 @@ pub fn report_stop(_pid: xous_kernel::PID, tid: xous_kernel::TID, _pc: usize) {
};
}
pub fn report_terminated(_pid: xous_kernel::PID) {
pub fn report_terminated(pid: xous_kernel::PID) {
let Some(XousDebugState {
mut target,
server: gdb,
@ -306,7 +306,6 @@ pub fn report_terminated(_pid: xous_kernel::PID) {
let new_gdb = match gdb {
GdbStubStateMachine::Running(inner) => {
println!("Reporting a STOP");
match inner.report_stop(
&mut target,
MultiThreadStopReason::Signal(Signal::EXC_BAD_ACCESS),
@ -326,9 +325,9 @@ pub fn report_terminated(_pid: xous_kernel::PID) {
println!("GDB state was in Disconnect, which shouldn't be possible!");
return;
}
GdbStubStateMachine::Idle(_inner) => {
println!("GDB state was in Idle, which shouldn't be possible!");
return;
GdbStubStateMachine::Idle(inner) => {
println!("Please connect a debugger to debug process {}", pid);
GdbStubStateMachine::Idle(inner)
}
};