set result_string3 {user_int(&$foo->bar): 40
user_int(&@var("foo")->bar): 40
&@cast($foo->bar, "struct foo")->bar: 42
+$foo->bar == @entry($foo->bar): true}
+
+set result_string4 {
&@cast(@var("foo")->bar, "struct foo")->bar: 42
-$foo->bar == @entry($foo->bar): true
@var("foo")->bar == @entry(@var("foo")->bar): true}
# s390x machines can't do $utimes$$, since all syscall args are
if {! [installtest_p]} { untested "$test"; return }
if {! [uretprobes_p]} { untested "$test"; return }
+# A) Test the "current" (post-4a8652800d4dc7d57d3e2ac5463c1d292b9742a8) version behavior:
+
set res [target_compile ${testpath}/${test}.c ${test} executable "additional_flags=-O2 additional_flags=-g"]
if { $res != "" } {
verbose "target_compile failed: $res" 2
stap_run3 $test_name $srcdir/$subdir/$test.stp -c ./${test} -w
}
+# B) Test the legacy/--compatible=4.0 (pre-4a8652800d4dc7d57d3e2ac5463c1d292b9742a8) behavior:
+
+set ::result_string "${::result_string}$result_string4"
+
+set res [target_compile ${testpath}/${test}.c ${test} executable "additional_flags=-O2 additional_flags=-g"]
+if { $res != "" } {
+ verbose "target_compile failed: $res" 2
+ fail "${test}: unable to compile ${test}.c"
+} else {
+ stap_run3 $test $srcdir/$subdir/$test.stp -c ./${test} -w --compatible=4.0
+}
+
+# Test for target program compiled without optimization
+set test_name "${test} (non-optimized)"
+set res [target_compile ${testpath}/${test}.c ${test} executable "additional_flags=-g"]
+if { $res != "" } {
+ verbose "target_compile failed: $res" 2
+ fail "${test_name}: unable to compile ${test}.c"
+} else {
+ stap_run3 $test_name $srcdir/$subdir/$test.stp -c ./${test} -w --compatible=4.0
+}
+
# Cleanup
if { $verbose == 0 } { catch { exec rm -f $test } }
%(arch != "s390" %?
// On s390x, the utimes() wrapper and function both just get longs,
// so we'll have to use @cast().
-probe kernel.function("SYSC_utimes")!, kernel.function("sys_utimes")
+probe kernel.function("SYSC_utimes")!, kernel.function("sys_utimes")!, kernel.function("do_futimesat")
{
printf("$utimes$$: %s\n", $utimes$$);
printf("$utimes[1]$$: %s\n", $utimes[1]$$);
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("&@cast(@var(\"foo\")->bar, \"struct foo\")->bar: %d\n",
- &@cast(@var("foo")->bar, "struct foo")->bar);
-
- /* Note that variables are taken at entry in both cases. */
printf("$foo->bar == @entry($foo->bar): %s\n",
$foo->bar == @entry($foo->bar) ? "true" : "false");
+%( systemtap_v <= "4.0" %?
+ printf("&@cast(@var(\"foo\")->bar, \"struct foo\")->bar: %d\n",
+ &@cast(@var("foo")->bar, "struct foo")->bar);
printf("@var(\"foo\")->bar == @entry(@var(\"foo\")->bar): %s\n",
@var("foo")->bar == @entry(@var("foo")->bar) ? "true" : "false");
+%)
}