In February 2011, I finally go around to trying out the code.
Paul seems to be developing on/for Ubuntu, but I wanted to try it on Fedora 14. I had a number of problems, first indentifying which RPM packages I needed to install for the build. And then there were various compile problems, and it took me a while to figure out how to resolve these problems, as I would not claim to be any sort of expert on this.
Here is a list of the RPM packages I needed to install to get the code to compile:
binutils-devel
elfutils-libelf-devel
kernel-devel
libdwarf
libdwarf-devel
libdwarf-static
zlib-devel
I was eventually able to work out the necessary patches to get it to compile on Fedora 14. I did try emailing Paul to give him some feedback, and I think he may have read my emails, but so far I have never received a reply back from him!
Here for posterity, I publish my patch, just to prove I did some work! But note that this is already out of date, as Paul's DTrace for Linux port has continued to moved on.
$ diff -uNr dtrace-20110215 dtrace-20110215.fed14/
diff -uNr dtrace-20110215/cmd/ctfconvert/dwarf.c dtrace-20110215.fed14/cmd/ctfconvert/dwarf.c
--- dtrace-20110215/cmd/ctfconvert/dwarf.c 2010-08-24 23:34:26.000000000 +0100
+++ dtrace-20110215.fed14/cmd/ctfconvert/dwarf.c 2011-03-18 01:19:57.786335906 +0000
@@ -88,9 +88,9 @@
#include <errno.h>
#include "linux.h"
#include <libelf.h>
-#include <libdwarf.h>
+#include <libdwarf/libdwarf.h>
#include <libgen.h>
-#include <dwarf.h>
+#include <libdwarf/dwarf.h>
#include "ctf_headers.h"
#include "ctftools.h"
diff -uNr dtrace-20110215/cmd/ctfconvert/makefile dtrace-20110215.fed14/cmd/ctfconvert/makefile
--- dtrace-20110215/cmd/ctfconvert/makefile 2010-10-17 17:55:26.000000000 +0100
+++ dtrace-20110215.fed14/cmd/ctfconvert/makefile 2011-03-18 01:19:23.255448742 +0000
@@ -44,7 +44,7 @@
LIBS = ../../build/libctf.a -ldwarf -lbfd -lelf -lz
all:
- @if [ ! -f /usr/lib/libdwarf.a ]; then \
+ @if [ ! -f /usr/lib64/libdwarf.a ]; then \
echo "=================================================================" ; \
echo "=== You need /usr/lib/libdwarf.a and /usr/lib/libbfd.a installed to build." ; \
echo "=== " ; \
diff -uNr dtrace-20110215/tools/build.pl dtrace-20110215.fed14/tools/build.pl
--- dtrace-20110215/tools/build.pl 2011-01-26 23:36:06.000000000 +0000
+++ dtrace-20110215.fed14/tools/build.pl 2011-03-19 14:16:48.725192127 +0000
@@ -59,7 +59,7 @@
}
if (! -f "/usr/include/gelf.h") {
- print "Error: you dont appear to have /usr/include/elf.h, which means\n";
+ print "Error: you dont appear to have /usr/include/gelf.h, which means\n";
print "compilation will fail. You should add the libelf-dev package to\n";
print "your system and retry the 'make all'.\n";
exit(1);
diff -uNr dtrace-20110215/tools/mkctf.sh dtrace-20110215.fed14/tools/mkctf.sh
--- dtrace-20110215/tools/mkctf.sh 2010-08-26 10:03:21.000000000 +0100
+++ dtrace-20110215.fed14/tools/mkctf.sh 2011-03-18 01:21:59.600884493 +0000
@@ -19,11 +19,11 @@
cd $build_dir
cmd=`grep '^cmd_' $pwd/build/driver/.cpu_x86.o.cmd |
sed -e 's/^.* := //' |
-sed -e 's/-Wp,-MD[^ ]* /-g /' |
+sed -e 's/-Wp,-MD[^ ]* /-gdwarf-2 /' |
sed -e 's/\\\\//g' |
sed -e 's/cpu_x86/ctf_struct/g' `
#echo $cmd
eval $cmd
cd $pwd
-build/ctfconvert -L label -o build/linux-$BUILD_KERNEL.ctf build/driver/.tmp_ctf_struct.o
+build/ctfconvert -L label -o build/linux-$BUILD_KERNEL.ctf build/driver/ctf_struct.o
ls -l build/linux-$BUILD_KERNEL.ctf
And here is a very quick and basic test, to show DTrace running:
# uname -a:
Linux fed14-64 2.6.35.11-83.fc14.x86_64 #1 SMP Mon Feb 7 07:06:44 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
# make load
tools/load.pl
01:26:50 Syncing...
01:26:50 Loading: build/driver/dtracedrv.ko
01:26:52 Preparing symbols...
01:26:52 Probes available: 314700
01:26:56 Time: 6s
# dtrace -n BEGIN
dtrace: description 'BEGIN' matched 1 probe
CPU ID FUNCTION:NAME
1 1 :BEGIN
^C
Admittedly, that is the most basic DTrace one-liner you can possibly try. But I did also try a few 'syscall' one-liners, mostly with success.
Anyway, once I got this going, I wanted to try with Paul's latest release of the code, to get his latest bug fixes, but I was stopped in my tracks, as his FTP site was down. And it continued to be down, for over a week, which was quite frustrating. I tried emailing him, and leaving a blog comment, but again, I got no response. And there was no mention of this problem on his web sites, or blog.
Eventualy, while Googling, I discovered that Paul has a Twitter account, and that he had announced there, that he has a new host name for his FTP site. There is no mention of Paul's Twitter account on his web sites or blogs, at this moment. So I will publicize it here, as he does seem to make good use of it to report progress with DTrace for Linux:
http://twitter.com/#!/crispeditor
And for anyone wanting to try compiling the DTrace for Linux code, please note the new download site is:
ftp://crisp.dyndns-server.com/pub/release/website/dtrace/
Ok, so now I guess I had better download the latest release of the code, and try it out.