Compile libcwd itself with -D_GLIBCXX_DEBUG. See "The libstdc++ debug mode" on http://gcc.gnu.org/onlinedocs/libstdc++/debug.html.
Note that this flag changes the sizes and behavior of standard class templates such as std::vector, and therefore you can only link code compiled with debug mode and code compiled without debug mode if no instantiation of a container is passed between the two translation units. Because this is always the case between your custom debug.cc and libcwd, and most likely in many other cases– libcwd enforces that every compilation unit that includes libcwd/debug.h uses the same mode.
It is a good idea to use this if you suspect problems related to iterators. The disadvantage is that you need to compile your applications also with -D_GLIBCXX_DEBUG and that this debug mode comes with a speed penality.
This is disabled by default. Use configure –enable-glibcxx_debug to enable it.