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

This commit is contained in:
tsubai 2000-11-24 21:49:06 +00:00
parent d9a0883770
commit 4e01e6de8b
2 changed files with 41 additions and 3 deletions

View File

@ -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 @@ ddb_trap_glue(frame)
}
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;
}

View File

@ -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 @@ syscall_bad:
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");