Skip to content
Snippets Groups Projects
Commit ab17e319 authored by rsc's avatar rsc
Browse files

debugging prints

parent 15421863
No related branches found
No related tags found
No related merge requests found
...@@ -356,19 +356,29 @@ kbd_intr() ...@@ -356,19 +356,29 @@ kbd_intr()
c += 'a' - 'A'; c += 'a' - 'A';
} }
// Ignore unknown keystrokes. switch(c){
if(c == 0x0) { case 0:
release(&kbd_lock); // Ignore unknown keystrokes.
return; break;
}
case C('T'):
if(((kbd_w + 1) % KBD_BUF) != kbd_r){ cprintf("#"); // Let user know we're still alive.
kbd_buf[kbd_w++] = c; break;
if(kbd_w >= KBD_BUF)
kbd_w = 0; case C('P'):
wakeup(&kbd_r); procdump();
} else { break;
cprintf("kbd overflow\n");
default:
if(((kbd_w + 1) % KBD_BUF) != kbd_r){
kbd_buf[kbd_w++] = c;
if(kbd_w >= KBD_BUF)
kbd_w = 0;
wakeup(&kbd_r);
} else {
cprintf("kbd overflow\n");
}
break;
} }
release(&kbd_lock); release(&kbd_lock);
......
...@@ -24,6 +24,7 @@ void proc_exit(void); ...@@ -24,6 +24,7 @@ void proc_exit(void);
int proc_kill(int); int proc_kill(int);
int proc_wait(void); int proc_wait(void);
void yield(void); void yield(void);
void procdump(void);
// swtch.S // swtch.S
struct jmpbuf; struct jmpbuf;
......
...@@ -403,3 +403,19 @@ proc_wait(void) ...@@ -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);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment