From owner-cvs-all@FreeBSD.ORG Tue Jan 20 17:48:24 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B5D616A4CE; Tue, 20 Jan 2004 17:48:24 -0800 (PST) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 5C9C143D41; Tue, 20 Jan 2004 17:48:22 -0800 (PST) (envelope-from iedowse@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 21 Jan 2004 01:48:21 +0000 (GMT) To: Kenneth Culver In-Reply-To: Your message of "Tue, 20 Jan 2004 14:45:05 EST." <20040120144505.ccsc4kog4c88sgww@www.sweetdreamsracing.biz> Date: Wed, 21 Jan 2004 01:48:18 +0000 From: Ian Dowse Message-ID: <200401210148.aa95501@salmon.maths.tcd.ie> cc: src-committers@FreeBSD.org cc: Poul-Henning Kamp cc: Bruce Evans cc: Nate Lawson cc: cvs-src@FreeBSD.org cc: Mike Silbersack cc: cvs-all@FreeBSD.org Subject: backtrace() and the console log (was Re: cvs commit: src/sys/alpha...) X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jan 2004 01:48:24 -0000 In message <20040120144505.ccsc4kog4c88sgww@www.sweetdreamsracing.biz>, Kenneth Culver writes: >Quoting Nate Lawson : >> * Fix backtrace() so the output goes to the console log. Right now, we >> get output that needs to be hand-transcribed or use a serial console. > >This is also very useful for when FreeBSD crashes when X is running. If X is >running, the only option is a serial console, as you can't see the crash to >transcribe it otherwise, and most people don't have the spare computer to use >as a serial console. I've been using the following patch for a while to get backtrace() to output to the kernel message buffer. Sending all ddb output via printf might be undesirable for some cases, but I guess having it configurable with a `debug.ddb_use_printf' sysctl that defaults to the old behaviour would be ok? Ian Index: db_output.c =================================================================== RCS file: /dump/FreeBSD-CVS/src/sys/ddb/db_output.c,v retrieving revision 1.29 diff -u -r1.29 db_output.c --- db_output.c 31 Jul 2003 17:27:52 -0000 1.29 +++ db_output.c 7 Sep 2003 18:50:30 -0000 @@ -103,6 +103,18 @@ void * arg; { +#if 1 + printf("%c", c); + if (c == '\r' || c == '\n') + db_check_interrupt(); + if (c == '\n' && db_maxlines > 0 && db_page_callout != NULL) { + db_newlines++; + if (db_newlines >= db_maxlines) { + db_maxlines = -1; + db_page_callout(db_page_callout_arg); + } + } +#else if (c > ' ' && c <= '~') { /* * Printing character. @@ -148,6 +160,7 @@ cnputc(c); } /* other characters are assumed non-printing */ +#endif } /*