GDB: A Gentle Intro
summary
GDB attaches to a running Ruby process so you can attach to a PID, set breakpoints like break at RB_array_unique_bang, and inspect threads and stacks; an example shows two threads stuck in pthread_cond_wait and uses thread apply all bt to confirm a deadlock. Breakpointing into C reveals MRI internals, calling rb_p to print Ruby values and RB_backtrace to get Ruby-level traces; rubygems can call methods before script start so --disable-gems helps. A scripted nrdebug and Docker images with debug symbols prove useful.
AI-written summary · about
chapters (25)
- 0:00Introduction
- 0:47Process deadlocks
- 1:18What is GDB
- 3:10GDB output
- 8:39Review
- 10:05Unique Bang
- 13:22Ruby Documentation
- 13:54C Functions
- 18:15Running Program
- 20:32Display
- 21:01Memory Location
- 22:05structs
- 26:57Display Variables
- 28:09RB Backtrace
- 31:35Return nil
- 32:30Array make hash
- 33:33Array length
- 34:35Documentation
- 34:51Debug Output
- 36:11Debug Printing
- 37:38Automation
- 39:00Recap
- 39:17Crazy tricks
- 39:38Conclusion
- 40:02Questions








