cvs commit: src/sys/net if_vlan.c

John Baldwin jhb at freebsd.org
Fri Aug 4 19:33:23 UTC 2006


On Friday 04 August 2006 12:23, Marcel Moolenaar wrote:
> On Aug 4, 2006, at 12:03 AM, Yar Tikhiy wrote:
> 
> > Just noticed that many calls to kdb_backtrace() are under "#ifdef
> > KDB" while subr_kdb.c is marked as standard in /sys/conf/files and
> > the function itself is always available (yet can do nothing.)
> >
> > Should calls to kdb_backtrace() be put under "#ifdef KDB"?  If they
> > should, it can justify introducing the combined printf+trace function.
> 
> subr_kdb.c is indeed unconditional. The reason is that it contains
> the interface functions and you should not make interface functions
> optional if modules can reference them.
> 
> The KDB option is there to tell that one wants debugging features
> enabled. This means for example that serial drivers react to the
> line break condition by going into the debugger. Without the KDB
> option line break conditions just result in a 0-character in the
> input stream.
> 
> 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.  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.

-- 
John Baldwin


More information about the cvs-src mailing list