diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-03-27 19:51:01 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-03-27 19:51:01 +0000 |
commit | 26617de26577b9f04bf3b20041ceaade2e5015d5 (patch) | |
tree | 5a991715b15a31d904b9a16405b56d25c3f24794 /sys/arch | |
parent | 572ebf436a86d77b75833f20e65f6c2672e99be1 (diff) |
When trap() causes a panic, have stacktrace() use ddb to find the symbol
names if option DDB, instead of the fn_name() helper which only knows about
trap() anyway.
While there, do not attempt to print the function arguments after the first
frame, since they are known to be clobbered.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mips64/mips64/trap.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c index cb812d565e8..c42f34539f8 100644 --- a/sys/arch/mips64/mips64/trap.c +++ b/sys/arch/mips64/mips64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.31 2006/12/24 20:30:35 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.32 2007/03/27 19:51:00 miod Exp $ */ /* tracked to 1.23 */ /* @@ -1115,7 +1115,9 @@ cpu_singlestep(p) #define MIPS_JR_RA 0x03e00008 /* instruction code for jr ra */ /* forward */ +#if !defined(DDB) char *fn_name(long addr); +#endif void stacktrace_subr(struct trap_frame *, int (*)(const char*, ...)); /* @@ -1164,7 +1166,7 @@ loop: /* Jump here after a nonstandard (interrupt handler) frame */ stksize = 0; subr = 0; - if (frames++ > 6) { + if (frames++ > 6) { (*printfn)("stackframe count exceeded\n"); return; } @@ -1320,13 +1322,16 @@ loop: } done: - (*printfn)("%s+%x ra %p sp %p (%p,%p,%p,%p)\n", - fn_name(subr), pc - subr, ra, sp, a0, a1, a2, a3); -#if defined(_LP64) - a0 = a1 = a2 = a3 = 0x00dead0000dead00; +#ifdef DDB + db_printsym(pc, DB_STGY_ANY, printfn); #else - a0 = a1 = a2 = a3 = 0x00dead00; + (*printfn)("%s+%x", fn_name(subr), pc - subr); #endif + if (frames == 1) + (*printfn)(" ra %p sp %p (%p,%p,%p,%p)\n", + ra, sp, a0, a1, a2, a3); + else + (*printfn)(" ra %p sp %p\n", ra, sp); if (ra) { if (pc == ra && stksize == 0) @@ -1345,6 +1350,7 @@ done: } } +#if !defined(DDB) /* * Functions ``special'' enough to print by name */ @@ -1373,5 +1379,6 @@ fn_name(long addr) snprintf(buf, sizeof(buf), "%x", addr); return (buf); } +#endif /* !DDB */ -#endif /* DDB */ +#endif /* DDB || DEBUG */ |