strace is pretty handy on Linux for profiling processes, including attaching to a running one and WTF-ing it.
It turns out that there’s a Mac equivalent, dtrace
1. If you skip past the instructions on how to use the terminal and using top
, there are some good examples of using dtrace
, including a lot more than just profiling system calls.
1 Calling it a Mac app is slightly misleading; it comes from Sun. But to someone used to strace
on Linux who is using a Mac, dtrace
is the equivalent.