diff --git a/sys/amd64/amd64/amd64-gdbstub.c b/sys/amd64/amd64/amd64-gdbstub.c index 59ff3a999b8..6564f478ae7 100644 --- a/sys/amd64/amd64/amd64-gdbstub.c +++ b/sys/amd64/amd64/amd64-gdbstub.c @@ -150,17 +150,10 @@ strcpy (char *dst, const char *src) return retval; } -/* - * These are set up by the serial card that is configured to be the gdb port. - */ -dev_t gdbdev = -1; -cn_getc_t *gdb_getc; -cn_putc_t *gdb_putc; - static int putDebugChar (int c) /* write a single character */ { - if (gdbdev == -1) + if (gdbdev == NODEV) return 0; (*gdb_putc)(gdbdev, c); return 1; @@ -169,7 +162,7 @@ putDebugChar (int c) /* write a single character */ static int getDebugChar (void) /* read and return a single char */ { - if (gdbdev == -1) + if (gdbdev == NODEV) return -1; return (*gdb_getc)(gdbdev); } diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index f86ad2f923b..6e0e9325d9b 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_command.c,v 1.29 1999/01/14 06:22:01 jdp Exp $ + * $Id: db_command.c,v 1.30 1999/05/07 23:08:23 mckusick Exp $ */ /* @@ -39,6 +39,8 @@ #include #include +#include + #include #include #include @@ -535,7 +537,9 @@ db_fncall(dummy1, dummy2, dummy3, dummy4) /* Enter GDB remote protocol debugger on the next trap. */ -dev_t gdbdev; +dev_t gdbdev = NODEV; +cn_getc_t *gdb_getc; +cn_putc_t *gdb_putc; static void db_gdb (dummy1, dummy2, dummy3, dummy4) @@ -545,7 +549,7 @@ db_gdb (dummy1, dummy2, dummy3, dummy4) char * dummy4; { - if (gdbdev == -1) { + if (gdbdev == NODEV) { db_printf("No gdb port enabled. Set flag 0x80 on desired port\n"); db_printf("in your configuration file (currently sio only).\n"); return; diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h index dcce9b2c834..38bf3cb8a14 100644 --- a/sys/ddb/ddb.h +++ b/sys/ddb/ddb.h @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ddb.h,v 1.20 1998/07/13 06:45:23 bde Exp $ + * $Id: ddb.h,v 1.21 1999/01/27 19:00:49 dillon Exp $ */ /* @@ -145,4 +145,14 @@ struct command { struct command *more; /* another level of command */ }; +/* XXX: UGLY hack */ +#ifdef CN_DEAD +/* + * Routines to support GDB on an sio port. + */ +extern dev_t gdbdev; +extern cn_getc_t *gdb_getc; +extern cn_putc_t *gdb_putc; +#endif + #endif /* !_DDB_DDB_H_ */ diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 77ea392c5cf..0f4cc0131c6 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.234 1999/05/08 21:59:30 dfr Exp $ + * $Id: sio.c,v 1.235 1999/05/09 10:28:50 phk Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -2639,13 +2639,10 @@ static cn_putc_t siocnputc; CONS_DRIVER(sio, siocnprobe, siocninit, siocngetc, siocncheckc, siocnputc); -/* - * Routines to support GDB on an sio port. - */ -dev_t gdbdev; -cn_getc_t *gdb_getc; -cn_putc_t *gdb_putc; - +/* To get the GDB related variables */ +#if DDB > 0 +#include +#endif #endif static void @@ -2848,20 +2845,23 @@ siocnprobe(cp) siogdbiobase = iobase; siogdbunit = unit; #ifdef __i386__ +#if DDB > 0 gdbdev = makedev(CDEV_MAJOR, unit); gdb_getc = siocngetc; gdb_putc = siocnputc; +#endif #endif } } } #ifdef __i386__ +#if DDB > 0 /* * XXX Ugly Compatability. * If no gdb port has been specified, set it to be the console * as some configuration files don't specify the gdb port. */ - if (gdbdev == -1 && (boothowto & RB_GDB)) { + if (gdbdev == NODEV && (boothowto & RB_GDB)) { printf("Warning: no GDB port specified. Defaulting to sio%d.\n", siocnunit); printf("Set flag 0x80 on desired GDB port in your\n"); @@ -2873,6 +2873,7 @@ siocnprobe(cp) gdb_putc = siocnputc; } #endif +#endif } #ifdef __alpha__ diff --git a/sys/i386/i386/i386-gdbstub.c b/sys/i386/i386/i386-gdbstub.c index 59ff3a999b8..6564f478ae7 100644 --- a/sys/i386/i386/i386-gdbstub.c +++ b/sys/i386/i386/i386-gdbstub.c @@ -150,17 +150,10 @@ strcpy (char *dst, const char *src) return retval; } -/* - * These are set up by the serial card that is configured to be the gdb port. - */ -dev_t gdbdev = -1; -cn_getc_t *gdb_getc; -cn_putc_t *gdb_putc; - static int putDebugChar (int c) /* write a single character */ { - if (gdbdev == -1) + if (gdbdev == NODEV) return 0; (*gdb_putc)(gdbdev, c); return 1; @@ -169,7 +162,7 @@ putDebugChar (int c) /* write a single character */ static int getDebugChar (void) /* read and return a single char */ { - if (gdbdev == -1) + if (gdbdev == NODEV) return -1; return (*gdb_getc)(gdbdev); } diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 77ea392c5cf..0f4cc0131c6 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.234 1999/05/08 21:59:30 dfr Exp $ + * $Id: sio.c,v 1.235 1999/05/09 10:28:50 phk Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -2639,13 +2639,10 @@ static cn_putc_t siocnputc; CONS_DRIVER(sio, siocnprobe, siocninit, siocngetc, siocncheckc, siocnputc); -/* - * Routines to support GDB on an sio port. - */ -dev_t gdbdev; -cn_getc_t *gdb_getc; -cn_putc_t *gdb_putc; - +/* To get the GDB related variables */ +#if DDB > 0 +#include +#endif #endif static void @@ -2848,20 +2845,23 @@ siocnprobe(cp) siogdbiobase = iobase; siogdbunit = unit; #ifdef __i386__ +#if DDB > 0 gdbdev = makedev(CDEV_MAJOR, unit); gdb_getc = siocngetc; gdb_putc = siocnputc; +#endif #endif } } } #ifdef __i386__ +#if DDB > 0 /* * XXX Ugly Compatability. * If no gdb port has been specified, set it to be the console * as some configuration files don't specify the gdb port. */ - if (gdbdev == -1 && (boothowto & RB_GDB)) { + if (gdbdev == NODEV && (boothowto & RB_GDB)) { printf("Warning: no GDB port specified. Defaulting to sio%d.\n", siocnunit); printf("Set flag 0x80 on desired GDB port in your\n"); @@ -2873,6 +2873,7 @@ siocnprobe(cp) gdb_putc = siocnputc; } #endif +#endif } #ifdef __alpha__