diff options
author | Robert Morris <[email protected]> | 2019-06-06 13:54:03 -0400 |
---|---|---|
committer | Robert Morris <[email protected]> | 2019-06-06 13:54:03 -0400 |
commit | 91ba81110acd3163f7de3580b677eece0c57f5e7 (patch) | |
tree | 670536a7f365e75282048b5447a107338b677642 /proc.c | |
parent | 8607051b5fc79fffa319b913b19e99bc5b90e063 (diff) | |
download | xv6-labs-91ba81110acd3163f7de3580b677eece0c57f5e7.tar.gz xv6-labs-91ba81110acd3163f7de3580b677eece0c57f5e7.tar.bz2 xv6-labs-91ba81110acd3163f7de3580b677eece0c57f5e7.zip |
gdb backtraces: -ggdb, -fno-omit-frame-pointer, BSIZE=1024
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -560,3 +560,32 @@ either_copyin(void *dst, int user_src, uint64 src, uint64 len) } } +// Print a process listing to console. For debugging. +// Runs when user types ^P on console. +// No lock to avoid wedging a stuck machine further. +void +procdump(void) +{ + static char *states[] = { + [UNUSED] "unused", + [EMBRYO] "embryo", + [SLEEPING] "sleep ", + [RUNNABLE] "runble", + [RUNNING] "run ", + [ZOMBIE] "zombie" + }; + struct proc *p; + char *state; + + for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ + if(p->state == UNUSED) + continue; + if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) + state = states[p->state]; + else + state = "???"; + printf("%d %s %s", p->pid, state, p->name); + printf("\n"); + } +} + |