probe process.function("main") { printf("$argc: %d\n", $argc); printf("@var(\"argc\"): %d\n", @var("argc")); printf("user_string($argv[0]): %s\n", user_string($argv[0])); printf("user_string(@var(\"argv\")[0]): %s\n", user_string(@var("argv")[0])); } probe process.function("sub") { printf("$foo->bar: %d\n", $foo->bar); printf("@var(\"foo\")->bar: %d\n", @var("foo")->bar); } /* NB: can't just use syscall.utimes, because with HAVE_SYSCALL_WRAPPERS the * primary sys_utimes function has all long types. Also, all architectures * effectively HAVE_SYSCALL_WRAPPERS starting in 3.10! */ %(arch != "s390" %? // On s390x, the utimes() wrapper and function both just get longs, // so we'll have to use @cast(). # The previous "SYSC_utimes", "sys_utimes", "do_futimesat" was no longer hit on 5.xx kernel # do_utimes seems to work with 4.xx and 5.xx kernel probe kernel.function("do_utimes")? { printf("$times$$: %s\n", $times$$); printf("$times[1]$$: %s\n", $times[1]$$); printf("@var(\"times\")$$: %s\n", @var("times")$$); printf("@var(\"times\")[1]$$: %s\n", @var("times")[1]$$); } %) probe process.function("sub").return { /* Take the address and dereference to get current value. */ printf("user_int(&$foo->bar): %d\n", user_int(&$foo->bar)); printf("user_int(&@var(\"foo\")->bar): %d\n", user_int(&@var("foo")->bar)); /* $foo->bar is 42 (on entry), the offset of bar in struct foo is zero, so taking the address of that field is 42 again. */ printf("&@cast($foo->bar, \"struct foo\")->bar: %d\n", &@cast($foo->bar, "struct foo")->bar); printf("$foo->bar == @entry($foo->bar): %s\n", $foo->bar == @entry($foo->bar) ? "true" : "false"); }