Skip to main content

Julia Evans

More practical uses for strace!

In yesterday’s blog post on using strace to avoid reading Ruby code I asked the Internet for some more suggestions of practical uses for strace.

There were so many excellent suggestions that I couldn’t not share!

Mike English pointed me to this wonderful blog post
Tools for Debugging Running Ruby Processes he wrote about using strace, lsof, and gdb to debug a running Ruby processes. He remarks that some of the things are like open-heart surgery – you can go into a running Ruby process and execute code using gdb, but you might kill the process. Super cool and definitely worth a read.

Some more great suggestions of what to do with strace:

Look for the ‘open’ system call!

A suggestion to also use ltrace:

I didn't know syscall tracing was a thing! This seems very worthy of investigation.

Here are some slides by Greg Price with a bunch of great suggestions for fixing various problems, as well as his blog post Strace - The Sysadmin’s Microscope from the wonderful ksplice blog.

Alex Clemmer wrote a super cool post on using dtruss (strace, but for OS X/BSD) to try to better understand concurrency primitives: The unfamiliar world of OS X syscalls.

Using strace to avoid reading Ruby code Pair programming