# Make sure we can use ptrace() on a process probed with systemtap. set TEST_NAME "ptrace" if {![uprobes_p]} { untested "$TEST_NAME : no uprobes support found" return } elseif {![installtest_p]} { untested $TEST_NAME return } # Does 'strace' exist on this system? If not, not much point in going # on further. if {[catch { exec which strace } res]} { fail "$TEST_NAME find 'strace'" return } pass "$TEST_NAME find 'strace'" # Test process.begin set subcmd {strace -e read true} set TEST_NAME "ptrace (begin)" set script {probe process.begin { next }} set cmd {stap -e $script -c $subcmd} set output_found 0 eval spawn $cmd expect { -timeout 180 -re {^read\(\d+, .+\) = \d+\r\n} { set output_found 1 exp_continue } } catch close wait if { $output_found } { pass "$TEST_NAME" } else { fail "$TEST_NAME" } # The never probe won't get hit, but including 'print_ubacktrace()' # will enable task_finder and vma tracking. set TEST_NAME "ptrace (never)" set script {probe never{print_ubacktrace()}} set cmd {stap -e $script -c $subcmd} set output_found 0 eval spawn $cmd expect { -timeout 180 -re {^read\(\d+, .+\) = \d+\r\n} { set output_found 1 exp_continue } } catch close wait if { $output_found } { pass "$TEST_NAME" } else { fail "$TEST_NAME" }