Some templates to wrap the valgrind client request macros.
More...
Go to the source code of this file.
|
#define | OPM_VALGRIND_OPTIM_UNUSED OPM_UNUSED |
|
|
bool | Opm::Valgrind::IsRunning () |
| Returns whether the program is running under Valgrind or not.
|
|
template<class T > |
bool | Opm::Valgrind::CheckDefined (const T &value OPM_VALGRIND_OPTIM_UNUSED) |
| Make valgrind complain if any of the memory occupied by an object is undefined. More...
|
|
template<class T > |
bool | Opm::Valgrind::CheckAddressable (const T &value OPM_VALGRIND_OPTIM_UNUSED) |
| Make valgrind complain if any of the memory occupied by an object is not addressable. More...
|
|
template<class T > |
bool | Opm::Valgrind::CheckDefined (const T *value OPM_VALGRIND_OPTIM_UNUSED, int size OPM_VALGRIND_OPTIM_UNUSED) |
| Make valgrind complain if any of the the memory occupied by a C-style array objects is undefined. More...
|
|
template<class T > |
void | Opm::Valgrind::SetUndefined (const T &value OPM_VALGRIND_OPTIM_UNUSED) |
| Make the memory on which an object resides undefined in valgrind runs. More...
|
|
template<class T > |
void | Opm::Valgrind::SetUndefined (const T *value OPM_VALGRIND_OPTIM_UNUSED, int size OPM_VALGRIND_OPTIM_UNUSED) |
| Make the memory on which an array of object resides undefined in valgrind runs. More...
|
|
template<class T > |
void | Opm::Valgrind::SetDefined (const T &value OPM_VALGRIND_OPTIM_UNUSED) |
| Make the memory on which an object resides defined. More...
|
|
template<class T > |
void | Opm::Valgrind::SetDefined (const T *value OPM_VALGRIND_OPTIM_UNUSED, int n OPM_VALGRIND_OPTIM_UNUSED) |
| Make the memory on which a C-style array of objects resides defined. More...
|
|
template<class T > |
void | Opm::Valgrind::SetNoAccess (const T &value OPM_VALGRIND_OPTIM_UNUSED) |
| Make valgrind complain if an object's memory is accessed. More...
|
|
template<class T > |
void | Opm::Valgrind::SetNoAccess (const T *value OPM_VALGRIND_OPTIM_UNUSED, int size OPM_VALGRIND_OPTIM_UNUSED) |
| Make valgrind complain if the memory of a C-style array of objects is accessed. More...
|
|
Some templates to wrap the valgrind client request macros.
◆ CheckAddressable()
template<class T >
bool Opm::Valgrind::CheckAddressable |
( |
const T &value |
OPM_VALGRIND_OPTIM_UNUSED | ) |
|
|
inline |
Make valgrind complain if any of the memory occupied by an object is not addressable.
Example:
int* i = NULL;
Valgrind::CheckAddressable(*i);
- Template Parameters
-
T | The type of the object which ought to be checked |
- Parameters
-
value | the object which valgrind should check |
- Returns
- true iff there are no unadressable bytes in the memory occupied by the object.
◆ CheckDefined() [1/2]
template<class T >
bool Opm::Valgrind::CheckDefined |
( |
const T &value |
OPM_VALGRIND_OPTIM_UNUSED | ) |
|
|
inline |
Make valgrind complain if any of the memory occupied by an object is undefined.
Please note that this does not check whether the destinations of an object's pointers or references are defined. Also, for performance reasons the compiler might insert "padding bytes" between within the objects which leads to false positives.
Example:
int i;
Valgrind::CheckDefined(i);
- Template Parameters
-
T | The type of the object which ought to be checked |
- Parameters
-
value | the object which valgrind should check |
- Returns
- true iff there are no undefined bytes in the memory occupied by the object.
◆ CheckDefined() [2/2]
template<class T >
bool Opm::Valgrind::CheckDefined |
( |
const T *value |
OPM_VALGRIND_OPTIM_UNUSED, |
|
|
int size |
OPM_VALGRIND_OPTIM_UNUSED |
|
) |
| |
|
inline |
Make valgrind complain if any of the the memory occupied by a C-style array objects is undefined.
Please note that this does not check whether the destinations of an object's pointers or references are defined. Also, for performance reasons the compiler might insert "padding bytes" between within the objects which leads to false positives.
Example:
int i[2];
Valgrind::CheckDefined(i, 2);
- Template Parameters
-
T | The type of the object which ought to be checked |
- Parameters
-
value | Pointer to the first object of the array. |
size | The size of the array in number of objects |
- Returns
- true iff there are no undefined bytes in the memory occupied by the array.
◆ SetDefined() [1/2]
template<class T >
void Opm::Valgrind::SetDefined |
( |
const T &value |
OPM_VALGRIND_OPTIM_UNUSED | ) |
|
|
inline |
Make the memory on which an object resides defined.
Example:
int i;
Valgrind::SetDefined(i);
Valgrind::CheckDefined(i);
- Template Parameters
-
T | The type of the object which valgrind should consider as defined |
- Parameters
-
value | The object which's memory valgrind should consider as defined |
◆ SetDefined() [2/2]
template<class T >
void Opm::Valgrind::SetDefined |
( |
const T *value |
OPM_VALGRIND_OPTIM_UNUSED, |
|
|
int n |
OPM_VALGRIND_OPTIM_UNUSED |
|
) |
| |
|
inline |
Make the memory on which a C-style array of objects resides defined.
Example:
int i[3];
Valgrind::SetDefined(i, 3);
Valgrind::CheckDefined(i, 3);
- Template Parameters
-
T | The type of the object which valgrind should consider as defined |
- Parameters
-
value | Pointer to the first object of the array. |
n | The size of the array in number of objects |
◆ SetNoAccess() [1/2]
template<class T >
void Opm::Valgrind::SetNoAccess |
( |
const T &value |
OPM_VALGRIND_OPTIM_UNUSED | ) |
|
|
inline |
Make valgrind complain if an object's memory is accessed.
Example:
int i = 1;
Valgrind::SetNoAccess(i);
int j = i;
- Template Parameters
-
T | The type of the object which valgrind should complain if accessed |
- Parameters
-
value | The object which's memory valgrind should complain if accessed |
◆ SetNoAccess() [2/2]
template<class T >
void Opm::Valgrind::SetNoAccess |
( |
const T *value |
OPM_VALGRIND_OPTIM_UNUSED, |
|
|
int size |
OPM_VALGRIND_OPTIM_UNUSED |
|
) |
| |
|
inline |
Make valgrind complain if the memory of a C-style array of objects is accessed.
Example:
int i[3] = {0, 1, 2};
Valgrind::SetNoAccess(i, 2);
int j = i[1];
- Parameters
-
value | Pointer to the first object of the array. |
size | The size of the array in number of objects |
◆ SetUndefined() [1/2]
template<class T >
void Opm::Valgrind::SetUndefined |
( |
const T &value |
OPM_VALGRIND_OPTIM_UNUSED | ) |
|
|
inline |
Make the memory on which an object resides undefined in valgrind runs.
Example:
int i = 0;
Valgrind::SetUndefined(i);
Valgrind::CheckDefined(i);
- Template Parameters
-
T | The type of the object which ought to be set to undefined |
- Parameters
-
value | The object which's memory valgrind should be told is undefined |
◆ SetUndefined() [2/2]
template<class T >
void Opm::Valgrind::SetUndefined |
( |
const T *value |
OPM_VALGRIND_OPTIM_UNUSED, |
|
|
int size |
OPM_VALGRIND_OPTIM_UNUSED |
|
) |
| |
|
inline |
Make the memory on which an array of object resides undefined in valgrind runs.
Example:
int i[3] = {0, 1, 3};
Valgrind::SetUndefined(&i[1], 2);
Valgrind::CheckDefined(i, 3);
- Template Parameters
-
T | The type of the object which ought to be set to undefined |
- Parameters
-
value | Pointer to the first object of the array. |
size | The size of the array in number of objects |