info->eip_fn_narg = 0;
kern/kdebug.c:182:
// Your code here. 182 stab_binsearch(stabs, &lline, &rline, N_SLINE, addr); 183 if(lline >= 0 && lline <= rline) 184 { 185 info->eip_line = rline; 186 //if(rline==lline) cprintf("info"); 187 } 188 else return -1; 189
24 static struct Command commands[] = { 25 { "help", "Display this list of commands", mon_help }, 26 { "kerninfo", "Display information about the kernel", mon_kerninfo }, 27 28 { "trace", "trace back to upper functions", mon_backtrace }, 29 };
62 int 63 mon_backtrace(int argc, char **argv, struct Trapframe *tf) 64 { 65 // Your code here. 66 uint32_t ebp, * pointer; 67 uint32_t addr; 68 struct Eipdebuginfo info; 69 ebp = read_ebp(); 70 while(ebp != 0x00) 71 { 72 pointer = (uint32_t *) ebp; 73 addr = *(pointer+1); 74 cprintf("ebp %08x eip %08x args %08x %08x %08x %08x %08x\r\n", \ 75 ebp,addr,*(pointer+2),*(pointer+3),*(pointer+4),*(pointer+5),*(pointer+6)); 76 debuginfo_eip(addr,&info); 77 cprintf("\t%s:%d: %.*s+%d\r\n",info.eip_file,info.eip_line, \ 78 info.eip_fn_namelen,info.eip_fn_name,addr - info.eip_fn_addr); 79 ebp = *pointer; 80 } 81 return 0; 82 }