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 (

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

Get Troubleshooting Ruby Processes: Leveraging System Tools when the Usual Ruby Tricks Stop Working now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.