debugging - printing processes on serial
- this patch moves the former printslot() from arch_system.c to debug.c and reimplements it slightly. The output is not changed, however, the process information is printed in a separate function print_proc() in debug.c as such a function is also handy in other situations and should be publicly available when debugging.
This commit is contained in:
@@ -161,3 +161,76 @@ schedulerstr(struct proc *scheduler)
|
||||
return "KERNEL";
|
||||
}
|
||||
|
||||
PUBLIC void print_proc(struct proc *pp)
|
||||
{
|
||||
struct proc *depproc = NULL;
|
||||
endpoint_t dep;
|
||||
|
||||
printf("%d: %s %d prio %d time %d/%d cycles 0x%x%08x cr3 0x%lx rts %s misc %s sched %s",
|
||||
proc_nr(pp), pp->p_name, pp->p_endpoint,
|
||||
pp->p_priority, pp->p_user_time,
|
||||
pp->p_sys_time, pp->p_cycles.hi, pp->p_cycles.lo, pp->p_seg.p_cr3,
|
||||
rtsflagstr(pp->p_rts_flags), miscflagstr(pp->p_misc_flags),
|
||||
schedulerstr(pp->p_scheduler));
|
||||
|
||||
dep = P_BLOCKEDON(pp);
|
||||
if(dep != NONE) {
|
||||
printf(" blocked on: ");
|
||||
if(dep == ANY) {
|
||||
printf(" ANY\n");
|
||||
} else {
|
||||
int procno;
|
||||
if(!isokendpt(dep, &procno)) {
|
||||
printf(" ??? %d\n", dep);
|
||||
} else {
|
||||
depproc = proc_addr(procno);
|
||||
if(isemptyp(depproc)) {
|
||||
printf(" empty slot %d???\n", procno);
|
||||
depproc = NULL;
|
||||
} else {
|
||||
printf(" %s\n", depproc->p_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
PRIVATE void print_proc_depends(struct proc *pp, const int level)
|
||||
{
|
||||
struct proc *depproc = NULL;
|
||||
endpoint_t dep;
|
||||
#define COL { int i; for(i = 0; i < level; i++) printf("> "); }
|
||||
|
||||
if(level >= NR_PROCS) {
|
||||
printf("loop??\n");
|
||||
return;
|
||||
}
|
||||
|
||||
COL
|
||||
|
||||
print_proc(pp);
|
||||
|
||||
COL
|
||||
proc_stacktrace(pp);
|
||||
|
||||
|
||||
dep = P_BLOCKEDON(pp);
|
||||
if(dep != NONE) {
|
||||
int procno;
|
||||
if(isokendpt(dep, &procno)) {
|
||||
depproc = proc_addr(procno);
|
||||
if(isemptyp(depproc))
|
||||
depproc = NULL;
|
||||
}
|
||||
if (depproc)
|
||||
print_proc_depends(depproc, level+1);
|
||||
}
|
||||
}
|
||||
|
||||
PUBLIC void print_proc_recursive(struct proc *pp)
|
||||
{
|
||||
print_proc_depends(pp, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user