Debian Codegraph @

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

raw
1 set test "pr18649"
2 if {![installtest_p]} { untested $test; return }
3 if {![uprobes_p]} { untested "$test"; return }
4
5 set test_srcpath "[pwd]/test.c"
6 set test_exepath "[pwd]/test"
7 set test_stppath "[pwd]/test.stp"
8
9 set test_fp [open $test_srcpath "w"]
10 puts $test_fp "
11 int
12 testfc(int arg)
13 {
14 return arg;
15 }
16
17 int
18 main()
19 {
20 testfc(32767);
21 return 0;
22 }
23 "
24 close $test_fp
25
26 set script_fp [open $test_stppath "w"]
27 puts $script_fp "
28 probe process(\"$test_exepath\").function(\"testfc\")
29 {
30 printf(\"%x\\n\", int_arg(1))
31 }
32 "
33 close $script_fp
34
35
36 for {set i 0} {$i < [arch_compile_flags]} {incr i} {
37 foreach j { \ -g } {
38 set test_flags "compiler=gcc [arch_compile_flag $i]"
39 set test_flags "$test_flags additional_flags=$j"
40 set res [target_compile $test_srcpath $test_exepath executable $test_flags]
41 if { $res != "" } {
42 fail "compiling test.c $test_flags"
43 catch {exec rm -f $test_srcpath}
44 return
45 } else {
46 pass "compiling test.c $test_flags"
47 }
48
49 set ok 0
50 spawn stap --prologue-searching=never $test_stppath -c $test_exepath
51 expect {
52 -timeout 120
53 -re {^WARNING:[^\r\n]*No DWARF information found[^\r\n]*\r\n} { exp_continue }
54 -re {^7fff\r\n} { incr ok; exp_continue }
55 timeout { fail "$test (timeout)" }
56 eof { }
57 }
58 catch { close }; catch { wait }
59 if {$ok == 1} { pass "$test ($test_flags)" } { fail "$test" }
60 }
61 }
62
63 catch {exec rm -f $test_srcpath $test_exepath $test_stppath}