]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: fix binary location in stap files --with-driver-modules
authorLaine Stump <laine@laine.org>
Fri, 10 Aug 2012 21:14:21 +0000 (17:14 -0400)
committerLaine Stump <laine@laine.org>
Sat, 11 Aug 2012 03:11:26 +0000 (23:11 -0400)
libvirt_qemu_probes.stp stopped working after switching to a build
that used --with-driver-modules. This was because the symbols listed
int libvirt_qemu_probes.stp are no longer in $(bindir)/libvirtd, but
are now in $(libdir)/connection-driver/libvirt_driver_qemu.so.

This patch enhances dtrace2systemtap.pl (which generates the .stp
files from .d files) to look for a new "module" setting in the
comments of the .d file (similar to the existing "binary" setting),
and to look for a --with-modules option. If the --with-modules option
is set *and* a "module" setting is present in the .d file, the process
name for the stap line is set to

   $libdir/$module

If either of these isn't true, it reverts to the old behavior.

src/Makefile.am was also modified to add the --with-modules option
when the build calls for it, and src/libvirt_qemu_probes.d has added a
"module" line pointing to the correct .so file for the qemu driver.

src/Makefile.am
src/dtrace2systemtap.pl
src/libvirt_qemu_probes.d

index 6ed4a41f3a3ebf1e7eae84ec25246bb49609a1b0..79b4e599208a277c24f4c8fea9d6661d198b7619 100644 (file)
@@ -1393,6 +1393,9 @@ nodist_libvirt_la_SOURCES = libvirt_probes.h
 if WITH_REMOTE
 nodist_libvirt_driver_remote_la_SOURCES = libvirt_probes.h
 endif WITH_REMOTE
+if WITH_DRIVER_MODULES
+DTRACE2SYSTEMTAP_FLAGS = --with-modules
+endif
 
 BUILT_SOURCES += libvirt_probes.h libvirt_probes.stp libvirt_functions.stp
 
@@ -1429,9 +1432,9 @@ RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
 libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl
        $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gensystemtap.pl $(RPC_PROBE_FILES) > $@
 
-%_probes.stp: %_probes.d $(srcdir)/dtrace2systemtap.pl
+%_probes.stp: %_probes.d $(srcdir)/dtrace2systemtap.pl $(top_builddir)/config.status
        $(AM_V_GEN)$(PERL) -w $(srcdir)/dtrace2systemtap.pl \
-         $(bindir) $(sbindir) $(libdir) $< > $@
+         $(DTRACE2SYSTEMTAP_FLAGS) $(bindir) $(sbindir) $(libdir) $< > $@
 
 CLEANFILES += libvirt_probes.h libvirt_probes.o libvirt_probes.lo \
               libvirt_qemu_probes.h libvirt_qemu_probes.o \
index c8d42d74da89cc853ce351a359037083e809774d..d57de68f66783c3c0c3b6a81b7bcfdbb8e43caf1 100755 (executable)
@@ -31,6 +31,13 @@ my $file;
 my @files;
 my %files;
 
+my $with_modules = 0;
+if ($ARGV[0] eq "--with-modules") {
+    # set if we want to honor the "module" setting in the .d file
+    $with_modules = 1;
+    shift @ARGV;
+}
+
 my $bindir = shift @ARGV;
 my $sbindir = shift @ARGV;
 my $libdir = shift @ARGV;
@@ -54,6 +61,8 @@ while (<>) {
             $files{$file}->{prefix} = $1;
         } elsif (m,^\s*\#\s*binary:\s*(\S+)\s*$,) {
             $files{$file}->{binary} = $1;
+        } elsif (m,^\s*\#\s*module:\s*(\S+)\s*$,) {
+            $files{$file}->{module} = $1;
         } else {
             # ignore unknown comments
         }
@@ -98,6 +107,9 @@ foreach my $file (@files) {
         if (exists $files{$file}->{binary}) {
             $binary = $sbindir . "/" . $files{$file}->{binary};
         }
+        if ($with_modules && exists $files{$file}->{module}) {
+            $binary = $libdir . "/" . $files{$file}->{module};
+        }
 
         print "probe $pname = process(\"$binary\").mark(\"$name\") {\n";
 
index 6916778434790451cee1884ec016a774c9229180..e4449a9922c50077832f5fdafe69c4c932da055c 100644 (file)
@@ -2,6 +2,7 @@ provider libvirt {
         # file: src/qemu/qemu_monitor.c
         # prefix: qemu
         # binary: libvirtd
+        # module: libvirt/connection-driver/libvirt_driver_qemu.so
         # Monitor lifecycle
         probe qemu_monitor_new(void *mon, int refs, int fd);
         probe qemu_monitor_ref(void *mon, int refs);