[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 6/6] tools/libxc: Add Valgrind client requests
Valgrind client requests can be used by code to provide extra debugging information about memory ranges, or to request checks at specific points. Reference: http://valgrind.org/docs/manual/mc-manual.html#mc-manual.clientreqs Client requests are safe to compile into code for running outside of valgrind. Therefore, enable client requests whenever autoconf can find memcheck.h and debugging builds are enabled. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- Please rerun autogen as part of committing this v2: Apply some autoconf --- config/Tools.mk.in | 1 + tools/configure.ac | 2 ++ tools/libxc/Makefile | 4 ++++ tools/libxc/xc_private.h | 7 +++++++ 4 files changed, 14 insertions(+) diff --git a/config/Tools.mk.in b/config/Tools.mk.in index 84b2612..5ce6ee1 100644 --- a/config/Tools.mk.in +++ b/config/Tools.mk.in @@ -7,6 +7,7 @@ LIBDIR := $(libdir) # A debug build of tools? debug := @debug@ +HAVE_MEMCHECK_H := @HAVE_MEMCHECK_H@ # Tools path BISON := @BISON@ diff --git a/tools/configure.ac b/tools/configure.ac index 25d7ca3..452cfd5 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -246,6 +246,8 @@ esac # Checks for header files. AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h]) +AC_CHECK_HEADER([valgrind/memcheck.h], [HAVE_MEMCHECK_H="y"]) +AC_SUBST(HAVE_MEMCHECK_H) AC_OUTPUT() diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile index a74b19e..3d55757 100644 --- a/tools/libxc/Makefile +++ b/tools/libxc/Makefile @@ -95,6 +95,10 @@ CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE CFLAGS += $(PTHREAD_CFLAGS) +ifeq ($(HAVE_MEMCHECK_H)$(debug),yy) +CFLAGS += -DVALGRIND +endif + CTRL_LIB_OBJS := $(patsubst %.c,%.o,$(CTRL_SRCS-y)) CTRL_PIC_OBJS := $(patsubst %.c,%.opic,$(CTRL_SRCS-y)) diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h index 213f607..52d8c96 100644 --- a/tools/libxc/xc_private.h +++ b/tools/libxc/xc_private.h @@ -34,6 +34,13 @@ #include <xen/sys/privcmd.h> +#ifdef VALGRIND +/* Compile in Valgrind client requests? */ +#include <valgrind/memcheck.h> +#else +#define VALGRIND_MAKE_MEM_UNDEFINED(addr, len) /* addr, len */ +#endif + #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall #define DECLARE_DOMCTL struct xen_domctl domctl #define DECLARE_SYSCTL struct xen_sysctl sysctl -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |