mirror of
https://github.com/SmallPond/MIT6.828_OS.git
synced 2026-02-03 02:53:21 +08:00
lab1 monitor mon_backtrace
This commit is contained in:
@@ -59,6 +59,24 @@ int
|
||||
mon_backtrace(int argc, char **argv, struct Trapframe *tf)
|
||||
{
|
||||
// Your code here.
|
||||
int
|
||||
mon_backtrace(int argc, char **argv, struct Trapframe *tf)
|
||||
{
|
||||
|
||||
uint32_t *ebp;
|
||||
ebp = (uint32_t *)read_ebp();
|
||||
cprintf("Stack backtrace:\n");
|
||||
while(ebp!=0){
|
||||
cprintf(" ebp %08x",ebp);
|
||||
cprintf(" eip %08x args",*(ebp+1));
|
||||
cprintf(" args");
|
||||
cprintf(" %08x", *(ebp+2));
|
||||
cprintf(" %08x", *(ebp+3));
|
||||
cprintf(" %08x", *(ebp+4));
|
||||
cprintf(" %08x", *(ebp+5));
|
||||
cprintf(" %08x\n", *(ebp+6));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user