summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-05-09 10:51:13 +0000
committerphk <phk@FreeBSD.org>1999-05-09 10:51:13 +0000
commite8f4fc4a1d3555ba5d3ce423b41c82b7fce94a63 (patch)
tree623bf04dc60f78005b62c8986b81469006615edb /sys
parente85d75ef71e87265d72acde0261bcc0bd8b5ad6f (diff)
downloadFreeBSD-src-e8f4fc4a1d3555ba5d3ce423b41c82b7fce94a63.zip
FreeBSD-src-e8f4fc4a1d3555ba5d3ce423b41c82b7fce94a63.tar.gz
add some amount of sanity to the way the gdb stuff finds its device.
I'm not too happy about the result either, but at least it has less chance of backfiring. This particular feature could be called "a mess" without offending anybody.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/amd64-gdbstub.c11
-rw-r--r--sys/ddb/db_command.c10
-rw-r--r--sys/ddb/ddb.h12
-rw-r--r--sys/dev/sio/sio.c19
-rw-r--r--sys/i386/i386/i386-gdbstub.c11
-rw-r--r--sys/isa/sio.c19
6 files changed, 42 insertions, 40 deletions
diff --git a/sys/amd64/amd64/amd64-gdbstub.c b/sys/amd64/amd64/amd64-gdbstub.c
index 59ff3a9..6564f47 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 f86ad2f..6e0e932 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 <sys/reboot.h>
#include <sys/systm.h>
+#include <machine/cons.h>
+
#include <ddb/ddb.h>
#include <ddb/db_command.h>
#include <ddb/db_lex.h>
@@ -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 dcce9b2..38bf3cb 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 77ea392..0f4cc01 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 <ddb/ddb.h>
+#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 59ff3a9..6564f47 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 77ea392..0f4cc01 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 <ddb/ddb.h>
+#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__
OpenPOWER on IntegriCloud