Improved DDB_UNATTENDED behaviour. From the submitter:
There's something that's been bugging me for a while, so I decided to fix it. FreeBSD now will DTRT WRT DDB and DDB_UNATTENDED (!debugger_on_panic), at least in my opinion. The behavior change is such that: 1. Nothing changes when debugger_on_panic != 0. 2. When DDB_UNATTENDED (!debugger_on_panic), if a panic occurs, the machine will reboot. Also, if a trap occurs, the machine will panic and reboot, unlike how it broke to DDB before. HOWEVER, a trap inside DDB will not cause a panic, allowing full use of DDB without having to worry about the machine being stuck at a DDB prompt if something goes wrong during the day. Patches for this behavior follow my signature, and it would be a boon to anyone (like me) who uses DDB_UNATTENDED, but actually wants the machine to panic on a trap (otherwise, what's the use, if the machine causes a fatal trap rather than a true panic, of debugger_on_panic?). The changes cause no adverse behavior, but do involve two symbols becoming global Submitted by: Brian Feldman <green@unixhelp.org>
This commit is contained in:
parent
a126617e33
commit
9959b1a882
@ -23,7 +23,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: db_interface.c,v 1.41 1998/06/08 09:23:24 dfr Exp $
|
||||
* $Id: db_interface.c,v 1.42 1998/12/14 05:34:33 dillon Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -295,11 +295,12 @@ db_write_bytes(addr, size, data)
|
||||
* Move this to machdep.c and allow it to be called if any debugger is
|
||||
* installed.
|
||||
*/
|
||||
volatile int in_Debugger = 0;
|
||||
|
||||
void
|
||||
Debugger(msg)
|
||||
const char *msg;
|
||||
{
|
||||
static volatile u_char in_Debugger;
|
||||
|
||||
/*
|
||||
* XXX
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
|
||||
* $Id: trap.c,v 1.130 1998/12/06 00:03:30 archie Exp $
|
||||
* $Id: trap.c,v 1.131 1998/12/16 15:21:50 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -93,6 +93,10 @@
|
||||
#include <machine/vm86.h>
|
||||
#endif
|
||||
|
||||
#ifdef DDB
|
||||
extern int in_Debugger, debugger_on_panic;
|
||||
#endif
|
||||
|
||||
#include "isa.h"
|
||||
#include "npx.h"
|
||||
|
||||
@ -901,7 +905,7 @@ trap_fatal(frame, eva)
|
||||
return;
|
||||
#endif
|
||||
#ifdef DDB
|
||||
if (kdb_trap (type, 0, frame))
|
||||
if ((debugger_on_panic || in_Debugger) && kdb_trap(type, 0, frame))
|
||||
return;
|
||||
#endif
|
||||
printf("trap number = %d\n", type);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: db_interface.c,v 1.41 1998/06/08 09:23:24 dfr Exp $
|
||||
* $Id: db_interface.c,v 1.42 1998/12/14 05:34:33 dillon Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -295,11 +295,12 @@ db_write_bytes(addr, size, data)
|
||||
* Move this to machdep.c and allow it to be called if any debugger is
|
||||
* installed.
|
||||
*/
|
||||
volatile int in_Debugger = 0;
|
||||
|
||||
void
|
||||
Debugger(msg)
|
||||
const char *msg;
|
||||
{
|
||||
static volatile u_char in_Debugger;
|
||||
|
||||
/*
|
||||
* XXX
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
|
||||
* $Id: trap.c,v 1.130 1998/12/06 00:03:30 archie Exp $
|
||||
* $Id: trap.c,v 1.131 1998/12/16 15:21:50 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -93,6 +93,10 @@
|
||||
#include <machine/vm86.h>
|
||||
#endif
|
||||
|
||||
#ifdef DDB
|
||||
extern int in_Debugger, debugger_on_panic;
|
||||
#endif
|
||||
|
||||
#include "isa.h"
|
||||
#include "npx.h"
|
||||
|
||||
@ -901,7 +905,7 @@ trap_fatal(frame, eva)
|
||||
return;
|
||||
#endif
|
||||
#ifdef DDB
|
||||
if (kdb_trap (type, 0, frame))
|
||||
if ((debugger_on_panic || in_Debugger) && kdb_trap(type, 0, frame))
|
||||
return;
|
||||
#endif
|
||||
printf("trap number = %d\n", type);
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
|
||||
* $Id: kern_shutdown.c,v 1.42 1998/11/13 22:40:37 msmith Exp $
|
||||
* $Id: kern_shutdown.c,v 1.43 1998/12/04 22:54:51 archie Exp $
|
||||
*/
|
||||
|
||||
#include "opt_ddb.h"
|
||||
@ -80,9 +80,9 @@
|
||||
|
||||
#ifdef DDB
|
||||
#ifdef DDB_UNATTENDED
|
||||
static int debugger_on_panic = 0;
|
||||
int debugger_on_panic = 0;
|
||||
#else
|
||||
static int debugger_on_panic = 1;
|
||||
int debugger_on_panic = 1;
|
||||
#endif
|
||||
SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW,
|
||||
&debugger_on_panic, 0, "");
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
|
||||
* $Id: trap.c,v 1.130 1998/12/06 00:03:30 archie Exp $
|
||||
* $Id: trap.c,v 1.131 1998/12/16 15:21:50 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -93,6 +93,10 @@
|
||||
#include <machine/vm86.h>
|
||||
#endif
|
||||
|
||||
#ifdef DDB
|
||||
extern int in_Debugger, debugger_on_panic;
|
||||
#endif
|
||||
|
||||
#include "isa.h"
|
||||
#include "npx.h"
|
||||
|
||||
@ -901,7 +905,7 @@ trap_fatal(frame, eva)
|
||||
return;
|
||||
#endif
|
||||
#ifdef DDB
|
||||
if (kdb_trap (type, 0, frame))
|
||||
if ((debugger_on_panic || in_Debugger) && kdb_trap(type, 0, frame))
|
||||
return;
|
||||
#endif
|
||||
printf("trap number = %d\n", type);
|
||||
|
Loading…
Reference in New Issue
Block a user