[vmkit-commits] Debug logger patch (PRINT_DEBUG()) and how to turn it on/off

Minas Abrahamyan minas.subs at gmail.com
Mon Jul 19 11:18:10 PDT 2010


Hi all,

Printing of debug messages is very useful for debugging of any kind;
This patch allows to print them again, as it was possible few ages ago :)
Maybe not everything in right include files here, but that is better
than absence of debug logs

To apply:
$ cd vmkit
$ patch -p1 <../vmkit_debuglog.patch

To turn on: uncomment vmkit/include/debug.h line 13:
#define DEBUG 10

To turn off - comment it back:
//#define DEBUG 10

To manage VMCore subsystem logs generation:
In vmkit/lib/J3/VMCore/JnjvmConfig.h, lines 43-47:
#define JNJVM_LOAD 3
#define JNJVM_COMPILE 2

JNJVM_LOAD - class loading debug level, 1-4, when 0 it is turned off
JNJVM_COMPILE - methods compiling debug level, when 0 it is turned off

To add new logging messages, insert something like:
PRINT_DEBUG(symb, level, color, printf-like-argslist)
Fotr example:
PRINT_DEBUG(JNJVM_LOAD, 0, COLOR_NORMAL, "Jnjvm::loadBootstrap(){\n");
where
symb - is subsystem debug level,
level - is current message required level;
  Message is printed only if symb>level; subsystem logging level is
bigger than necessary by current message level;
COLOR_NORMAL - is default color.
 ( In fact it supports fancy colour printing on terminal, through
third argument, but I'm not using it.)

In this example Message will be printed if DEBUG is defined, and JNJVM_LOAD >0.

PRINT_DEBUG prints to stderr.

==
Nicolas, please review and apply this patch.
Thanks.

-Minas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vmkit_debuglog.patch
Type: text/x-patch
Size: 16766 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/vmkit-commits/attachments/20100719/43c51de4/attachment.bin>


More information about the vmkit-commits mailing list