Take the 2-minute tour ×

When running strace on a multithreaded program I get results like this:

[pid 14778] futex(0x7fd8082f266c, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x7fd8082f2668, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1} <unfinished ...>
[pid 14780] <... futex resumed> )       = 0

Notice the arguments are on one line with <unfinished...> and the result is on another line with <...resumed>. Not having arguments correlated with their results reduces the utility of strace. Is it possible to make strace print the results and the arguments on the same line when tracing a multithreaded program?

share|improve this question

migrated from serverfault.com May 18 '12 at 15:54


if I output to files using -ff -o I can get the result I'm looking for. However, I would prefer writing the output to my console instead of a hundred different files. :) –  benmmurphy May 18 '12 at 15:28
.. but there's a chronology problem: that particular mutex operation really does start in one thread, block that thread, and cause a return in another thread. –  pjc50 May 18 '12 at 15:37
i would't mind if it printed: syscall(args) = unfinished, resumed: syscall(args) = result. that doesn't have a chronological problem and i can still match args to a result. the problem is the second line it prints at the moment is syscall(resumed) = result which is not very useful to me. –  benmmurphy May 18 '12 at 15:39
oh.. i see what you are talking about. the futex operation :).. does it really do that? block on one thread and return to another? –  benmmurphy May 18 '12 at 15:43
The "[pid number]" at the start of the line is different, so that's what it looks like, and it makes sense for a mutex wake operation. –  pjc50 May 18 '12 at 15:51
add comment

1 Answer

up vote 4 down vote accepted

use strace -ff cmd 2> log.out

share|improve this answer
this doesn't work for me. probably because i have an old version of strace :( –  benmmurphy May 18 '12 at 19:22
add comment

Your Answer


