strace vs ltrace

Two tools; different layers.

strace: syscall-level

strace traces system calls at the process-to-kernel boundary. The right tool for IO, network, and child-process debugging where the answer lives in what the process asked the kernel to do.

ltrace: library-call-level

ltrace traces library function calls at the application-to-library boundary. Closer to application semantics than strace; the right tool for memory and library-API issues where the answer lives at a higher abstraction layer.

When to use which

The decision is layer-driven. Syscall-layer issues belong to strace; library-layer issues belong to ltrace; both are safer than attaching gdb to a running production process.

Operating in production

Both tools add overhead. Brief attaches only, save output to a file, document the detach plan; forgetting an attached strace can degrade a production process for hours.