Feature requests: list of PIDS, and all threads
Denys Vlasenko
dvlasenk at redhat.com
Fri Mar 9 15:31:13 UTC 2012
On 03/09/2012 04:17 PM, Dmitry V. Levin wrote:
> On Thu, Mar 08, 2012 at 12:32:12PM +0100, Denys Vlasenko wrote:
>> 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?
>
> Of course we can, and you've implemented this with commit
> v4.6-258-ge8172b7 already, but the same effect can be trivially
> achieved by using sed, e.g.
> strace `pgrep whatever |sed 's/^/-p /'`
> so there is no real benefit for users from adding this feature.
You are right, pgrep/pidof output can be massaged into series of -p PID
options.
It requires user to distract himself from whatever he is doing, and write
a small sed program, and get it right.
For pidof, sed will be a bit more complicated than for pgrep:
strace `pidof PROG | sed -e 's/^/ /' -e 's/ / -p /g'`
Where is the pain threshold after which we want to make user's life
easier by not requiring this sed gymnastics? I don't know.
--
vda
More information about the Strace-devel
mailing list