Change "dev_t gdbdev" to "void *gdb_arg", some possible paths for GDB

will not have a dev_t.
This commit is contained in:
Poul-Henning Kamp 2003-02-16 19:22:21 +00:00
parent 25ef827219
commit 029f0b69a4
8 changed files with 30 additions and 30 deletions

View File

@ -153,18 +153,18 @@ strcpy (char *dst, const char *src)
static int static int
putDebugChar (int c) /* write a single character */ putDebugChar (int c) /* write a single character */
{ {
if (gdbdev == NODEV) if (gdb_arg == NULL)
return 0; return 0;
(*gdb_putc)(gdbdev, c); (*gdb_putc)(gdb_arg, c);
return 1; return 1;
} }
static int static int
getDebugChar (void) /* read and return a single char */ getDebugChar (void) /* read and return a single char */
{ {
if (gdbdev == NODEV) if (gdb_arg == NULL)
return -1; return -1;
return (*gdb_getc)(gdbdev); return (*gdb_getc)(gdb_arg);
} }
static const char hexchars[]="0123456789abcdef"; static const char hexchars[]="0123456789abcdef";
@ -625,7 +625,7 @@ gdb_handle_exception (db_regs_t *raw_regs, int type, int code)
while (1) while (1)
{ {
if (gdbdev == NODEV) /* somebody's removed it */ if (gdb_arg == NULL) /* somebody's removed it */
return; /* get out of here */ return; /* get out of here */
remcomOutBuffer[0] = 0; remcomOutBuffer[0] = 0;

View File

@ -146,18 +146,18 @@ strcpy (char *dst, const char *src)
static int static int
putDebugChar (int c) /* write a single character */ putDebugChar (int c) /* write a single character */
{ {
if (gdbdev == NODEV) if (gdb_arg == NULL)
return 0; return 0;
(*gdb_putc)(gdbdev, c); (*gdb_putc)(gdb_arg, c);
return 1; return 1;
} }
static int static int
getDebugChar (void) /* read and return a single char */ getDebugChar (void) /* read and return a single char */
{ {
if (gdbdev == NODEV) if (gdb_arg == NULL)
return -1; return -1;
return (*gdb_getc)(gdbdev); return (*gdb_getc)(gdb_arg);
} }
static const char hexchars[]="0123456789abcdef"; static const char hexchars[]="0123456789abcdef";
@ -487,7 +487,7 @@ gdb_handle_exception (db_regs_t *raw_regs, int type, int code)
while (1) while (1)
{ {
if (gdbdev == NODEV) if (gdb_arg == NULL)
return 1; /* somebody has removed the gdb device */ return 1; /* somebody has removed the gdb device */
remcomOutBuffer[0] = 0; remcomOutBuffer[0] = 0;

View File

@ -550,7 +550,7 @@ db_fncall(dummy1, dummy2, dummy3, dummy4)
/* Enter GDB remote protocol debugger on the next trap. */ /* Enter GDB remote protocol debugger on the next trap. */
dev_t gdbdev = NODEV; void *gdb_arg = NULL;
cn_getc_t *gdb_getc; cn_getc_t *gdb_getc;
cn_putc_t *gdb_putc; cn_putc_t *gdb_putc;
@ -562,7 +562,7 @@ db_gdb (dummy1, dummy2, dummy3, dummy4)
char * dummy4; char * dummy4;
{ {
if (gdbdev == NODEV) { if (gdb_arg == NULL) {
db_printf("No gdb port enabled. Set flag 0x80 on desired port\n"); db_printf("No gdb port enabled. Set flag 0x80 on desired port\n");
db_printf("in your configuration file (currently sio only).\n"); db_printf("in your configuration file (currently sio only).\n");
return; return;

View File

@ -161,7 +161,7 @@ struct command {
/* /*
* Routines to support GDB on an sio port. * Routines to support GDB on an sio port.
*/ */
extern dev_t gdbdev; extern void *gdb_arg;
extern cn_getc_t *gdb_getc; extern cn_getc_t *gdb_getc;
extern cn_putc_t *gdb_putc; extern cn_putc_t *gdb_putc;
#endif #endif

View File

@ -2982,7 +2982,7 @@ siocnprobe(cp)
siogdbiobase = iobase; siogdbiobase = iobase;
siogdbunit = unit; siogdbunit = unit;
#if DDB > 0 #if DDB > 0
gdbdev = makedev(CDEV_MAJOR, unit); gdb_arg = makedev(CDEV_MAJOR, unit);
gdb_getc = siocngetc; gdb_getc = siocngetc;
gdb_putc = siocnputc; gdb_putc = siocnputc;
#endif #endif
@ -2996,14 +2996,14 @@ siocnprobe(cp)
* If no gdb port has been specified, set it to be the console * If no gdb port has been specified, set it to be the console
* as some configuration files don't specify the gdb port. * as some configuration files don't specify the gdb port.
*/ */
if (gdbdev == NODEV && (boothowto & RB_GDB)) { if (gdb_arg == NULL && (boothowto & RB_GDB)) {
printf("Warning: no GDB port specified. Defaulting to sio%d.\n", printf("Warning: no GDB port specified. Defaulting to sio%d.\n",
siocnunit); siocnunit);
printf("Set flag 0x80 on desired GDB port in your\n"); printf("Set flag 0x80 on desired GDB port in your\n");
printf("configuration file (currently sio only).\n"); printf("configuration file (currently sio only).\n");
siogdbiobase = siocniobase; siogdbiobase = siocniobase;
siogdbunit = siocnunit; siogdbunit = siocnunit;
gdbdev = makedev(CDEV_MAJOR, siocnunit); gdb_arg = makedev(CDEV_MAJOR, siocnunit);
gdb_getc = siocngetc; gdb_getc = siocngetc;
gdb_putc = siocnputc; gdb_putc = siocnputc;
} }
@ -3090,7 +3090,7 @@ siogdbattach(port, speed)
printf("sio%d: gdb debugging port\n", unit); printf("sio%d: gdb debugging port\n", unit);
siogdbunit = unit; siogdbunit = unit;
#if DDB > 0 #if DDB > 0
gdbdev = makedev(CDEV_MAJOR, unit); gdb_arg = makedev(CDEV_MAJOR, unit);
gdb_getc = siocngetc; gdb_getc = siocngetc;
gdb_putc = siocnputc; gdb_putc = siocnputc;
#endif #endif

View File

@ -146,18 +146,18 @@ strcpy (char *dst, const char *src)
static int static int
putDebugChar (int c) /* write a single character */ putDebugChar (int c) /* write a single character */
{ {
if (gdbdev == NODEV) if (gdb_arg == NULL)
return 0; return 0;
(*gdb_putc)(gdbdev, c); (*gdb_putc)(gdb_arg, c);
return 1; return 1;
} }
static int static int
getDebugChar (void) /* read and return a single char */ getDebugChar (void) /* read and return a single char */
{ {
if (gdbdev == NODEV) if (gdb_arg == NULL)
return -1; return -1;
return (*gdb_getc)(gdbdev); return (*gdb_getc)(gdb_arg);
} }
static const char hexchars[]="0123456789abcdef"; static const char hexchars[]="0123456789abcdef";
@ -487,7 +487,7 @@ gdb_handle_exception (db_regs_t *raw_regs, int type, int code)
while (1) while (1)
{ {
if (gdbdev == NODEV) if (gdb_arg == NULL)
return 1; /* somebody has removed the gdb device */ return 1; /* somebody has removed the gdb device */
remcomOutBuffer[0] = 0; remcomOutBuffer[0] = 0;

View File

@ -4212,7 +4212,7 @@ siocnprobe(cp)
siogdbiobase = iobase; siogdbiobase = iobase;
siogdbunit = unit; siogdbunit = unit;
#if DDB > 0 #if DDB > 0
gdbdev = makedev(CDEV_MAJOR, unit); gdb_arg = makedev(CDEV_MAJOR, unit);
gdb_getc = siocngetc; gdb_getc = siocngetc;
gdb_putc = siocnputc; gdb_putc = siocnputc;
#endif #endif
@ -4226,14 +4226,14 @@ siocnprobe(cp)
* If no gdb port has been specified, set it to be the console * If no gdb port has been specified, set it to be the console
* as some configuration files don't specify the gdb port. * as some configuration files don't specify the gdb port.
*/ */
if (gdbdev == NODEV && (boothowto & RB_GDB)) { if (gdb_arg == NULL && (boothowto & RB_GDB)) {
printf("Warning: no GDB port specified. Defaulting to sio%d.\n", printf("Warning: no GDB port specified. Defaulting to sio%d.\n",
siocnunit); siocnunit);
printf("Set flag 0x80 on desired GDB port in your\n"); printf("Set flag 0x80 on desired GDB port in your\n");
printf("configuration file (currently sio only).\n"); printf("configuration file (currently sio only).\n");
siogdbiobase = siocniobase; siogdbiobase = siocniobase;
siogdbunit = siocnunit; siogdbunit = siocnunit;
gdbdev = makedev(CDEV_MAJOR, siocnunit); gdb_arg = makedev(CDEV_MAJOR, siocnunit);
gdb_getc = siocngetc; gdb_getc = siocngetc;
gdb_putc = siocnputc; gdb_putc = siocnputc;
} }
@ -4320,7 +4320,7 @@ siogdbattach(port, speed)
printf("sio%d: gdb debugging port\n", unit); printf("sio%d: gdb debugging port\n", unit);
siogdbunit = unit; siogdbunit = unit;
#if DDB > 0 #if DDB > 0
gdbdev = makedev(CDEV_MAJOR, unit); gdb_arg = makedev(CDEV_MAJOR, unit);
gdb_getc = siocngetc; gdb_getc = siocngetc;
gdb_putc = siocnputc; gdb_putc = siocnputc;
#endif #endif

View File

@ -4212,7 +4212,7 @@ siocnprobe(cp)
siogdbiobase = iobase; siogdbiobase = iobase;
siogdbunit = unit; siogdbunit = unit;
#if DDB > 0 #if DDB > 0
gdbdev = makedev(CDEV_MAJOR, unit); gdb_arg = makedev(CDEV_MAJOR, unit);
gdb_getc = siocngetc; gdb_getc = siocngetc;
gdb_putc = siocnputc; gdb_putc = siocnputc;
#endif #endif
@ -4226,14 +4226,14 @@ siocnprobe(cp)
* If no gdb port has been specified, set it to be the console * If no gdb port has been specified, set it to be the console
* as some configuration files don't specify the gdb port. * as some configuration files don't specify the gdb port.
*/ */
if (gdbdev == NODEV && (boothowto & RB_GDB)) { if (gdb_arg == NULL && (boothowto & RB_GDB)) {
printf("Warning: no GDB port specified. Defaulting to sio%d.\n", printf("Warning: no GDB port specified. Defaulting to sio%d.\n",
siocnunit); siocnunit);
printf("Set flag 0x80 on desired GDB port in your\n"); printf("Set flag 0x80 on desired GDB port in your\n");
printf("configuration file (currently sio only).\n"); printf("configuration file (currently sio only).\n");
siogdbiobase = siocniobase; siogdbiobase = siocniobase;
siogdbunit = siocnunit; siogdbunit = siocnunit;
gdbdev = makedev(CDEV_MAJOR, siocnunit); gdb_arg = makedev(CDEV_MAJOR, siocnunit);
gdb_getc = siocngetc; gdb_getc = siocngetc;
gdb_putc = siocnputc; gdb_putc = siocnputc;
} }
@ -4320,7 +4320,7 @@ siogdbattach(port, speed)
printf("sio%d: gdb debugging port\n", unit); printf("sio%d: gdb debugging port\n", unit);
siogdbunit = unit; siogdbunit = unit;
#if DDB > 0 #if DDB > 0
gdbdev = makedev(CDEV_MAJOR, unit); gdb_arg = makedev(CDEV_MAJOR, unit);
gdb_getc = siocngetc; gdb_getc = siocngetc;
gdb_putc = siocnputc; gdb_putc = siocnputc;
#endif #endif