debugging prints
This commit is contained in:
parent
1542186378
commit
ab17e3198b
3 changed files with 39 additions and 12 deletions
18
console.c
18
console.c
|
@ -356,12 +356,20 @@ kbd_intr()
|
|||
c += 'a' - 'A';
|
||||
}
|
||||
|
||||
switch(c){
|
||||
case 0:
|
||||
// Ignore unknown keystrokes.
|
||||
if(c == 0x0) {
|
||||
release(&kbd_lock);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case C('T'):
|
||||
cprintf("#"); // Let user know we're still alive.
|
||||
break;
|
||||
|
||||
case C('P'):
|
||||
procdump();
|
||||
break;
|
||||
|
||||
default:
|
||||
if(((kbd_w + 1) % KBD_BUF) != kbd_r){
|
||||
kbd_buf[kbd_w++] = c;
|
||||
if(kbd_w >= KBD_BUF)
|
||||
|
@ -370,6 +378,8 @@ kbd_intr()
|
|||
} else {
|
||||
cprintf("kbd overflow\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
release(&kbd_lock);
|
||||
}
|
||||
|
|
1
defs.h
1
defs.h
|
@ -24,6 +24,7 @@ void proc_exit(void);
|
|||
int proc_kill(int);
|
||||
int proc_wait(void);
|
||||
void yield(void);
|
||||
void procdump(void);
|
||||
|
||||
// swtch.S
|
||||
struct jmpbuf;
|
||||
|
|
16
proc.c
16
proc.c
|
@ -403,3 +403,19 @@ proc_wait(void)
|
|||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
int i;
|
||||
struct proc *p;
|
||||
|
||||
for(i = 0; i < NPROC; i++) {
|
||||
p = &proc[i];
|
||||
if(p->state == UNUSED)
|
||||
continue;
|
||||
cprintf("%d %d %p\n", p->pid, p->state);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue