Vincent Bernat writes:

>  ❦ 13 septembre 2016 19:10 CEST, Lluís Vilanova <[email protected]> :
>> Hi! I've been writing some very simple systemtap scripts, and printing the
>> values of arguments to user-defined probe marks always shows zeroes.
>> 
>> Here's an minimal failing example:
>> 
>> $ cat >events.d <<\EOF
>> provider test
>> {
>> probe f(int a1, int a2);
>> };
>> EOF
>> 
>> $ cat >test.c <<\EOF
>> #include <stdio.h>
>> #include "events.h"
>> 
>> int f(int a1, int a2)
>> {
>> TEST_F(a1, a2);
>> printf("a1=%d a2=%d\n", a1, a2);
>> }
>> 
>> int main(int argc, char *argv[])
>> {
>> f(1, 1);
>> f(2, 2);
>> return 0;
>> }
>> EOF
>> 
>> $ dtrace -s events.d -G
>> $ dtrace -s events.d -h
>> $ gcc -o test -O0 -g test.c events.o
>> $ sudo stap test.stp -c './test'
>> a1=1 a2=1
>> a1=2 a2=2
>> hello
>> 0 0
>> 0 0

> You didn't provide the test.stp script. I suppose this is something like:

> probe process.begin {
>   printf("hello\n");
> }
> probe process("./test").mark("f") {
>   printf("%d %d\n", $arg1, $arg2);
> }

That's exactly it, sorry.


>> Bug #691167 should no longer be applicable, since I'm running a stock debian
>> kernel (4.7) with UPROBES enabled:

> It's odd that you succeed in compiling anything with 4.7 as it needs a
> patch to work. I am uploading an updated version with this patch:
>  
> https://sourceware.org/git/gitweb.cgi?p=systemtap.git;a=commitdiff;h=8f888904d8de9a798e4664caa373ea552366b304;hp=79be36dbc39d25270261b857e51edbc198f204d7

> With this patch applied, I can compile your example and I get:

> a1=1 a2=1
> a1=2 a2=2
> hello
> hello
> 1 1
> 2 2

Sorry, I said 4.7 from the top of my head, but I was in fact testing with
debian's 4.6. But I do remember patching "transport.c" to compile scripts with
my locally built 4.8.0-rc5 (same patch needed for 4.7).

I just re-tested with 4.6 and it's failing. I also re-checked my local
"transport.c" patch (I'm checking against LINUX_VERSION_CODE) and re-tested with
debian's 4.7, and I'm still getting the "all zeroes" error.


Thanks,
  Lluis

Reply via email to