Quite simple really, just use sed to make the necessary command line switches.
strace wants to have the PIDs passed one per '-p' switch and sed with a easy replace handles all that's necessary.
Observe the output of pidof
c ~ $ pidof apache2 9629 9439 9428 9427 9426 9425 9424 9420
Wrap with sed to create multiple -p switches.
c ~ $ pidof apache2 |sed 's/\([0-9]*\)/\-p \1/g' -p 9629 -p 9439 -p 9428 -p 9427 -p 9426 -p 9425 -p 9424 -p 9420
Now combine with strace.
c ~ $ strace $(pidof apache2 |sed 's/\([0-9]*\)/\-p \1/g') carbon share # strace $(pidof apache2 |sed 's/\([0-9]*\)/\-p \1/g') Process 9629 attached - interrupt to quit Process 9439 attached - interrupt to quit Process 9428 attached - interrupt to quit Process 9427 attached - interrupt to quit Process 9426 attached - interrupt to quit Process 9425 attached - interrupt to quit Process 9424 attached - interrupt to quit Process 9420 attached - interrupt to quit [pid 9439] semop(10846209, 0xb7bd9a28, 1 <unfinished ...> [pid 9629] semop(10846209, 0xb7bd9a28, 1 <unfinished ...> [pid 9428] epoll_wait(10, <unfinished ...> [pid 9427] semop(10846209, 0xb7bd9a28, 1 <unfinished ...> [pid 9426] semop(10846209, 0xb7bd9a28, 1 <unfinished ...> [pid 9424] semop(10846209, 0xb7bd9a28, 1 <unfinished ...> [pid 9420] select(0, NULL, NULL, NULL, {0, 730000} <unfinished ...> [pid 9425] semop(10846209, 0xb7bd9a28, 1 <unfinished ...> [pid 9420] <... select resumed> ) = 0 (Timeout) [pid 9420] waitpid(-1, 0xbff91918, WNOHANG|WSTOPPED) = 0 [pid 9420] select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)
Now go debug some PHP or CGI application in the guts