提交 ae573cc0 创建 作者: Silas Boyd-Wickizer's avatar Silas Boyd-Wickizer

Merge branch 'scale-amd64' of git+ssh://amsterdam.csail.mit.edu/home/am0/6.828/xv6 into scale-amd64

......@@ -20,7 +20,8 @@ NM = $(TOOLPREFIX)nm
OBJCOPY = $(TOOLPREFIX)objcopy
CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb \
-m64 -Werror -std=c99 -fms-extensions -mno-sse -mcmodel=large -I$(QEMUSRC) \
-m64 -Werror -std=c99 -fms-extensions -mno-sse -mcmodel=large -mno-red-zone \
-I$(QEMUSRC) \
-fno-omit-frame-pointer -DHW_$(HW) -include param.h -include compiler.h
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
ASFLAGS = -m64 -gdwarf-2 -MD
......
......@@ -239,6 +239,10 @@ consoleintr(int (*getc)(void))
for (u32 i = 0; i < NCPU; i++)
cpus[i].timer_printpc = 1;
break;
case C('T'): // Print user-space PCs and stack traces.
for (u32 i = 0; i < NCPU; i++)
cpus[i].timer_printpc = 2;
break;
case C('U'): // Kill line.
while(input.e != input.w &&
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
......
......@@ -76,6 +76,12 @@ trap(struct trapframe *tf)
mycpu()->id,
myproc() ? myproc()->name : "(none)",
tf->rip, tf->rsp, tf->cs);
if (mycpu()->timer_printpc == 2 && tf->rbp > KBASE) {
uptr pc[10];
getcallerpcs((void *) tf->rbp, pc, NELEM(pc));
for (int i = 0; i < 10 && pc[i]; i++)
cprintf("cpu%d: %lx\n", mycpu()->id, pc[i]);
}
mycpu()->timer_printpc = 0;
}
if (mycpu()->id == 0)
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论