From: Andrew Cooper Date: Tue, 10 Jun 2014 14:41:07 +0000 (+0100) Subject: tools/libxc: Add Valgrind client requests X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4862 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=171c6d7ac17e29e0f4dcf058aa6c4ee11088f6c7;p=xen.git 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 debug builds are enabled. Signed-off-by: Andrew Cooper CC: Ian Campbell CC: Ian Jackson Acked-by: Ian Campbell [ ijc -- reran autogen.sh ] --- diff --git a/tools/config.h.in b/tools/config.h.in index 015f2a14f1..bb34f32afb 100644 --- a/tools/config.h.in +++ b/tools/config.h.in @@ -48,6 +48,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the header file. */ +#undef HAVE_VALGRIND_MEMCHECK_H + /* Define to 1 if you have the header file. */ #undef HAVE_YAJL_YAJL_VERSION_H diff --git a/tools/configure b/tools/configure index d4a7919745..ea2ad80db5 100755 --- a/tools/configure +++ b/tools/configure @@ -8057,7 +8057,7 @@ fi esac # Checks for header files. -for ac_header in yajl/yajl_version.h sys/eventfd.h +for ac_header in yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/tools/configure.ac b/tools/configure.ac index 25d7ca389c..89f1ac7f1d 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 a74b19e001..215101d046 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 4447cec1e5..c7730f25b7 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