Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/at_var_pie.exp

raw
1 set test "at_var_pie"
2 set testpath "$srcdir/$subdir"
3 set exefile "[pwd]/$test"
4 set stap_path $env(SYSTEMTAP_PATH)/stap
5 set staprun_path $env(SYSTEMTAP_PATH)/staprun
6
7 # Test that @var("var@cu", "module") work with PIE.
8
9 set ::result_string {@var("foo", @1)->bar: 42
10 @var("foo@at_var.c", @1)->bar: 42
11 @var("foo@at_var.c", @2)->bar: 42
12 @var("foo", @1)$: {.bar=42}
13 @var("foo", @1)$$: {.bar=42}
14 @defined(@var("foo", "badmodle")->bar): NO
15 @defined(@var("foo", @3)->bar): NO
16 @defined(@var("[email protected]", @1)->bar): NO
17 @var("foo")->bar: 42}
18
19 # Only run on make installcheck and uprobes present.
20 if {! [installtest_p]} { untested "$test"; return }
21
22 set res [target_compile ${testpath}/at_var.c $exefile executable \
23 "additional_flags=-O2 additional_flags=-g additional_flags=-fPIE additional_flags=-pie"]
24
25 if { $res != "" } {
26 verbose "target_compile failed: $res" 2
27 fail "unable to compile ${test}.c"
28 }
29
30 foreach runtime [get_runtime_list] {
31 if {$runtime != ""} {
32 if {$runtime == "dyninst"} {
33 # dyninst lacks support for relocations as required by PIE
34 setup_kfail 15052 "*-*-*"
35 }
36
37 stap_run3 "$test ($runtime)" $srcdir/$subdir/at_var_func.stp -c ./$test \
38 $exefile "$stap_path:$exefile:$staprun_path" \
39 "$stap_path:$staprun_path" --runtime=$runtime
40
41 } elseif {[uprobes_p]} {
42 stap_run3 $test $srcdir/$subdir/at_var_func.stp -c ./$test $exefile \
43 "$stap_path:$exefile:$staprun_path" "$stap_path:$staprun_path"
44
45 } else {
46 untested "$test"
47 }
48 }
49
50 # Cleanup
51 if { $verbose == 0 } { catch { exec rm -f $test } }