Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Aug 2006 13:14:22 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Marcel Moolenaar <marcel@xcllnt.net>
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:  <200608041314.24161.jhb@freebsd.org>
In-Reply-To: <6B15CBE0-00E0-4F64-A652-4A4B614975C2@xcllnt.net>
References:  <200608030959.k739x9N6007207@repoman.freebsd.org> <20060804070348.GR97316@comp.chem.msu.su> <6B15CBE0-00E0-4F64-A652-4A4B614975C2@xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608041314.24161.jhb>