Date: Tue, 11 Dec 2007 23:31:53 GMT From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 130651 for review Message-ID: <200712112331.lBBNVr6X026180@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=130651 Change 130651 by gonzo@gonzo_jeeves on 2007/12/11 23:31:33 o Since gcc with -O does not bother to store ra on stack for breakpoint() use initial RA value from thread PCB. Affected files ... .. //depot/projects/mips2/src/sys/mips/mips/db_trace.c#6 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips/db_trace.c#6 (text+ko) ==== @@ -42,7 +42,8 @@ #include <ddb/db_variables.h> #include <ddb/db_sym.h> -void db_stack_trace_cmd(db_expr_t pc_addr, db_expr_t sp, db_expr_t count); +void db_stack_trace_cmd(db_expr_t pc_addr, db_expr_t ra, db_expr_t sp, + db_expr_t count); void db_print_backtrace(void); struct db_variable db_regs[] = { @@ -112,7 +113,8 @@ * this implementation is good enough for practical use. */ void -db_stack_trace_cmd(db_expr_t pc_addr, db_expr_t sp_addr, db_expr_t count) +db_stack_trace_cmd(db_expr_t pc_addr, db_expr_t ra_addr, db_expr_t sp_addr, + db_expr_t count) { u_register_t sp, ra = 0, pc, i, stacksize, func; short ra_stack_pos = 0; @@ -123,7 +125,10 @@ sp = sp_addr; pc = pc_addr; + ra = ra_addr; + ra -= 2 * sizeof(insn); + for (;;) { func = 0; stacksize = 0; @@ -233,15 +238,15 @@ int db_trace_thread(struct thread *thr, int count) { - u_register_t pc; - u_register_t sp; + u_register_t pc, ra, sp; struct pcb *ctx; ctx = kdb_thr_ctx(thr); pc = ctx->pcb_regs[PCB_REG_PC]; sp = ctx->pcb_regs[PCB_REG_SP]; + ra = ctx->pcb_regs[PCB_REG_RA]; - db_stack_trace_cmd(pc, sp, -1); + db_stack_trace_cmd(pc, ra, sp, -1); return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712112331.lBBNVr6X026180>