From c91d7e25fd9b50c70c26be54bd0d625c4179a2a9 Mon Sep 17 00:00:00 2001 From: pst Date: Wed, 4 Jun 1997 16:44:29 +0000 Subject: Document a non-standard gdbremote protocol extension (kludge, really) that I snuck in to our GDB last year. This allows you to debug headless machines by sharing the console port between the debugger and the system console. It's not 100% reliabile, but it works well. It's optional and disabled by default. Submitted by: Juniper Networks --- sys/amd64/amd64/amd64-gdbstub.c | 14 ++++++++++++++ sys/conf/NOTES | 11 ++++++++++- sys/conf/options | 3 ++- sys/i386/conf/LINT | 11 ++++++++++- sys/i386/conf/NOTES | 11 ++++++++++- sys/i386/i386/i386-gdbstub.c | 14 ++++++++++++++ 6 files changed, 60 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/amd64-gdbstub.c b/sys/amd64/amd64/amd64-gdbstub.c index e019fef..dac5f3e 100644 --- a/sys/amd64/amd64/amd64-gdbstub.c +++ b/sys/amd64/amd64/amd64-gdbstub.c @@ -103,6 +103,7 @@ #include #include "sio.h" +#include "opt_ddb.h" #if NSIO == 0 void @@ -250,6 +251,19 @@ putpacket (char *buffer) /* $#. */ do { +/* + * This is a non-standard hack to allow use of the serial console for + * operation as well as debugging. Simply turn on 'remotechat' in gdb. + * + * This extension is not part of the Cygnus protocol, is kinda gross, + * but gets the job done. + */ +#ifdef GDB_REMOTE_CHAT + putDebugChar ('|'); + putDebugChar ('|'); + putDebugChar ('|'); + putDebugChar ('|'); +#endif putDebugChar ('$'); checksum = 0; count = 0; diff --git a/sys/conf/NOTES b/sys/conf/NOTES index e4ba034..2202011 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2,7 +2,7 @@ # LINT -- config file for checking all the sources, tries to pull in # as much of the source tree as it can. # -# $Id: LINT,v 1.341 1997/06/04 04:55:26 pst Exp $ +# $Id: LINT,v 1.342 1997/06/04 16:25:05 pst Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from @@ -256,6 +256,15 @@ options DDB # options DDB_UNATTENDED +# +# If using GDB remote mode to debug the kernel, there's a non-standard +# extension to the remote protocol that can be used to use the serial +# port as both the debugging port and the system console. It's non- +# standard and you're on your own if you enable it. See also the +# "remotechat" variables in the FreeBSD specific version of gdb. +# +options GDB_REMOTE_CHAT + # # KTRACE enables the system-call tracing facility ktrace(2). # diff --git a/sys/conf/options b/sys/conf/options index ff394b4..62cf779 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1,4 +1,4 @@ -# $Id: options,v 1.29 1997/02/22 09:28:14 peter Exp $ +# $Id: options,v 1.30 1997/05/04 15:24:13 joerg Exp $ # Format: # Option name filename @@ -7,6 +7,7 @@ BOUNCE_BUFFERS opt_bounce.h DDB DDB_UNATTENDED opt_ddb.h +GDB_REMOTE_CHAT opt_ddb.h DEVFS_ROOT opt_devfs.h KTRACE QUOTA diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT index e4ba034..2202011 100644 --- a/sys/i386/conf/LINT +++ b/sys/i386/conf/LINT @@ -2,7 +2,7 @@ # LINT -- config file for checking all the sources, tries to pull in # as much of the source tree as it can. # -# $Id: LINT,v 1.341 1997/06/04 04:55:26 pst Exp $ +# $Id: LINT,v 1.342 1997/06/04 16:25:05 pst Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from @@ -256,6 +256,15 @@ options DDB # options DDB_UNATTENDED +# +# If using GDB remote mode to debug the kernel, there's a non-standard +# extension to the remote protocol that can be used to use the serial +# port as both the debugging port and the system console. It's non- +# standard and you're on your own if you enable it. See also the +# "remotechat" variables in the FreeBSD specific version of gdb. +# +options GDB_REMOTE_CHAT + # # KTRACE enables the system-call tracing facility ktrace(2). # diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index e4ba034..2202011 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -2,7 +2,7 @@ # LINT -- config file for checking all the sources, tries to pull in # as much of the source tree as it can. # -# $Id: LINT,v 1.341 1997/06/04 04:55:26 pst Exp $ +# $Id: LINT,v 1.342 1997/06/04 16:25:05 pst Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from @@ -256,6 +256,15 @@ options DDB # options DDB_UNATTENDED +# +# If using GDB remote mode to debug the kernel, there's a non-standard +# extension to the remote protocol that can be used to use the serial +# port as both the debugging port and the system console. It's non- +# standard and you're on your own if you enable it. See also the +# "remotechat" variables in the FreeBSD specific version of gdb. +# +options GDB_REMOTE_CHAT + # # KTRACE enables the system-call tracing facility ktrace(2). # diff --git a/sys/i386/i386/i386-gdbstub.c b/sys/i386/i386/i386-gdbstub.c index e019fef..dac5f3e 100644 --- a/sys/i386/i386/i386-gdbstub.c +++ b/sys/i386/i386/i386-gdbstub.c @@ -103,6 +103,7 @@ #include #include "sio.h" +#include "opt_ddb.h" #if NSIO == 0 void @@ -250,6 +251,19 @@ putpacket (char *buffer) /* $#. */ do { +/* + * This is a non-standard hack to allow use of the serial console for + * operation as well as debugging. Simply turn on 'remotechat' in gdb. + * + * This extension is not part of the Cygnus protocol, is kinda gross, + * but gets the job done. + */ +#ifdef GDB_REMOTE_CHAT + putDebugChar ('|'); + putDebugChar ('|'); + putDebugChar ('|'); + putDebugChar ('|'); +#endif putDebugChar ('$'); checksum = 0; count = 0; -- cgit v1.1