James Carlson wrote:
> Mike.Sullivan at sun.com writes:
>> but it used to be that you weren't supposed to have DEBUG code make
>> it lots slower, as that discourages people from running DEBUG kernels
>> for normal use which does help. What 'lots' means these days I don't know,
>> but while I'd probably not worry much about asserts I'd probably put
>> things like
>> #ifdef DEBUG
>> /* spend minutes validating all my structures */
>> #endif
There is certainly some of this in the ZFS code but....
>> under another debug variables control that is not enabled by default.
>
> That's certainly what we do in other areas. It's an important design
> note that the "variables" here should not be compilation-time symbols
> (i.e., no ifdef'd debug code) but instead be run-time tweaks; either
> global variables that can be poked by 'mdb' or special debug commands.
They are enabled by doing tweaks on zfs_flags.
> One thing that's missing here is a translation of #define DEBUG into
> #undef NDEBUG for user space programs. I think that'd be a really
> welcome addition to the system.
Rather than tweaking Makefiles I do this in my environment by (ab)using
$COPTFLAG eg for userland:
export COPTFLAG="-g -DDEBUG"
Another thing I've always wanted to get around to doing for userland is
to have it all built with "-g" when we run a debug nightly. There are
sometimes issues if you have "-g" set for all of userspace build.
--
Darren J Moffat