You can also use gdb to debug more than just C code.
I used to know a DBA that had symbols installed on the production database server so he could attach a debugger to the running Postgres backend process, and use the backtrace to tell you what the query was doing and why it was running slowly.
Also, note that running strace on a production process can change its observed behavior. http://man7.org/linux/man-pages/man2/ptrace.2.html