Feature requests: list of PIDS, and all threads

Alexander Kriegisch kriegaex at freetz.org
Wed Mar 7 22:46:11 UTC 2012


Being just a user like you (not even a very experienced one), I hope you
do not mind me commenting a bit on your inquiry:

George Spelvin, 07.03.2012 20:59:
>    -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`".

Sounds like nice to have. I had the same problem before. BTW, it is
quite common to optionally separate options from a trailing command line
argument by "--", should it ever be necessary to mix pids and a command
line.

> 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.)

This also sounds reasonable.

> 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.
> 
>    This leads to a slight infidelity (for example a pipe write might not
>    be shown until *after* the corresponding read returned), but would make
>    other parts of understanding multi-threaded output much clearer.

Yes, it would be nice to have and greatly improve readability. The only
current way of avoiding this is -ff, but then later there is no easy way
of having a chronological view across all pids/threads. What I did
earlier was to use -ff, import all logs into Excel, create a list
sortable by timestamp and filterable by pid, which gives me a powerful
way to have the best of both: details per pid and chronological view for
one, multiple or all pids. But it involves a bit of manual work. I am
sure it can be automated via a shell script, but I have not used it
often enough to bother to automate it yet.
--
Alexander Kriegisch (kriegaex)
http://freetz.org





More information about the Strace-devel mailing list