From: Andrew Cooper Subject: [PATCH v3 6/6] tools/libxc: Add Valgrind client requests Date: Tue, 10 Jun 2014 15:41:07 +0100 Message-ID: <1402411267-2588-1-git-send-email-andrew.cooper3@citrix.com> References: <1402404369.1250.98.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1402404369.1250.98.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org 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 debug builds are enabled. Signed-off-by: Andrew Cooper CC: Ian Campbell CC: Ian Jackson --- Please rerun autogen as part of committing this v2: Apply some autoconf v3: Rework autoconf interaction --- tools/configure.ac | 2 +- tools/libxc/Makefile | 3 +++ tools/libxc/xc_private.h | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/configure.ac b/tools/configure.ac index 25d7ca3..89f1ac7 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -245,7 +245,7 @@ AC_CHECK_LIB([fdt], [fdt_create], [], [AC_MSG_ERROR([Could not find libfdt])]) esac # Checks for header files. -AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h]) +AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h]) AC_OUTPUT() diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile index a74b19e..215101d 100644 --- a/tools/libxc/Makefile +++ b/tools/libxc/Makefile @@ -104,6 +104,9 @@ GUEST_PIC_OBJS := $(patsubst %.c,%.opic,$(GUEST_SRCS-y)) OSDEP_LIB_OBJS := $(patsubst %.c,%.o,$(OSDEP_SRCS-y)) OSDEP_PIC_OBJS := $(patsubst %.c,%.opic,$(OSDEP_SRCS-y)) +$(CTRL_LIB_OBJS) $(GUEST_LIB_OBJS) $(OSDEP_LIB_OBJS) \ +$(CTRL_PIC_OBJS) $(GUEST_PIC_OBJS) $(OSDEP_PIC_OBJS) : CFLAGS += -include $(XEN_ROOT)/tools/config.h + LIB := libxenctrl.a ifneq ($(stubdom),y) LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR) diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h index 4447cec..c7730f2 100644 --- a/tools/libxc/xc_private.h +++ b/tools/libxc/xc_private.h @@ -34,6 +34,13 @@ #include +#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG) +/* Compile in Valgrind client requests? */ +#include +#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