build: fix binary location in stap files --with-driver-modules

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.
This commit is contained in:
Laine Stump
2012-08-10 23:11:26 -04:00
parent 4d448b1156
commit 54264111ff
3 changed files with 18 additions and 2 deletions
+12
View File
@@ -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";