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

nicolas geoffray nicolas.geoffray at gmail.com
Tue Jul 20 09:05:12 PDT 2010


Thanks very much Minas!

Actually, when it comes to debugging, I would love to be able to pass the
debug level information at runtime rather than at compile-time. If you can
come up with a better framework for debugging than what is currently there,
that would be great. In other words, I would rather change the framework
rather than improving it :)

Still, I will take a look at your patch.

Thanks!
Nicolas

On Mon, Jul 19, 2010 at 8:18 PM, Minas Abrahamyan <minas.subs at gmail.com>wrote:

> 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
>
> _______________________________________________
> vmkit-commits mailing list
> vmkit-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/vmkit-commits/attachments/20100720/45844919/attachment-0001.html>


More information about the vmkit-commits mailing list