From owner-cvs-all@FreeBSD.ORG Tue Jan 20 21:40:52 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 7B14616A4CE; Tue, 20 Jan 2004 21:40:52 -0800 (PST) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id E680743D2F; Tue, 20 Jan 2004 21:40:49 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87])i0L5emtd021461; Wed, 21 Jan 2004 16:40:48 +1100 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i0L5ejp2012770; Wed, 21 Jan 2004 16:40:46 +1100 Date: Wed, 21 Jan 2004 16:40:46 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Nate Lawson In-Reply-To: <20040120203001.B99547@root.org> Message-ID: <20040121162731.F7489@gamplex.bde.org> References: <200401210148.aa95501@salmon.maths.tcd.ie> <20040120203001.B99547@root.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@FreeBSD.org cc: Ian Dowse cc: src-committers@FreeBSD.org cc: Poul-Henning Kamp cc: cvs-all@FreeBSD.org Subject: Re: 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 05:40:52 -0000 On Tue, 20 Jan 2004, Nate Lawson wrote: > On Wed, 21 Jan 2004, Ian Dowse wrote: > > 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? It's undesireable in almost all cases, since it fills up the message buffer with garbage. > Can't you just check that you aren't in DDB before printing to the message > buf? > > Like this: > > if (boothowto & RB_KDB) { > normal behavior to console via cnputc() > } else { > print to message buf instead > } Something like that would be correct (test db_active, not boothowto...). Another bug in backtrace() with the same cause (using a ddb function in non-ddb-context) is that if it causes a page fault then the page fault should be trapped like ddb does it, but ddb's jmp_buf for this is not initialized or has garbage from a previous initialization. Bruce