❦ 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);
}

> 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
-- 
Use variable names that mean something.
            - The Elements of Programming Style (Kernighan & Plauger)

Attachment: signature.asc
Description: PGP signature

Reply via email to