Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jan 2004 01:48:18 +0000
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        Kenneth Culver <culverk@sweetdreamsracing.biz>
Cc:        cvs-all@FreeBSD.org
Subject:   backtrace() and the console log (was Re: cvs commit: src/sys/alpha...)
Message-ID:  <200401210148.aa95501@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Tue, 20 Jan 2004 14:45:05 EST." <20040120144505.ccsc4kog4c88sgww@www.sweetdreamsracing.biz> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20040120144505.ccsc4kog4c88sgww@www.sweetdreamsracing.biz>, Kenneth
 Culver writes:
>Quoting Nate Lawson <nate@root.org>:
>> * 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
 }
 
 /*



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