File: valgrind_internal.cpp

package info (click to toggle)
libpmemobj-cpp 1.12-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,388 kB
  • sloc: cpp: 136,076; sh: 1,022; perl: 381; ansic: 163; makefile: 13
file content (30 lines) | stat: -rw-r--r-- 749 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// SPDX-License-Identifier: BSD-3-Clause
/* Copyright 2019, Intel Corporation */

#include "valgrind_internal.hpp"
#include <libpmemobj++/detail/common.hpp>

unsigned On_valgrind = 0;
unsigned On_pmemcheck = 0;
unsigned On_memcheck = 0;
unsigned On_helgrind = 0;
unsigned On_drd = 0;

void
set_valgrind_internals(void)
{
#if LIBPMEMOBJ_CPP_ANY_VG_TOOL_ENABLED
	On_valgrind = RUNNING_ON_VALGRIND;

	if (On_valgrind) {
		if (getenv("LIBPMEMOBJ_CPP_TRACER_PMEMCHECK"))
			On_pmemcheck = 1;
		else if (getenv("LIBPMEMOBJ_CPP_TRACER_MEMCHECK"))
			On_memcheck = 1;
		else if (getenv("LIBPMEMOBJ_CPP_TRACER_HELGRIND"))
			On_helgrind = 1;
		else if (getenv("LIBPMEMOBJ_CPP_TRACER_DRD"))
			On_drd = 1;
	}
#endif /* LIBPMEMOBJ_CPP_ANY_VG_TOOL_ENABLED */
}