kernel: debug: add command to print processes

This changes the `p` command to only print processes, and renames the
existing behavior to `P` which prints processes and threads.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-06-18 12:56:27 +08:00
parent 9ced90190e
commit 2a1aa24040

View file

@ -374,6 +374,27 @@ pub fn irq(_irq_number: usize, _arg: *mut usize) {
}
b'p' => {
println!("Printing processes");
crate::services::SystemServices::with(|system_services| {
let current_pid = system_services.current_pid();
for process in &system_services.processes {
if !process.free() {
println!(
"{:?} {}:",
process,
system_services.process_name(process.pid).unwrap_or("")
);
process.activate().unwrap();
}
}
system_services
.get_process(current_pid)
.unwrap()
.activate()
.unwrap();
});
}
b'P' => {
println!("Printing processes and threads");
crate::services::SystemServices::with(|system_services| {
let current_pid = system_services.current_pid();
for process in &system_services.processes {
@ -461,7 +482,8 @@ pub fn irq(_irq_number: usize, _arg: *mut usize) {
#[cfg(feature = "gdbserver")]
println!(" g | enter the gdb server");
println!(" m | print MMU page tables of all processes");
println!(" p | print all processes and threads");
println!(" p | print all processes");
println!(" P | print all processes and threads");
println!(" r | report RAM usage of all processes");
println!(" s | Suspend PID 3");
println!(" c | Continue PID 3");