Feature requests: list of PIDS, and all threads

Denys Vlasenko dvlasenk at redhat.com
Thu Mar 8 11:32:12 UTC 2012


On 03/07/2012 08:59 PM, George Spelvin wrote:
> With multi-process and multi-threaded programs becoming more common,
> there are a couple of things I wish strace gave me:
>
> 1) Some way to supply a *list* of pids to be traced, without having to
>     prefix each with "-p".  This would make it much easier to paste
>     in the output of "pgrep" or the like.
>
>     Two options come to mind:
>     -P means "all bare arguments are pids"; the case of mixing
>        pids and a commnd line process is somewhat uncommon.
>     -p takes a whitespace-separated list of pids.  So I could
>        use -p "`pgrep foo`".

I guess we can support -p PID1,PID2 _and_ -p "PID1 PID2".
Why not?

> 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).
We only need an option to indicate this. -T and -t are taken. -P is taken too.
We are running out of alphabet! :)

>
> 3) A third thing that would be really nice would be a "don't break system
>     calls" option.  Basically, if one system call is pending when a second
>     happens, DON'T display<pending...>  unless a reasonable timeout has
>     elapsed; rather just defer printing anything for the first system
>     call until it returns, when it can be printed on one line.

Uhhuh. That would not be so easy to implement. And some people
do want to know exact moment syscalls were entered/exited.

-tt -ff does almost what you want. It separates logs one output file
per pid. A script can be written to combine them into one file,
using timestamps for ordering. Would this satisfy you?

-- 
vda






More information about the Strace-devel mailing list