Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Aug 2006 09:41:01 -0700
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Yar Tikhiy <yar@comp.chem.msu.su>, src-committers@freebsd.org, cvs-all@freebsd.org, cvs-src@freebsd.org, Sam Leffler <sam@errno.com>
Subject:   Re: cvs commit: src/sys/net if_vlan.c
Message-ID:  <FE71B68E-EB9D-4499-8B73-DB43879CF12B@xcllnt.net>
In-Reply-To: <200608041644.08533.jhb@freebsd.org>
References:  <200608030959.k739x9N6007207@repoman.freebsd.org> <200608041314.24161.jhb@freebsd.org> <20060804200154.GC31805@ns1.xcllnt.net> <200608041644.08533.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Aug 4, 2006, at 1:44 PM, John Baldwin wrote:

>>> 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.

Exactly. Here, FOO_DEBUG serves roughly the same function as KDB.
Where KDB's scope is limitless, FOO_DEBUG typically applies to
foo(4) only.

-- 
  Marcel Moolenaar         USPA: A-39004          marcel@xcllnt.net





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FE71B68E-EB9D-4499-8B73-DB43879CF12B>