mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
kernel: riscv: add print_thread_* family
These calls can be used to print out thread information for debugging. This augments the existing `print_thread()` call, which has been renamed to `print_current_thread()`. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
2e4fb672ab
commit
5bd9e40ace
2 changed files with 20 additions and 3 deletions
|
|
@ -180,7 +180,7 @@ pub extern "C" fn trap_handler(
|
|||
println!("SYSTEM HALT: CPU Exception on PID {}: {}", pid, ex);
|
||||
ArchProcess::with_current(|process| {
|
||||
println!("Current thread {}:", process.current_tid());
|
||||
process.print_thread();
|
||||
process.print_current_thread();
|
||||
});
|
||||
MemoryMapping::current().print_map();
|
||||
loop {}
|
||||
|
|
|
|||
|
|
@ -353,8 +353,25 @@ impl Process {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn print_thread(&self) {
|
||||
let _thread = self.current_thread();
|
||||
pub fn print_all_threads(&self) {
|
||||
let process = unsafe { &mut *PROCESS };
|
||||
&mut process.threads[process.hardware_thread - 1];
|
||||
for (tid_idx, &thread) in process.threads.iter().enumerate() {
|
||||
let tid = tid_idx + 1;
|
||||
if thread.registers[1] != 0 {
|
||||
Self::print_thread(tid, &thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_current_thread(&self) {
|
||||
let thread = self.current_thread();
|
||||
let tid = self.current_tid();
|
||||
Self::print_thread(tid, &thread);
|
||||
}
|
||||
|
||||
pub fn print_thread(_tid: TID, _thread: &Thread) {
|
||||
println!("Thread {}:", _tid);
|
||||
println!(
|
||||
"PC:{:08x} SP:{:08x} RA:{:08x}",
|
||||
_thread.sepc, _thread.registers[1], _thread.registers[0]
|
||||
|
|
|
|||
Loading…
Reference in a new issue