From ec97b3cdcfc76ecde47864c49c7000435d2a8f89 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 10 Mar 2023 09:20:43 +0800 Subject: [PATCH] kernel: throw error when debugging invalid process When debugging an invalid process (e.g. not yet run, terminated, etc.) return an error rather than silently continuing. Signed-off-by: Sean Cross --- kernel/src/services.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/src/services.rs b/kernel/src/services.rs index e6acb10e3..2db6ee5a4 100644 --- a/kernel/src/services.rs +++ b/kernel/src/services.rs @@ -2267,9 +2267,9 @@ impl SystemServices { } }); let new_process_state = match process_state { - ProcessState::Allocated => ProcessState::Allocated, - ProcessState::Free => ProcessState::Free, - ProcessState::Setup(thread_init) => ProcessState::Setup(thread_init), + ProcessState::Allocated | ProcessState::Free | ProcessState::Setup(_) => { + return Err(xous_kernel::Error::ProcessNotFound) + } ProcessState::Ready(tids) => ProcessState::Debug(tids), ProcessState::Exception(tids) => ProcessState::Exception(tids), ProcessState::BlockedException(tids) => ProcessState::BlockedException(tids),