cvs commit: src/sys/net if_vlan.c

Marcel Moolenaar marcel at xcllnt.net
Mon Aug 7 16:42:00 UTC 2006


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 at xcllnt.net




More information about the cvs-src mailing list