O'Reilly logo

Troubleshooting Ruby Processes: Leveraging System Tools when the Usual Ruby Tricks Stop Working by Philippe Hanrigou

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required