提交 227f0486 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

^E to print out current PCs on each CPU at next timer intr

上级 71ecfe98
......@@ -162,10 +162,10 @@ kerneltrap(struct trapframe *tf)
kstack = myproc()->kstack;
}
__cprintf("kernel trap %u cpu %u\n"
" tf: rip %p rsp %p cr2 %p cs %p\n"
" tf: rip %p rsp %p rbp %p cr2 %p cs %p\n"
" proc: name %s pid %u kstack %p\n",
tf->trapno, mycpu()->id,
tf->rip, tf->rsp, rcr2(), tf->cs,
tf->rip, tf->rsp, tf->rbp, rcr2(), tf->cs,
name, pid, kstack);
printtrace(tf->rbp);
......@@ -235,6 +235,10 @@ consoleintr(int (*getc)(void))
case C('P'): // Process listing.
procdumpall();
break;
case C('E'): // Print user-space PCs.
for (u32 i = 0; i < NCPU; i++)
cpus[i].timer_printpc = 1;
break;
case C('U'): // Kill line.
while(input.e != input.w &&
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
......
......@@ -11,6 +11,7 @@ struct cpu {
struct taskstate ts; // Used by x86 to find stack for interrupt
struct context *scheduler; // swtch() here to enter scheduler
struct wqframe *wqframe;
int timer_printpc;
// Cpu-local storage variables; see below
struct cpu *cpu;
......
......@@ -71,8 +71,15 @@ trap(struct trapframe *tf)
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
if (mycpu()->timer_printpc) {
cprintf("cpu%d: proc %s rip %lx rsp %lx cs %x\n",
mycpu()->id,
myproc() ? myproc()->name : "(none)",
tf->rip, tf->rsp, tf->cs);
mycpu()->timer_printpc = 0;
}
if (mycpu()->id == 0)
cv_tick();
cv_tick();
lapiceoi();
break;
case T_IRQ0 + IRQ_IDE:
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论