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

Minas Abrahamyan minas.subs at gmail.com
Tue Jul 20 15:15:44 PDT 2010


Hi Nicolas,

I think it is better to check it in anyway, since it will free me from
unnecessary merges of that debug logging:
since I have it, and seen it usefulness, I won't get to renounce from
its benefits.
Beside that, IMO, it is easier to get working after changes on
something working than while inserting new functionality without tests

What is the point reconfigurable at runtime logger?
Debugging logs are running in debug versions, sometime - in releases
too, but could be switched off in final release version,
Reserving place and functions for runtime-featured logging, could have
impact on performance... or at least it is needed a global flag/define
to turn them totally off. (Now that define is DEBUG)

-Minas

On Tue, Jul 20, 2010 at 9:05 PM, nicolas geoffray
<nicolas.geoffray at gmail.com> wrote:
> 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
>>
>
>
> _______________________________________________
> vmkit-commits mailing list
> vmkit-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits
>
>




More information about the vmkit-commits mailing list