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.
This commit is contained in:
parent
e85d75ef71
commit
e8f4fc4a1d
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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_ */
|
||||
|
@ -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__
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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__
|
||||
|
Loading…
Reference in New Issue
Block a user