aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/dcons
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2004-07-10 21:02:17 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2004-07-10 21:02:17 +0000
commited9c21cd7413daddd3cc9d3f07622491bb9e70ba (patch)
tree41a258c0f5c1916767a58a5cbaed000717d00651 /sys/dev/dcons
parenta0eb4d1051a55f0a99091e0311c09b4f4d939f1c (diff)
Update for the KDB framework:
o Use kdb_alt_break() to handle the alternate break sequence instead of handcoding it here. o Remove GDB kluges to make this driver work with the pre-KDB remote GDB code. o Call kdb_enter() instead of Debugger(). Note that with this commit the dcons(4) driver cannot be used for remote debugging anymore. This driver has to use the new GDB debug port interface instead. Such has not been done yet.
Notes
svn path=/head/; revision=131912
Diffstat (limited to 'sys/dev/dcons')
-rw-r--r--sys/dev/dcons/dcons.c53
1 files changed, 4 insertions, 49 deletions
diff --git a/sys/dev/dcons/dcons.c b/sys/dev/dcons/dcons.c
index c1b320d797a8..02216223872f 100644
--- a/sys/dev/dcons/dcons.c
+++ b/sys/dev/dcons/dcons.c
@@ -36,6 +36,7 @@
*/
#include <sys/param.h>
+#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/systm.h>
@@ -73,13 +74,8 @@
#define DCONS_FORCE_CONSOLE 0 /* mostly for FreeBSD-4 */
#endif
-#ifndef DCONS_FORCE_GDB
-#define DCONS_FORCE_GDB 1
-#endif
-
#if __FreeBSD_version >= 500101
#define CONS_NODEV 1 /* for latest current */
-static struct consdev gdbconsdev;
#endif
@@ -132,7 +128,6 @@ static struct dcons_softc {
struct cdev *dev;
struct dcons_ch o, i;
int brk_state;
-#define DC_GDB 1
int flags;
} sc[DCONS_NPORT];
static void dcons_tty_start(struct tty *);
@@ -373,26 +368,9 @@ dcons_checkc(struct dcons_softc *dc)
ch->pos = 0;
}
-#if DDB && ALT_BREAK_TO_DEBUGGER
- switch (dc->brk_state) {
- case STATE1:
- if (c == KEY_TILDE)
- dc->brk_state = STATE2;
- else
- dc->brk_state = STATE0;
- break;
- case STATE2:
- dc->brk_state = STATE0;
- if (c == KEY_CTRLB) {
-#if DCONS_FORCE_GDB
- if (dc->flags & DC_GDB)
- boothowto |= RB_GDB;
-#endif
- breakpoint();
- }
- }
- if (c == KEY_CR)
- dc->brk_state = STATE1;
+#if KDB && ALT_BREAK_TO_DEBUGGER
+ if (kdb_alt_break(c, &dc->brk_state))
+ breakpoint();
#endif
return (c);
}
@@ -486,20 +464,6 @@ dcons_drv_init(int stage)
dcons_init_port(1, offset, size - size0);
dg.buf->version = htonl(DCONS_VERSION);
dg.buf->magic = ntohl(DCONS_MAGIC);
-
-#if DDB && DCONS_FORCE_GDB
-#if CONS_NODEV
- gdbconsdev.cn_arg = (void *)&sc[DCONS_GDB];
-#if __FreeBSD_version >= 501109
- sprintf(gdbconsdev.cn_name, "dgdb");
-#endif
- gdb_arg = &gdbconsdev;
-#else
- gdbdev = makedev(CDEV_MAJOR, DCONS_GDB);
-#endif
- gdb_getc = dcons_cngetc;
- gdb_putc = dcons_cnputc;
-#endif
drv_init = 1;
return 0;
@@ -535,7 +499,6 @@ dcons_attach(void)
int polltime;
dcons_attach_port(DCONS_CON, "dcons", 0);
- dcons_attach_port(DCONS_GDB, "dgdb", DC_GDB);
#if __FreeBSD_version < 500000
callout_init(&dcons_callout);
#else
@@ -594,18 +557,10 @@ dcons_modevent(module_t mode, int type, void *data)
case MOD_UNLOAD:
printf("dcons: unload\n");
callout_stop(&dcons_callout);
-#if DDB && DCONS_FORCE_GDB
-#if CONS_NODEV
- gdb_arg = NULL;
-#else
- gdbdev = NULL;
-#endif
-#endif
#if __FreeBSD_version >= 500000
cnremove(&dcons_consdev);
#endif
dcons_detach(DCONS_CON);
- dcons_detach(DCONS_GDB);
dg.buf->magic = 0;
contigfree(dg.buf, DCONS_BUF_SIZE, M_DEVBUF);