2

According to What does the “interruptible sleep” state indicate? there is a state called "T".

I tried to run a python script with strace but /proc/pid/stat still showed the the process was in S, waiting on do_wait (cat /proc/6145/wchan -> do_wait)

def f():
    import pdb
    pdb.set_trace()
    print(1)

f()

1 Answers1

3

You seem to have T mixed up with t. From man ps:

               T    stopped by job control signal
               t    stopped by debugger during the tracing

Anyway, to put a process in state T (stopped), kill -STOP its PID, or hit Ctrl+Z while it's running in the terminal. To put a process in state t (being traced), attach to it with ptrace, but don't let it continue like strace does. One way to do this is run gdb, then attach to its PID.