summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-02-05 16:49:41 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-02-05 16:49:41 +0000
commitbfb1b6126bcfdf842489313cd93b5e5a43512f3e (patch)
tree2a75a348bbc797d52960b5f52b7354f90cec7753
parentfe9553578b983f487fcb86562db0ab1434df2949 (diff)
rename ddb.panic_ddb, and add ddb.console. Now you can stop console ddb entry
with a sysctl. There will be architectures and drivers that lack function, and I trust the maintainers of those will forget to add the code..
-rw-r--r--sbin/sysctl/sysctl.85
-rw-r--r--sys/arch/alpha/isa/pckbd.c8
-rw-r--r--sys/arch/hp300/hp300/machdep.c9
-rw-r--r--sys/arch/i386/isa/pccom.c8
-rw-r--r--sys/arch/i386/isa/pccons.c16
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_hdr.h5
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_kbd.c5
-rw-r--r--sys/arch/sparc/dev/zs.c5
-rw-r--r--sys/ddb/db_usrreq.c8
-rw-r--r--sys/ddb/db_var.h13
-rw-r--r--sys/dev/ic/com.c8
-rw-r--r--sys/kern/subr_prf.c7
-rw-r--r--usr.sbin/sysctl/sysctl.85
13 files changed, 66 insertions, 36 deletions
diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8
index 6d6a78d2dfa..d5163aadba3 100644
--- a/sbin/sysctl/sysctl.8
+++ b/sbin/sysctl/sysctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.8,v 1.14 1998/01/31 19:40:00 millert Exp $
+.\" $OpenBSD: sysctl.8,v 1.15 1998/02/05 16:49:40 deraadt Exp $
.\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $
.\"
.\" Copyright (c) 1993
@@ -200,7 +200,8 @@ privilege can change the value.
.It ddb.max_width integer yes
.It ddb.max_line integer yes
.It ddb.tab_stop_width integer yes
-.It ddb.panic_ddb integer yes
+.It ddb.panic integer yes
+.It ddb.console integer yes
.El
.Sh EXAMPLES
.Pp
diff --git a/sys/arch/alpha/isa/pckbd.c b/sys/arch/alpha/isa/pckbd.c
index 8a6770235fb..49e337acae7 100644
--- a/sys/arch/alpha/isa/pckbd.c
+++ b/sys/arch/alpha/isa/pckbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pckbd.c,v 1.12 1997/11/06 12:27:02 niklas Exp $ */
+/* $OpenBSD: pckbd.c,v 1.13 1998/02/05 16:47:59 deraadt Exp $ */
/* $NetBSD: pckbd.c,v 1.14 1996/12/05 01:39:30 cgd Exp $ */
/*-
@@ -757,9 +757,9 @@ pckbd_translate(dev, c)
/*
* Check for cntl-alt-esc.
*/
- if ((dt == 1)
- && (shift_state & (CTL | ALT)) == (CTL | ALT)) {
- Debugger();
+ if ((dt == 1) && (shift_state & (CTL | ALT)) == (CTL | ALT)) {
+ if (db_console)
+ Debugger();
return (NULL);
}
#endif
diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c
index 9d049a4f12e..35bb71e3209 100644
--- a/sys/arch/hp300/hp300/machdep.c
+++ b/sys/arch/hp300/hp300/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.28 1997/11/06 19:42:37 millert Exp $ */
+/* $OpenBSD: machdep.c,v 1.29 1998/02/05 16:48:22 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.94 1997/06/12 15:46:29 mrg Exp $ */
/*
@@ -1024,8 +1024,11 @@ nmihand(frame)
* - Ignore it.
*/
#ifdef DDB
- printf(": entering debugger\n");
- Debugger();
+ if (db_console) {
+ printf(": entering debugger\n");
+ Debugger();
+ } else
+ printf("\n");
#else
#ifdef PANICBUTTON
if (panicbutton) {
diff --git a/sys/arch/i386/isa/pccom.c b/sys/arch/i386/isa/pccom.c
index c8f231478b4..c315ad126aa 100644
--- a/sys/arch/i386/isa/pccom.c
+++ b/sys/arch/i386/isa/pccom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccom.c,v 1.19 1998/02/02 22:21:20 deraadt Exp $ */
+/* $OpenBSD: pccom.c,v 1.20 1998/02/05 16:48:28 deraadt Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*-
@@ -67,6 +67,9 @@
#include <dev/ic/hayespreg.h>
#endif
#define com_lcr com_cfcr
+#ifdef DDB
+#include <ddb/db_var.h>
+#endif
#include "pccomvar.h"
#include "pccom.h"
@@ -1477,7 +1480,8 @@ comsoft()
if (ISSET(lsr, LSR_BI)) {
#ifdef DDB
if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) {
- Debugger();
+ if (db_console)
+ Debugger();
rxget = (rxget + 1) & RBUFMASK;
continue;
}
diff --git a/sys/arch/i386/isa/pccons.c b/sys/arch/i386/isa/pccons.c
index 49f1a807578..9707c0a023d 100644
--- a/sys/arch/i386/isa/pccons.c
+++ b/sys/arch/i386/isa/pccons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccons.c,v 1.36 1997/11/06 02:26:45 deraadt Exp $ */
+/* $OpenBSD: pccons.c,v 1.37 1998/02/05 16:48:30 deraadt Exp $ */
/* $NetBSD: pccons.c,v 1.99.4.1 1996/06/04 20:03:53 cgd Exp $ */
/*-
@@ -57,6 +57,9 @@
#include <sys/kernel.h>
#include <sys/syslog.h>
#include <sys/device.h>
+#ifdef DDB
+#include <ddb/db_var.h>
+#endif
#include <dev/cons.h>
@@ -1678,8 +1681,9 @@ top:
if (pc_xmode > 0) {
#if defined(DDB) && defined(XSERVER_DDB)
/* F12 enters the debugger while in X mode */
- if (dt == 88)
- Debugger();
+ if (dt == 88 && db_console)
+ if (db_console)
+ Debugger();
#endif
capchar[0] = dt;
capchar[1] = 0;
@@ -1740,9 +1744,11 @@ top:
/*
* Check for cntl-alt-esc.
*/
- if ((dt == 1) && (shift_state & (KB_CTL | KB_ALT)) == (KB_CTL | KB_ALT)) {
+ if (db_console && dt == 1 &&
+ (shift_state & (KB_CTL | KB_ALT)) == (KB_CTL | KB_ALT)) {
screen_restore(1);
- Debugger();
+ if (db_console)
+ Debugger();
dt |= 0x80; /* discard esc (ddb discarded ctl-alt) */
}
#endif
diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h
index 005318131c3..d2277444682 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_hdr.h
+++ b/sys/arch/i386/isa/pcvt/pcvt_hdr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcvt_hdr.h,v 1.17 1998/01/11 06:15:34 deraadt Exp $ */
+/* $OpenBSD: pcvt_hdr.h,v 1.18 1998/02/05 16:48:32 deraadt Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
@@ -88,6 +88,9 @@
#include <sys/syslog.h>
#include <sys/malloc.h>
#include <sys/time.h>
+#ifdef DDB
+#include <ddb/db_var.h>
+#endif
#include "pcvt_conf.h"
diff --git a/sys/arch/i386/isa/pcvt/pcvt_kbd.c b/sys/arch/i386/isa/pcvt/pcvt_kbd.c
index fe955ed9067..81ced849440 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_kbd.c
+++ b/sys/arch/i386/isa/pcvt/pcvt_kbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcvt_kbd.c,v 1.12 1998/01/11 06:15:35 deraadt Exp $ */
+/* $OpenBSD: pcvt_kbd.c,v 1.13 1998/02/05 16:48:34 deraadt Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
@@ -1437,7 +1437,8 @@ regular:
/* the string is actually not used... */
Debugger("kbd");
#else
- Debugger();
+ if (db_console)
+ Debugger();
#endif
in_Debugger = 0;
if(noblock)
diff --git a/sys/arch/sparc/dev/zs.c b/sys/arch/sparc/dev/zs.c
index 96e095c2854..8998834db13 100644
--- a/sys/arch/sparc/dev/zs.c
+++ b/sys/arch/sparc/dev/zs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zs.c,v 1.17 1997/09/17 06:47:12 downsj Exp $ */
+/* $OpenBSD: zs.c,v 1.18 1998/02/05 16:49:09 deraadt Exp $ */
/* $NetBSD: zs.c,v 1.49 1997/08/31 21:26:37 pk Exp $ */
/*
@@ -1021,7 +1021,8 @@ zsabort(unit)
#if defined(KGDB)
zskgdb(unit);
#elif defined(DDB)
- Debugger();
+ if (db_console)
+ Debugger();
#else
printf("stopping on keyboard abort\n");
callrom();
diff --git a/sys/ddb/db_usrreq.c b/sys/ddb/db_usrreq.c
index a303f9243ad..52f73fa22da 100644
--- a/sys/ddb/db_usrreq.c
+++ b/sys/ddb/db_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_usrreq.c,v 1.2 1997/12/29 14:31:19 deraadt Exp $ */
+/* $OpenBSD: db_usrreq.c,v 1.3 1998/02/05 16:49:22 deraadt Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff. All rights reserved.
@@ -62,8 +62,10 @@ ddb_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return sysctl_int(oldp, oldlenp, newp, newlen, &db_tab_stop_width);
case DBCTL_MAXLINE:
return sysctl_int(oldp, oldlenp, newp, newlen, &db_max_line);
- case DBCTL_PANICDDB:
- return sysctl_int(oldp, oldlenp, newp, newlen, &db_panic_ddb);
+ case DBCTL_PANIC:
+ return sysctl_int(oldp, oldlenp, newp, newlen, &db_panic);
+ case DBCTL_CONSOLE:
+ return sysctl_int(oldp, oldlenp, newp, newlen, &db_console);
default:
return (EOPNOTSUPP);
}
diff --git a/sys/ddb/db_var.h b/sys/ddb/db_var.h
index ab3ad37a531..987b4e6a880 100644
--- a/sys/ddb/db_var.h
+++ b/sys/ddb/db_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_var.h,v 1.3 1997/12/29 14:31:19 deraadt Exp $ */
+/* $OpenBSD: db_var.h,v 1.4 1998/02/05 16:49:23 deraadt Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff. All rights reserved.
@@ -44,8 +44,9 @@
#define DBCTL_MAXWIDTH 2
#define DBCTL_MAXLINE 3
#define DBCTL_TABSTOP 4
-#define DBCTL_PANICDDB 5
-#define DBCTL_MAXID 6
+#define DBCTL_PANIC 5
+#define DBCTL_CONSOLE 6
+#define DBCTL_MAXID 7
#define CTL_DDB_NAMES { \
{ NULL, 0 }, \
@@ -53,7 +54,8 @@
{ "max_width", CTLTYPE_INT }, \
{ "max_line", CTLTYPE_INT }, \
{ "tab_stop_width", CTLTYPE_INT },\
- { "panic_ddb", CTLTYPE_INT }, \
+ { "panic", CTLTYPE_INT }, \
+ { "console", CTLTYPE_INT }, \
}
#ifdef _KERNEL
@@ -62,7 +64,8 @@ extern int db_radix;
extern int db_max_width;
extern int db_tab_stop_width;
extern int db_max_line;
-extern int db_panic_ddb;
+extern int db_panic;
+extern int db_console;
int ddb_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index 2a41167100f..65846062d83 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com.c,v 1.36 1997/09/03 20:55:28 deraadt Exp $ */
+/* $OpenBSD: com.c,v 1.37 1998/02/05 16:49:24 deraadt Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*-
@@ -56,6 +56,9 @@
#include <sys/syslog.h>
#include <sys/types.h>
#include <sys/device.h>
+#ifdef DDB
+#include <ddb/db_var.h>
+#endif
#include <machine/bus.h>
#include <machine/intr.h>
@@ -1324,7 +1327,8 @@ comintr(arg)
#ifdef DDB
if (ISSET(sc->sc_hwflags,
COM_HW_CONSOLE)) {
- Debugger();
+ if (db_console)
+ Debugger();
goto next;
}
#endif
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index bd710c7dcb3..a0c547a82a8 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_prf.c,v 1.21 1998/01/24 17:54:07 niklas Exp $ */
+/* $OpenBSD: subr_prf.c,v 1.22 1998/02/05 16:49:29 deraadt Exp $ */
/* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */
/*-
@@ -109,7 +109,8 @@ extern int log_open; /* subr_log: is /dev/klog open? */
const char *panicstr; /* arg to first call to panic (used as a flag
to indicate that panic has already been called). */
#ifdef DDB
-int db_panic_ddb = 1;
+int db_panic = 1;
+int db_console = 1;
#endif
/*
@@ -195,7 +196,7 @@ panic(fmt, va_alist)
kdbpanic();
#endif
#ifdef DDB
- if (db_panic_ddb)
+ if (db_panic)
Debugger();
#endif
boot(bootopt);
diff --git a/usr.sbin/sysctl/sysctl.8 b/usr.sbin/sysctl/sysctl.8
index 6d6a78d2dfa..d5163aadba3 100644
--- a/usr.sbin/sysctl/sysctl.8
+++ b/usr.sbin/sysctl/sysctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.8,v 1.14 1998/01/31 19:40:00 millert Exp $
+.\" $OpenBSD: sysctl.8,v 1.15 1998/02/05 16:49:40 deraadt Exp $
.\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $
.\"
.\" Copyright (c) 1993
@@ -200,7 +200,8 @@ privilege can change the value.
.It ddb.max_width integer yes
.It ddb.max_line integer yes
.It ddb.tab_stop_width integer yes
-.It ddb.panic_ddb integer yes
+.It ddb.panic integer yes
+.It ddb.console integer yes
.El
.Sh EXAMPLES
.Pp