From owner-cvs-all@FreeBSD.ORG Mon Aug 7 14:28:20 2006 Return-Path: X-Original-To: cvs-all@freebsd.org 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 3DEEA16A4E0; Mon, 7 Aug 2006 14:28:20 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 80C0E43D46; Mon, 7 Aug 2006 14:28:17 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id k77ERjor034970; Mon, 7 Aug 2006 10:27:47 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Marcel Moolenaar Date: Fri, 4 Aug 2006 16:44:07 -0400 User-Agent: KMail/1.9.1 References: <200608030959.k739x9N6007207@repoman.freebsd.org> <200608041314.24161.jhb@freebsd.org> <20060804200154.GC31805@ns1.xcllnt.net> In-Reply-To: <20060804200154.GC31805@ns1.xcllnt.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200608041644.08533.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 07 Aug 2006 10:27:49 -0400 (EDT) X-Virus-Scanned: ClamAV 0.87.1/1639/Mon Aug 7 09:34:09 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: Yar Tikhiy , src-committers@freebsd.org, cvs-all@freebsd.org, cvs-src@freebsd.org, Sam Leffler Subject: Re: cvs commit: src/sys/net if_vlan.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 07 Aug 2006 14:28:20 -0000 On Friday 04 August 2006 16:01, Marcel Moolenaar wrote: > On Fri, Aug 04, 2006 at 01:14:22PM -0400, John Baldwin wrote: > > > > > > So, putting the kdb_backtrace() under KDB is not a matter of said > > > function not being present without KDB, it's that we don't want > > > to emit backtraces when debugging is not enabled. Backtraces are > > > a debugging tool and it makes sense to emit them only when the > > > kernel is configured for debugging. > > > > In practice this ends up being redundant though as to have kdb_backtrace() > > actually do anything you have to have DDB in your kernel config, which > > requires KDB. > > That's really an implementation detail. What if we get a new debugger > backend that allows backtraces? What if the GDB backend is extended to > allow backtraces? In that case the user has specifically requested debugger support in their kernel (whether it be DDB, GDB, or FOODB). > The point is that kdb_backtrace() is there if you want a backtrace and > you call it based on whatever option that makes sense at the call-site > or even unconditionally if that's the right thing. > Whether there's actually a backend that can make a backtrace is really > a seperate issue. We just happen to implement backtracing and unwinding > by debuggers, but with an unwinder in the kernel on ia64, we really > don't need a debugger in order to make a backtrace and it's not that > unrealistic that I create a backend that can only do backtraces... To be honest, as someone who works with bug reports, I'd actually like backtraces up front w/o requiring the user to compile a custom kernel, etc. Having a simple backend in place and kdb_backtrace()'s where relevant would be very handy. :) > > Places that call kdb_enter() aren't all #ifdef KDB IIRC. It's > > just a feature that kdb_foo() functions become NOPs when the kernel isn't > > configured for debugging, so I think the #ifdef KDB's would be redundant. > > None of the kdb_*() functions in src/sys/kern/subr_kdb.c turn into > NOPs when option KDB is not present. They are all unconditionally > functional by design and should therefore be called conditionally > by consequence. Well, given that separation, I'm not sure KDB is the right option to make calls conditional. Rather, some specific is-debugging-enabled? option (like INARIANTS or FOO_DEBUG) should be used instead. i.e.: #ifdef FOO_DEBUG if (foo_bad) { printf("foo is bad\n"); kdb_backtrace(); } #endif I don't think that warrants an extra #ifdef KDB. -- John Baldwin