How do you enable the #ifdef DEBUG sections?

Tor Lillqvist tml at
Sat Mar 28 05:10:14 PDT 2015

> There are sections of the code marked #ifdef DEBUG.  How can I properly
> enable compiling those sections in?

That depends on the code in question. Such debugging code might in
some cases be code nobody has compiled for years, and bit-rotted, and
not compiling or working any more. This is why we very much should
prefer to make debugging code dependent on DBG_UTIL instead, so that
it gets compiled regularly. (And then if the code is such that it
should not be invoked every time even in a dbgutil build, use some
environment variable to activate it.)

> For example, I want to enable DEBUG_ELEMENT in
> writerfilter/source/ooxml/OOXMLFastContextHandler.cxx.

I see no DEBUG_ELEMENT in writerfilter in master, you must be looking
at some older branch. Ah yes, that was cleaned last summer:

commit b4e20eed2c9bfc032446a43f08e387a3e613d6b8
Author: Jan Holesovsky <kendy at>
Date:   Wed Jun 18 11:30:49 2014 +0200

    writerfilter: Fold all the various DEBUG_* macros into DEBUG_DOMAINMAPPER.

    They were set either all, or none anyway.

If you check the in the branch you are looking
at, you will notice that DEBUG_ELEMENT (and all the other DEBUG_FOO)
are defined on the compilation command line if gb_DEBUGLEVEL is higher
than 1. I.e. you need to build writerfilter with 'make writerfilter
dbglevel=2', I think.


More information about the LibreOffice mailing list