Feature requests: list of PIDS, and all threads

Alexander Kriegisch kriegaex at freetz.org
Thu Mar 8 13:47:05 UTC 2012


>>> 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?
> 
> I am writing such a script right now, but saw on Ubuntu 11.10 (strace
> 4.5.20) that -ff does not record PID information inside the log file,
> only append the pid to the log file name. With my self-compiled strace
> 4.6 on mipsel embedded platform though, the logs contain pid information
> as first column. The NEWS document does not mention a change in log file
> format though. Can you comment on this please? I can easily create a
> script which supports both versions, doing different 'sed' replacements,
> but I was just wondering why this is necessary at all.

Okay, I just saw that the PIDs are only inserted into the log file if
strace is called with multiple -p arguments, which is what I did on the
mipsel platform. Anyway, these two cases need to be handled anyway:

> Necessary 'sed' replacement in 4.5.20: insert pid after timestamp
> (otherwise we cannot sort by timestamp).
> 
> Necessary 'sed' replacement in 4.6: move pid from first column (before
> timestamp) to second column (otherwise we again cannot sort by timestamp).

Okay, here is the script as an attachment. Call it like this:

./strace_no_pending mc.log mc
./strace_no_pending test.log -p 719 -p 1010

Please note:
  - If you want the PID as first column, you need to do that *after*
    sorting by timestamp, which would make the script more complicated.
    I guess this is not needed.
  - The "trap" avoids the script to be aborted before log file
    unification if the user wants to stop strace via Ctrl-C.
  - The pid-numbered logfiles are cleaned up after unification. If you
    still want to keep them, remove the last command.

Enjoy!
-- 
Alexander Kriegisch (kriegaex)
http://freetz.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: strace_no_pending
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20120308/7a7753ae/attachment.ksh>


More information about the Strace-devel mailing list