When attempting to build an executable of Ruby that includes systemtap marker using SystemTap 1.4 some arguments for markers were truncated to 8 bits in size. The problem is caused by the sdt_uprobe_var_expanding_visitor::get_register_width() function "%rbx" as being a bytes sized (8 bit) register rather that a full 64-bit registers. To replicate problem on rhel6 or fedora: 1) install systemtap-1.4 on the machine 2a) make sure that the systemtap dtrace is available in /usr/bin/dtrace 2b) make sure that the uprobes modules is available, as root: make -C /usr/share/systemtap/runtime/uprobes 3) download the http://people.redhat.com/wcohen/ruby-1.8.7.299-6.el6.dtrace_4.src.rpm 3) build and install the ruby rpms 4) Verify that probes are available with: stap -L 'process("/usr/lib64/libruby.so.1.8").mark("*") 5) Use the following script to demonstrate the problem stap -e 'probe process("/usr/lib64/libruby.so.1.8").function("rb_class2name").return {printf("$return=0x%x %s\n", $return, user_string($return))} probe process("/usr/lib64/libruby.so.1.8").mark("function__entry"){printf("$arg1=0x%x\n", $arg1)}' in another window run a ruby program for example ruby ~/rpmbuild/BUILD/ruby-1.8.7.299/ruby-1.8.7-p299/sample/biorhythm.rb See something like the following out from the systemtap script where $arg1 is just the low 8 bits of the pointer: $return=0x9d4450 Hash $arg1=0x50 $return=0x9c5c30 String $arg1=0x30
The following commits fix the problem: commit ae1418f00b0bd242fbf169813be5800609d36892 Author: Frank Ch. Eigler <fche@redhat.com> Date: Wed Jan 19 08:20:22 2011 -0500 PR12411 cont'd: use enum type decl * tapsets.cxx (sdt_uprobe_var_expanding_visitor): Make regwidths an enum type decl, not an anonymous-enum-typed variable. Move DRI macro #define/#undef just around its use. commit 46a94997388279d381e38a675411b99a202f339d Author: Stan Cox <scox@redhat.com> Date: Wed Jan 19 07:09:01 2011 -0500 Switch to using a register width table instead of heuristic code. * tapsets.cxx (sdt_uprobe_var_expanding_visitor): Add DRI and regwidth Change dwarf_regs to be a regname/regwidth pair. Change initializer. * (sdt_uprobe_var_expanding_visitor::visit_target_symbol): Use it.