| 1 |
probe process.function("main") |
| 2 |
{ |
| 3 |
printf("$argc: %d\n", $argc); |
| 4 |
printf("@var(\"argc\"): %d\n", @var("argc")); |
| 5 |
|
| 6 |
printf("user_string($argv[0]): %s\n", user_string($argv[0])); |
| 7 |
printf("user_string(@var(\"argv\")[0]): %s\n", user_string(@var("argv")[0])); |
| 8 |
} |
| 9 |
|
| 10 |
probe process.function("sub") |
| 11 |
{ |
| 12 |
printf("$foo->bar: %d\n", $foo->bar); |
| 13 |
printf("@var(\"foo\")->bar: %d\n", @var("foo")->bar); |
| 14 |
} |
| 15 |
|
| 16 |
/* NB: can't just use syscall.utimes, because with HAVE_SYSCALL_WRAPPERS the |
| 17 |
* primary sys_utimes function has all long types. Also, all architectures |
| 18 |
* effectively HAVE_SYSCALL_WRAPPERS starting in 3.10! */ |
| 19 |
%(arch != "s390" %? |
| 20 |
// On s390x, the utimes() wrapper and function both just get longs, |
| 21 |
// so we'll have to use @cast(). |
| 22 |
# The previous "SYSC_utimes", "sys_utimes", "do_futimesat" was no longer hit on 5.xx kernel |
| 23 |
# do_utimes seems to work with 4.xx and 5.xx kernel |
| 24 |
probe kernel.function("do_utimes")? |
| 25 |
{ |
| 26 |
printf("$times$$: %s\n", $times$$); |
| 27 |
printf("$times[1]$$: %s\n", $times[1]$$); |
| 28 |
printf("@var(\"times\")$$: %s\n", @var("times")$$); |
| 29 |
printf("@var(\"times\")[1]$$: %s\n", @var("times")[1]$$); |
| 30 |
} |
| 31 |
%) |
| 32 |
|
| 33 |
probe process.function("sub").return |
| 34 |
{ |
| 35 |
/* Take the address and dereference to get current value. */ |
| 36 |
printf("user_int(&$foo->bar): %d\n", user_int(&$foo->bar)); |
| 37 |
printf("user_int(&@var(\"foo\")->bar): %d\n", user_int(&@var("foo")->bar)); |
| 38 |
|
| 39 |
/* $foo->bar is 42 (on entry), the offset of bar in struct foo is zero, |
| 40 |
so taking the address of that field is 42 again. */ |
| 41 |
printf("&@cast($foo->bar, \"struct foo\")->bar: %d\n", |
| 42 |
&@cast($foo->bar, "struct foo")->bar); |
| 43 |
printf("$foo->bar == @entry($foo->bar): %s\n", |
| 44 |
$foo->bar == @entry($foo->bar) ? "true" : "false"); |
| 45 |
} |