mirror of
https://github.com/matrix-construct/construct
synced 2025-03-13 21:10:32 +01:00
ircd: Add interface for core valgrind hypercalls.
This commit is contained in:
parent
6b956d12b9
commit
c0e3f0db51
2 changed files with 32 additions and 0 deletions
|
@ -49,6 +49,13 @@ namespace ircd::allocator::vg
|
|||
void set_noaccess(const const_buffer &);
|
||||
}
|
||||
|
||||
/// Valgrind hypercall suite
|
||||
namespace ircd::vg
|
||||
{
|
||||
size_t errors();
|
||||
bool active();
|
||||
}
|
||||
|
||||
namespace ircd
|
||||
{
|
||||
using allocator::aligned_alloc;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
// full license for this software is available in the LICENSE file.
|
||||
|
||||
#include <RB_INC_MALLOC_H
|
||||
#include <RB_INC_VALGRIND_VALGRIND_H
|
||||
#include <RB_INC_VALGRIND_MEMCHECK_H
|
||||
|
||||
// Uncomment or -D this #define to enable our own crude but simple ability to
|
||||
|
@ -71,6 +72,30 @@ ircd::allocator::trim(const size_t &pad)
|
|||
// valgrind
|
||||
//
|
||||
|
||||
bool
|
||||
ircd::vg::active()
|
||||
{
|
||||
#ifdef HAVE_VALGRIND_VALGRIND_H
|
||||
return RUNNING_ON_VALGRIND;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::vg::errors()
|
||||
{
|
||||
#ifdef HAVE_VALGRIND_VALGRIND_H
|
||||
return VALGRIND_COUNT_ERRORS;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// valgrind memcheck
|
||||
//
|
||||
|
||||
void
|
||||
ircd::allocator::vg::set_noaccess(const const_buffer &buf)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue