Table of Contents
What This Shortcut Covers
Ruby Troubleshooting: The Usual Suspects
raise, puts and debug()
irb or script/console
Writing a Test
Log Files
Sending Signals
Debugger and Breakpointer
Lsof
What is It?
Usage
Typical Usage Scenarios
Combining Multiple Selections
Concrete Examples Using lsof to Troubleshoot a Problem with a Ruby Process
Checking that a Mongrel Cluster is Up and Listening on the Right Ports
Checking that You Are Using a Native Database Driver
Detecting Connection Leaks
Exploring Other Tricks
Exploring Other lsof Options
Repeat Mode
Field Output
Terse Output
What is lsof Good For?
strace
What is It?
Interpreting strace Output
How Do I Find Out About a Specific System Call?
What is strace Good For?
Some Concrete Examples
Hanging Mongrel
Where Did That Library Come From? Peeking at the Load Path
Permission Denied
Other Interesting strace Options
Filtering Options
Tracing Child Processes
Basic System Level Profiling
strace Siblings
Mac OS X
Solaris and OpenSolaris
BSD
Windows
Linux
gdb
The Basics: Attaching to a Running Process and Getting the C-Level Backtrace
Raising a Ruby Exception from gdb to Get the Ruby Stack Trace
Easy Access to your gdb Tricks: Define Macros in .gdbinit
Pushing the Envelope: Evaluate Arbitrary Ruby Code from gdb
A Ruby Interpreter Within gdb
Using gdb Inline Documentation
Learning about Ruby Interpreter Internals
What is gdb Good For?
A Classic Gotcha: Unattachable Processes
Conclusion
Acknowledgments
About the Author