Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jun 1999 18:40:22 +0200
From:      Tor.Egge@fast.no
To:        philh@mincom.com
Cc:        freebsd-current@FreeBSD.ORG, freebsd-stable@FreeBSD.ORG
Subject:   Re: ENABLE_SERIAL_BREAK_KEY...or something?
Message-ID:  <199906101640.SAA13408@midten.fast.no>
In-Reply-To: Your message of "Thu, 10 Jun 1999 15:41:24 %2B1000"
References:  <19990610154124.F22693@mincom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
----Next_Part(Thu_Jun_10_18:39:25_1999)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


> Would be most excellent if this could be done. A couple of boxen I
> have here have serial consoles attached to other machines which
> do a very good simulation of a break when the controlling process
> leaves them. Dropping to DDB every time you reboot the other machine
> is, uh, less than desirable behaviour. :-)

I had the same problem.  Changing the sio code to require three breaks
inside a 10 seconds interval before dropping into the debugger reduced
the problem for me.

- Tor Egge


----Next_Part(Thu_Jun_10_18:39:25_1999)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Index: sys/i386/conf/options.i386
===================================================================
RCS file: /home/ncvs/src/sys/i386/conf/options.i386,v
retrieving revision 1.116
diff -u -r1.116 options.i386
--- options.i386	1999/06/06 22:45:04	1.116
+++ options.i386	1999/06/08 00:27:17
@@ -24,6 +24,7 @@
 AUTO_EOI_1		opt_auto_eoi.h
 AUTO_EOI_2		opt_auto_eoi.h
 BREAK_TO_DEBUGGER	opt_comconsole.h
+TRIPLE_BREAK_TO_DEBUGGER opt_comconsole.h
 CONSPEED		opt_comconsole.h
 I586_PMC_GUPROF		opt_i586_guprof.h
 WLCACHE			opt_wavelan.h
Index: sys/isa/sio.c
===================================================================
RCS file: /home/ncvs/src/sys/isa/sio.c,v
retrieving revision 1.246
diff -u -r1.246 sio.c
--- sio.c	1999/05/31 06:57:31	1.246
+++ sio.c	1999/06/08 00:27:38
@@ -427,6 +427,16 @@
 	{ -1,		-1 }
 };
 
+#define DDB_BREAK_MASK (IER_ERXRDY | IER_ETXRDY | IER_ERLS | IER_EMSC)
+
+#ifdef TRIPLE_BREAK_TO_DEBUGGER
+#ifndef TRIPLE_BREAK_TIMEOUT
+#define TRIPLE_BREAK_TIMEOUT 10
+#endif
+int triple_break_count;	/* number of breaks detected */
+int triple_break_time;	/* time_second sampled at first break */
+#endif
+
 #ifdef COM_ESP
 /* XXX configure this properly. */
 static	Port_t	likely_com_ports[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, };
@@ -998,6 +1008,9 @@
 		com->lt_out.c_ispeed = com->lt_out.c_ospeed =
 		com->lt_in.c_ispeed = com->lt_in.c_ospeed =
 		com->it_in.c_ispeed = com->it_in.c_ospeed = comdefaultrate;
+#if defined(DDB) && defined(BREAK_TO_DEBUGGER) && defined(DDB_BREAK_MASK)
+		outb(iobase + com_ier, DDB_BREAK_MASK);
+#endif
 	} else
 		com->it_in.c_ispeed = com->it_in.c_ospeed = TTYDEF_SPEED;
 	if (siosetwater(com, com->it_in.c_ispeed) != 0) {
@@ -1404,7 +1417,12 @@
 	com->pps.ppsparam.mode = 0;
 	outb(iobase + com_cfcr, com->cfcr_image &= ~CFCR_SBREAK);
 	{
-		outb(iobase + com_ier, 0);
+#if defined(DDB) && defined(BREAK_TO_DEBUGGER) && defined(DDB_BREAK_MASK)
+		if (com->unit == comconsole)
+			outb(iobase + com_ier, DDB_BREAK_MASK);
+		else
+#endif
+			outb(iobase + com_ier, 0);
 		tp = com->tp;
 		if (tp->t_cflag & HUPCL
 		    /*
@@ -1704,7 +1722,23 @@
 				if (line_status & LSR_BI) {
 #if defined(DDB) && defined(BREAK_TO_DEBUGGER)
 					if (com->unit == comconsole) {
+#ifdef TRIPLE_BREAK_TO_DEBUGGER
+						if (time_second > 
+						    triple_break_time + 
+						    TRIPLE_BREAK_TIMEOUT)
+							triple_break_count = 0;
+						triple_break_count++;
+						if (triple_break_count == 1)
+							triple_break_time = 
+								time_second;
+						else if (triple_break_count 
+							 == 3) {
+							triple_break_count = 0;
+							breakpoint();
+						}
+#else
 						breakpoint();
+#endif
 						goto cont;
 					}
 #endif

----Next_Part(Thu_Jun_10_18:39:25_1999)----


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906101640.SAA13408>