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

nicolas geoffray nicolas.geoffray at gmail.com
Tue Aug 3 13:40:54 PDT 2010


Hi Minas,

On Fri, Jul 23, 2010 at 2:30 PM, Minas Abrahamyan <minas.subs at gmail.com>wrote:

> Hi Nicolas,
>
> So, I've seen, that you preferred not to checkin logger (reanimated)
> parts, the patch I've gave.
>

I will submit parts of it, there is some code that I think is only necessary
when debugging a specific issue that I would like to remove.


> And also didn't received any answer about how do you see the use of
> runtime reconfiguration of logger.
>

There are many places in the VM that are not performance critical where we
could get runtime debugging. VMKit does not support jdwp, but that may be an
example on where to put runtime debugging.

Nicolas



>
> The only scenario I can imagine for runtime is something similar to
> -verbose key of 'java' utility:
> <<<
> -verbose[:class|gc|jni]
>  enable verbose output
> >>>
>
> Also:
> <<<
>  -Xloggc:<file>    log GC status to a file with time stamps
> >>>
> But this is quite a different story.
>
> I would prefer, in any case, to have also an option to turn off all
> logging for optimized Release version, for performance.
>
> Regards,
> Minas
>
> On Wed, Jul 21, 2010 at 3:15 AM, Minas Abrahamyan <minas.subs at gmail.com>
> wrote:
> > 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
> >>
> >>
> >
>
> _______________________________________________
> 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/20100803/87da190b/attachment.html>


More information about the vmkit-commits mailing list