Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/powerpc When fatal trap occurs, enter DDB w...



details:   https://anonhg.NetBSD.org/src/rev/3a90c9d3c1fa
branches:  trunk
changeset: 499620:3a90c9d3c1fa
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Fri Nov 24 21:49:06 2000 +0000

description:
When fatal trap occurs, enter DDB with trapframe rather than just "Debugger()".

diffstat:

 sys/arch/powerpc/powerpc/db_interface.c |  39 ++++++++++++++++++++++++++++++++-
 sys/arch/powerpc/powerpc/trap.c         |   5 ++-
 2 files changed, 41 insertions(+), 3 deletions(-)

diffs (76 lines):

diff -r 713e6897bc88 -r 3a90c9d3c1fa sys/arch/powerpc/powerpc/db_interface.c
--- a/sys/arch/powerpc/powerpc/db_interface.c   Fri Nov 24 21:38:28 2000 +0000
+++ b/sys/arch/powerpc/powerpc/db_interface.c   Fri Nov 24 21:49:06 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.7 2000/06/11 10:02:15 tsubai Exp $ */
+/*     $NetBSD: db_interface.c,v 1.8 2000/11/24 21:49:06 tsubai Exp $ */
 /*     $OpenBSD: db_interface.c,v 1.2 1996/12/28 06:21:50 rahnds Exp $ */
 
 #include "opt_ddb.h"
@@ -17,6 +17,8 @@
 #include <ddb/db_output.h>
 #include <ddb/ddbvar.h>
 
+extern label_t *db_recover;
+
 void
 cpu_Debugger()
 {
@@ -47,3 +49,38 @@
        }
        return 0;
 }
+
+int
+kdb_trap(type, v)
+       int type;
+       void *v;
+{
+       struct trapframe *frame = v;
+
+       switch (type) {
+       case T_BREAKPOINT:
+       case -1:
+               break;
+       default:
+               if (!db_onpanic && db_recover == 0)
+                       return 0;
+               if (db_recover != 0) {
+                       db_error("Faulted in DDB; continuing...\n");
+                       /*NOTREACHED*/
+               }
+       }
+
+       /* XXX Should switch to kdb's own stack here. */
+
+       bcopy(frame->fixreg, DDB_REGS->r, 32 * sizeof(u_int32_t));
+       DDB_REGS->iar = frame->srr0;
+       DDB_REGS->msr = frame->srr1;
+
+       db_trap(T_BREAKPOINT, 0);
+
+       bcopy(DDB_REGS->r, frame->fixreg, 32 * sizeof(u_int32_t));
+       frame->srr0 = DDB_REGS->iar;
+       frame->srr1 = DDB_REGS->msr;
+
+       return 1;
+}
diff -r 713e6897bc88 -r 3a90c9d3c1fa sys/arch/powerpc/powerpc/trap.c
--- a/sys/arch/powerpc/powerpc/trap.c   Fri Nov 24 21:38:28 2000 +0000
+++ b/sys/arch/powerpc/powerpc/trap.c   Fri Nov 24 21:49:06 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.29 2000/11/22 14:00:46 tsubai Exp $ */
+/*     $NetBSD: trap.c,v 1.30 2000/11/24 21:49:06 tsubai Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -295,7 +295,8 @@
 brain_damage:
                printf("trap type %x at %x\n", type, frame->srr0);
 #ifdef DDB
-               Debugger();                      /* XXX temporarily */
+               if (kdb_trap(type, frame))
+                       return;
 #endif
 #ifdef TRAP_PANICWAIT
                printf("Press a key to panic.\n");



Home | Main Index | Thread Index | Old Index