Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


On Wednesday, June 22, 2011, Michael Meeks wrote:

      But a single method:

      bool running_under_valgrind (void);
or
      bool running_under_memcheck (void);

      so we can switch our allocation semantics auto-magically.

      Julian - we have lots of complex stuff; how do we get the simple
boolean we want out :-)

Oh, I think I missed answering the simple question here.  Thusly:

  #include "valgrind.h"

  bool running_under_valgrind (void)
  {
     return (RUNNING_ON_VALGRIND) ? true : false;
  }

Is that what you want, or did you mean something different?

You might want to cache the result of RUNNING_ON_VALGRIND
so that the common (production) case overhead is reduced to
a load and conditional branch, rather than the strange sequence
of stores and rotates generated by the macro. 

J

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.