Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/mips skip kernel-only code on crash.



details:   https://anonhg.NetBSD.org/src/rev/b5e52c2c2462
branches:  trunk
changeset: 944224:b5e52c2c2462
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Sep 24 03:17:18 2020 +0000

description:
skip kernel-only code on crash.

XXX: we could make verylocore work with a symbol look for crash.

diffstat:

 sys/arch/mips/mips/mips_stacktrace.c |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (74 lines):

diff -r 2b3a5c0b8447 -r b5e52c2c2462 sys/arch/mips/mips/mips_stacktrace.c
--- a/sys/arch/mips/mips/mips_stacktrace.c      Thu Sep 24 03:06:01 2020 +0000
+++ b/sys/arch/mips/mips/mips_stacktrace.c      Thu Sep 24 03:17:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mips_stacktrace.c,v 1.6 2020/09/23 09:56:33 mrg Exp $  */
+/*     $NetBSD: mips_stacktrace.c,v 1.7 2020/09/24 03:17:18 mrg Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.6 2020/09/23 09:56:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.7 2020/09/24 03:17:18 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -291,10 +291,6 @@
                [_R_A0] = a0, [_R_A1] = a1, [_R_A2] = a2, [_R_A3] = a3,
                [_R_RA] = ra,
        };
-#ifdef DDB
-       db_expr_t diff;
-       db_sym_t sym;
-#endif
 
 /* Jump here when done with a frame, to start a new one */
 loop:
@@ -322,8 +318,11 @@
                goto done;
        }
 
-#ifdef DDB
+#if defined(DDB) && defined(_KERNEL)
        if (ksyms_available()) {
+               db_expr_t diff;
+               db_sym_t sym;
+
                /*
                 * Check the kernel symbol table to see the beginning of
                 * the current subroutine.
@@ -348,7 +347,7 @@
                }
                va = pc - diff;
        } else {
-#endif /* DDB */
+#endif /* DDB && _KERNEL */
                /*
                 * Find the beginning of the current subroutine by
                 * scanning backwards from the current PC for the end
@@ -362,8 +361,10 @@
                va = pc;
                do {
                        va -= sizeof(int);
+#ifdef _KERNEL /* XXX crash */
                        if (va <= (vaddr_t)verylocore)
                                goto finish;
+#endif
                        if (!kdbpeek(va, &instr))
                                return;
                        if (instr == MIPS_ERET)
@@ -380,9 +381,9 @@
                                return;
                        va += sizeof(int);
                }
-#ifdef DDB
+#if defined(DDB) && defined(_KERNEL)
        }
-#endif /* DDB */
+#endif /* DDB && _KERNEL */
        subr = va;
 
        /* scan forwards to find stack size and any saved registers */



Home | Main Index | Thread Index | Old Index