Feature requests: list of PIDS, and all threads

Denys Vlasenko dvlasenk at redhat.com
Fri Mar 9 12:52:47 UTC 2012


On 03/09/2012 12:13 AM, George Spelvin wrote:
>>> 2) A simple way to trace all threads of a process.  strace doesn't really
>>>      take process IDs but thread IDs, so if a process has multiple threads,
>>>      only the primary process gets traced.  I'd like an easy way to say
>>>      "what the heck is firefox doing?" and get all the threads.
>>>      (Once again, this is working around a limitation of pgrep.)
>
>> The code to do so is there (-p PID -f would do what you want even today -
>> but it will also follow forks which you didn't ask for).
>
> Oh!  Actually, that's mostly what I'm interested in; I just didn't
> know that worked!
>
> I thought I had tried it once and had it not work, but either my memory
> is faulty or strace improved, bexause you're absolutely right!
>
>> We only need an option to indicate this. -T and -t are taken. -P is taken too.
>> We are running out of alphabet! :)
>
> Given the above, what might be more useful is a "drop thread on exec" option,
> so I'm tracing a single multi-threaded program, and not what it execs.
> That might factor into your choice of letters.

execve takes down entire multi-threaded program, thus what you propose
does not make sense: after execve in any thread, your multi-threaded
program won't be there anymore.

Did you mean "track thread creation (clone), but not process creation
([v]fork that is)"?

-- 
vda




More information about the Strace-devel mailing list