Troubleshooting Ruby Processes: Leveraging System Tools when the Usual Ruby Tricks Stop Working
by Philippe Hanrigou
Section #5. gdb
gdb is a popular, free, and open source debugger, available on (almost) all UNIX platforms.9 It offers “out of the box” support for a variety of languages (including C, C++, Objective-C, and Fortran) but not (yet) for Ruby. Nevertheless, as the standard Ruby interpreter is implemented in C, you can easily get the C-level view for any Ruby process in gdb: inspect currents threads, visualize C-level backtraces, walk the stack, and so on. I will not describe this in much detail, because there is plenty of documentation for C debugging with gdb (http://sourceware.org/gdb/current/onlinedocs/gdb_toc.html).
The nice thing about gdb, though, is that you can use a couple of tricks to get a Ruby stack trace in parallel with a C-level backtrace. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access