summaryrefslogtreecommitdiff
path: root/dbus
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-02-13 17:53:51 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-02-13 17:54:21 +0000
commitb3f2ee5c6bade555630e52b8aa18fd639e047a80 (patch)
tree24b4633a490c07bb55eb6052d68bcb4355fa5b9d /dbus
parent05cc2c3348e406027837e60a2c1015b997760c83 (diff)
downloaddbus-b3f2ee5c6bade555630e52b8aa18fd639e047a80.tar.gz
Add support for inserting (a subset of) Valgrind client requests
If valgrind support is disabled, we define stub versions of the Valgrind client requests I plan to use, so the actual code doesn't need #ifdef hell. [With unnecessary AC_SUBST removed as per Lennart's review -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37286 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Lennart Poettering <lennart@poettering.net>
Diffstat (limited to 'dbus')
-rw-r--r--dbus/Makefile.am4
-rw-r--r--dbus/dbus-valgrind-internal.h47
2 files changed, 50 insertions, 1 deletions
diff --git a/dbus/Makefile.am b/dbus/Makefile.am
index 9ea254e0..c8d35f75 100644
--- a/dbus/Makefile.am
+++ b/dbus/Makefile.am
@@ -5,6 +5,7 @@ AM_CPPFLAGS = \
-I$(top_builddir) \
-I$(top_srcdir) \
$(SYSTEMD_CFLAGS) \
+ $(VALGRIND_CFLAGS) \
-DDBUS_COMPILATION \
-DDBUS_MACHINE_UUID_FILE=\""$(localstatedir)/lib/dbus/machine-id"\" \
-DDBUS_SYSTEM_CONFIG_FILE=\""$(configdir)/system.conf"\" \
@@ -221,7 +222,8 @@ DBUS_SHARED_SOURCES= \
dbus-string-private.h \
$(DBUS_SHARED_arch_sources) \
dbus-sysdeps.c \
- dbus-sysdeps.h
+ dbus-sysdeps.h \
+ dbus-valgrind-internal.h
### source code that is generic utility functionality used
### by the bus daemon or test apps, but is NOT included
diff --git a/dbus/dbus-valgrind-internal.h b/dbus/dbus-valgrind-internal.h
new file mode 100644
index 00000000..4c972c59
--- /dev/null
+++ b/dbus/dbus-valgrind-internal.h
@@ -0,0 +1,47 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-valgrind-internal.h - valgrind glue
+ *
+ * Copyright © 2011 Nokia Corporation
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef DBUS_VALGRIND_INTERNAL_H
+#define DBUS_VALGRIND_INTERNAL_H
+
+#include "config.h"
+#include "dbus-internals.h"
+
+#ifdef WITH_VALGRIND
+# include <memcheck.h>
+# include <valgrind.h>
+#else
+# define VALGRIND_CREATE_MEMPOOL(_1, _2, _3) /* nothing */
+# define VALGRIND_DESTROY_MEMPOOL(_1) /* nothing */
+# define VALGRIND_MEMPOOL_ALLOC(_1, _2, _3) /* nothing */
+# define VALGRIND_MEMPOOL_FREE(_1, _2) /* nothing */
+# define VALGRIND_MAKE_MEM_UNDEFINED(_1, _2) (0)
+
+# define VALGRIND_PRINTF(...) (0)
+# define VALGRIND_PRINTF_BACKTRACE(...) (0)
+
+# define RUNNING_ON_VALGRIND 0
+#endif /* WITH_VALGRIND */
+
+#endif /* header guard */