engine->flags = events | (engine->flags & ENGINE_STOP);
utrace->utrace_flags |= events;
- /* FIXME: Hmm, unsure about calling set_tsk_thread_flag()... */
- if ((events & UTRACE_EVENT_SYSCALL) &&
- !(old_utrace_flags & UTRACE_EVENT_SYSCALL))
- set_tsk_thread_flag(target, TIF_SYSCALL_TRACE);
-
ret = 0;
if ((old_flags & ~events) && target != current &&
!task_is_stopped_or_traced(target) && !target->exit_state) {
*/
BUG_ON(utrace->death);
flags &= UTRACE_EVENT(REAP);
- } else if (!(flags & UTRACE_EVENT_SYSCALL) &&
- test_tsk_thread_flag(task, TIF_SYSCALL_TRACE)) {
- clear_tsk_thread_flag(task, TIF_SYSCALL_TRACE);
}
if (!flags) {
--- /dev/null
+# Make sure we can use ptrace() on a process probed with systemtap.
+
+set TEST_NAME "ptrace"
+if {![utrace_p]} {
+ untested "$TEST_NAME : no kernel utrace support found"
+ return
+} elseif {![installtest_p]} {
+ untested $TEST_NAME
+ return
+}
+
+# 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\+\+\+ exited with 0 \+\+\+\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\+\+\+ exited with 0 \+\+\+\r\n} {
+ set output_found 1
+ exp_continue
+ }
+}
+catch close
+wait
+if { $output_found } { pass "$TEST_NAME" } else { fail "$TEST_NAME" }