tools/libxc: Add Valgrind client requests
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 10 Jun 2014 14:41:07 +0000 (15:41 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 12 Jun 2014 09:04:44 +0000 (10:04 +0100)
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 <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- reran autogen.sh ]

tools/config.h.in
tools/configure
tools/configure.ac
tools/libxc/Makefile
tools/libxc/xc_private.h

index 015f2a14f123adc172da690fa9f56a3e963735a0..bb34f32afbc4ab91e3e32f8ed1663567c31702d5 100644 (file)
@@ -48,6 +48,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <valgrind/memcheck.h> header file. */
+#undef HAVE_VALGRIND_MEMCHECK_H
+
 /* Define to 1 if you have the <yajl/yajl_version.h> header file. */
 #undef HAVE_YAJL_YAJL_VERSION_H
 
index d4a7919745721a71b947405e48511fa8ba31f766..ea2ad80db528d188c2beb091c7d7193b55627286 100755 (executable)
@@ -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"
index 25d7ca389ca3f647ed8a8084a4531bb1e34ee528..89f1ac7f1dd27299d7ca3f5af6a7a83a26d8da16 100644 (file)
@@ -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()
 
index a74b19e001480a467bdb7fefcbd1218b435bd9b7..215101d0463ed2e90dfc0a7906e5d218ba664b94 100644 (file)
@@ -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)
index 4447cec1e5910de8280790d7ca67112424e48a07..c7730f25b7bdf86d3d812ad59c87baf32edbe01c 100644 (file)
 
 #include <xen/sys/privcmd.h>
 
+#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG)
+/* 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