Subject: RFC: switching to the console on panic
To: None <tech-kern@netbsd.org>
From: Reinoud Zandijk <reinoud@netbsd.org>
List: tech-kern
Date: 02/11/2006 17:11:23
--hQiwHBbRI9kgIhsi
Content-Type: multipart/mixed; boundary="rwEMma7ioTxnRzrJ"
Content-Disposition: inline


--rwEMma7ioTxnRzrJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Dear folks,

a small patch proposal to have ddb() switch to the console when invoked. So 
when working on say ttyE5 and a panic occures, it'll switch to the console 
where it prints the ddb prompt and backtrack if any.

Avoids confusion mainly and prevents ppl. from typing in stuff and not 
understanding why the program is not responding.

regards,
Reinoud


--rwEMma7ioTxnRzrJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=wscons-ddb-diff

Index: ddb/db_trap.c
===================================================================
RCS file: /cvsroot/src/sys/ddb/db_trap.c,v
retrieving revision 1.23
diff -u -p -r1.23 db_trap.c
--- ddb/db_trap.c	11 Dec 2005 12:20:53 -0000	1.23
+++ ddb/db_trap.c	11 Feb 2006 15:59:51 -0000
@@ -48,6 +48,9 @@ __KERNEL_RCSID(0, "$NetBSD: db_trap.c,v 
 #include <ddb/db_sym.h>
 #include <ddb/db_extern.h>
 
+#include <dev/wscons/wsdisplayvar.h>
+#include "wsdisplay.h"
+
 /*
  * db_trap_callback can be hooked by MD port code to handle special
  * cases such as disabling hardware watchdogs while in DDB.
@@ -70,6 +73,9 @@ db_trap(int type, int code)
 	if (db_trap_callback) db_trap_callback(1);
 
 	if (db_stop_at_pc(DDB_REGS, &bkpt)) {
+#if NWSDISPLAY > 0
+		wsdisplay_switchtoconsole();
+#endif
 		if (db_inst_count) {
 			db_printf("After %d instructions "
 			    "(%d loads, %d stores),\n",
Index: dev/wscons/wsdisplay.c
===================================================================
RCS file: /cvsroot/src/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.88
diff -u -p -r1.88 wsdisplay.c
--- dev/wscons/wsdisplay.c	7 Feb 2006 09:13:02 -0000	1.88
+++ dev/wscons/wsdisplay.c	11 Feb 2006 15:59:52 -0000
@@ -2026,9 +2026,7 @@ wsdisplay_switchtoconsole(void)
 		sc = wsdisplay_console_device;
 		if ((scr = sc->sc_scr[0]) == NULL)
 			return;
-		(*sc->sc_accessops->show_screen)(sc->sc_accesscookie,
-						 scr->scr_dconf->emulcookie,
-						 0, NULL, NULL);
+		wsdisplay_switch((struct device *) sc, 0, 1);
 	}
 }
 

--rwEMma7ioTxnRzrJ--

--hQiwHBbRI9kgIhsi
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQ+4MpIKcNwBDyKpoAQK3TAf/W9G71KwSLWWmOk44dB79C/sDezsPPIGi
dnJ83Y2h0hedNpsTAiLhejaYLGSeDVmhX7ZHvEaOvsaR9JrYcaEkl2RKoMPJtCav
KT4gz4WRNRRirTxKcIuffcrb2fPLY+qRcvt2KoAYnr/3wK5E657ldOKIsw6qMdfk
CXJTku+7vVK1VR2BdsQMvnWzEtvIwpRnvqsKSjQWhLtUsP76wn+cqR0mMfKLqoZe
aA2r/Qzmf/J85M+jZaL1q6uZ9Gvd2uFGgpcOz9LbVFJltbs+DYPvZ1e8uhaaDJV3
SxAcYz3QY9a/NuPTWi/6gSMnIMezerGABNuzhmuCS0qPN7uE4CX94A==
=vXJO
-----END PGP SIGNATURE-----

--hQiwHBbRI9kgIhsi--