|
From: Michael S. <ms...@xi...> - 2006-03-03 18:16:57
|
On 3/3/06, Mayukh Bhattacharya <ma...@gm...> wrote:
>
> Hi,
>
> I am a IBM Purify user looking to start serious valgrind memchecking.
>
> One of the requirements for migrating is that my program "foo" absolutely
> needs to know that it is being run by valgrind. Using that knowledge,
> it will not do certain things. Purify would give me that information
> through a variable and foo would know easily that "purify_is_running"
> or not.
You can #include <valgrind/valgrind.h>, then use the
RUNNING_ON_VALGRIND macro, like:
if (RUNNING_ON_VALGRIND) {
do_special_thing();
}
else {
do_normal_thing();
}
You need the header file for this, but the application will run
normally without valgrind; it adds no runtime dependencies.
Mike
|