On Mon, Jun 30, 2008 at 06:27:17PM +0800, Yu Xiangning wrote:
> Hi mdb gurus,
> 
> While compiling the mdb modules with DEBUG mode, we found that -DDEBUG
> is not passed to the compiler.
> 
> To fix this, we have to add a line manually to
> usr/src/cmd/mdb/Makefile.module:
> 
> $(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
> 
> So I'm a bit confused, shouldn't we always pass DEBUG to the compiler
> while doing a debug build?

mdb and kmdb are built with -DDEBUG, but modules typically are not.
Normally, most datastructures in the kernel are identical for DEBUG
and non-DEBUG builds, so this isn't a problem.  It's important that
there not be two versions of the MDB modules (one debug and one non-debug);
it's very common to be debugging a non-debug dump on a DEBUG build, and
vice-versa.

Because of this, adding -DDEBUG to Makefile.module when compiling
under DEBUG isn't the solution.  Something like what's done in
usr/src/cmd/mdb/common/modules/dtrace/dtrace.c is better:

30 * explicitly define DTRACE_ERRDEBUG to pull in definition of dtrace_errhash_t
...
33 #define DTRACE_ERRDEBUG

What, exactly, is the problem you are running into?

Cheers,
- jonathan

Reply via email to