Feature requests: list of PIDS, and all threads

George Spelvin linux at horizon.com
Wed Mar 7 19:59:02 UTC 2012


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`".

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

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.

Thank you of course, very much, for my single-most-useful debugging tool.




More information about the Strace-devel mailing list