diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-01-24 13:47:25 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-01-24 15:56:14 +0000 |
commit | d08806adfc5d111b4b6c761540ff508d3f25b66e (patch) | |
tree | 58bcd51e9cd8e7a41a27b439dde83f34d765e4b7 /appliance | |
parent | b7122eaa58ccd153a8c39bc3b6f890755c5df089 (diff) | |
download | libguestfs-d08806adfc5d111b4b6c761540ff508d3f25b66e.tar.gz libguestfs-d08806adfc5d111b4b6c761540ff508d3f25b66e.tar.xz libguestfs-d08806adfc5d111b4b6c761540ff508d3f25b66e.zip |
Enable running the daemon under valgrind.
This commit allows you to run the daemon under valgrind. You have to
enable it at configure time:
./configure --enable-valgrind-daemon
This should *not* be done for production builds.
When this feature is enabled, valgrind is added to the appliance and
the daemon is run under valgrind. Log messages from valgrind are
passed back over a virtio-serial channel into a file called
'valgrind.log.$PID' in the top build directory.
Running 'make check', 'make extra-tests' etc causes many
valgrind.log.* files to be created which must be examined by hand.
Diffstat (limited to 'appliance')
-rw-r--r-- | appliance/Makefile.am | 9 | ||||
-rwxr-xr-x | appliance/init | 10 | ||||
-rw-r--r-- | appliance/packagelist.in | 4 |
3 files changed, 20 insertions, 3 deletions
diff --git a/appliance/Makefile.am b/appliance/Makefile.am index e2e8b96d..99896be3 100644 --- a/appliance/Makefile.am +++ b/appliance/Makefile.am @@ -42,13 +42,18 @@ make.sh: make.sh.in chmod +x $@-t mv $@-t $@ +PACKAGELIST_CPP_FLAGS = -D$(DISTRO)=1 +if VALGRIND_DAEMON +PACKAGELIST_CPP_FLAGS += -DVALGRIND_DAEMON=1 +endif + packagelist: packagelist.in - cpp -undef -D$(DISTRO)=1 < $< | \ + cpp -undef $(PACKAGELIST_CPP_FLAGS) < $< | \ grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t mv $@-t $@ excludelist: excludelist.in - cpp -undef -D$(DISTRO)=1 < $< | \ + cpp -undef $(PACKAGELIST_CPP_FLAGS) < $< | \ grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t mv $@-t $@ diff --git a/appliance/init b/appliance/init index 0f32a55c..1d69339b 100755 --- a/appliance/init +++ b/appliance/init @@ -106,8 +106,16 @@ if grep -sq guestfs_verbose=1 /proc/cmdline; then fi if ! grep -sq guestfs_rescue=1 /proc/cmdline; then + # Run the daemon under valgrind if ./configure --enable-valgrind-daemon + vg_channel=/dev/virtio-ports/org.libguestfs.valgrind + if [ -w $vg_channel ]; then + exec 3>$vg_channel + vg="valgrind --leak-check=full --log-fd=3 --error-exitcode=119 --max-stackframe=8388608 --child-silent-after-fork=yes" + echo "enabling valgrind: $vg" + fi + # The host will kill qemu abruptly if guestfsd shuts down normally - guestfsd + $vg guestfsd # Otherwise we try to clean up gracefully. For example, this ensures that a # core dump generated by the guest daemon will be written to disk. diff --git a/appliance/packagelist.in b/appliance/packagelist.in index 5735a5ad..b42c5107 100644 --- a/appliance/packagelist.in +++ b/appliance/packagelist.in @@ -130,3 +130,7 @@ tar xfsprogs #endif zerofree + +#ifdef VALGRIND_DAEMON +valgrind +#endif |