diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-01-18 18:27:33 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-01-18 18:27:33 +0000 |
commit | 6f4ee9e0d3f0574b75c93b24d7ad4f458ac399a0 (patch) | |
tree | 8b82d14161cd50de88e5c845347a1f9e4bbfa6fa /sys | |
parent | 63cd9a02e5c8bc63160057681bff60aa5636228e (diff) |
In stacktrace(), when aborting a traceback because of nonsensical pc or sp
value, don't print a final bogus traceback line.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mips64/mips64/trap.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c index e49cc225546..0681879dced 100644 --- a/sys/arch/mips64/mips64/trap.c +++ b/sys/arch/mips64/mips64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.61 2010/01/18 16:57:46 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.62 2010/01/18 18:27:32 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -856,15 +856,15 @@ fpu_trapsignal(struct proc *p, u_long ucode, int typ, union sigval sv) #if defined(DDB) || defined(DEBUG) void -trapDump(msg) - char *msg; +trapDump(char *msg) { #ifdef MULTIPROCESSOR CPU_INFO_ITERATOR cii; #endif struct cpu_info *ci; - struct trapdebug *ptrp; + struct trapdebug *base, *ptrp; int i; + uint pos; int s; s = splhigh(); @@ -875,10 +875,17 @@ trapDump(msg) CPU_INFO_FOREACH(cii, ci) #endif { +#ifdef MULTIPROCESSOR + printf("cpu%d\n", ci->ci_cpuid); +#endif /* walk in reverse order */ + pos = trppos[ci->ci_cpuid]; + base = trapdebug + ci->ci_cpuid * TRAPSIZE; for (i = TRAPSIZE - 1; i >= 0; i--) { - ptrp = trapdebug + ci->ci_cpuid * TRAPSIZE; - ptrp += (trppos[ci->ci_cpuid] + i) % TRAPSIZE; + if (pos + i >= TRAPSIZE) + ptrp = base + pos + i - TRAPSIZE; + else + ptrp = base + pos + i; if (ptrp->cause == 0) break; @@ -1194,14 +1201,14 @@ loop: if (sp & 3 || !VALID_ADDRESS(sp)) { (*pr)("SP %p: not in kernel\n", sp); ra = 0; - goto done; + goto end; } /* check for bad PC */ if (pc & 3 || !VALID_ADDRESS(pc)) { (*pr)("PC %p: not in kernel\n", pc); ra = 0; - goto done; + goto end; } #ifdef DDB @@ -1316,7 +1323,6 @@ loop: } } -done: #ifdef DDB if (symname == NULL) (*pr)("%p ", subr); |