diff options
author | Stef Walter <stefw@gnome.org> | 2013-03-27 13:35:06 +0100 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2013-03-27 15:29:29 +0100 |
commit | 7ba193bd9aa23deeca771abcb4c45afcd16f3a9e (patch) | |
tree | c928bd5c54f3258b375e7e5e0fde0e2a9e36ce9c /tools | |
parent | 6d833de7888613c2c6aa3f92d913a37d302a5031 (diff) |
Some basic valgrind integration
* Add the valgrind headers to the build directory
* Set G_SLICE=always-malloc if running under valgrind and
the G_SLICE environment variable has not been set.
* Add a 'make memcheck' target.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 1 | ||||
-rw-r--r-- | tools/realm.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index 4335d98..2f89bf4 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -19,6 +19,7 @@ realm_SOURCES = \ AM_CFLAGS = \ -I$(top_srcdir)/dbus \ + -I$(top_srcdir)/build \ -I$(top_builddir)/dbus \ -DLOCALEDIR=\""$(datadir)/locale"\" \ -DREALMD_EXECUTABLE=\""$(privatedir)/realmd"\" \ diff --git a/tools/realm.c b/tools/realm.c index d7cc549..d02c9f2 100644 --- a/tools/realm.c +++ b/tools/realm.c @@ -17,6 +17,8 @@ #include "realm.h" #include "realm-dbus-constants.h" +#include "valgrind/valgrind.h" + #include <glib.h> #include <glib/gi18n.h> #include <glib/gstdio.h> @@ -327,6 +329,12 @@ main (int argc, gint ret; gint i; + /* Behave well under valgrind */ + if (RUNNING_ON_VALGRIND) { + if (!g_getenv ("G_SLICE")) + g_setenv ("G_SLICE", "always-malloc", TRUE); + } + setlocale (LC_ALL, ""); #ifdef ENABLE_NLS |