Netbeans 6.9.1 and Ruby debugging
Some notes made while trying to get Netbeans 6.9.1 to debug Rails applications running on various Ruby stacks.
First and foremost, no success at all trying to use the Ruby debugging support internal to Netbeans with any combination of stacks based on Ruby MRI 1.8.6. Mind you, in every case, the code ran flawlessly under Netbeans, just not in debug mode.
When trying to run attaching the debugger to an external Ruby interpreter running in debug mode, success every time.
Combinations that were tried and succeeded. Others too numerous to mention failed somewhere along – compile, install, etc.
| OS | Ruby | RubyGems | ruby-debug-ide | ruby-debug-base | linecache |
|---|---|---|---|---|---|
| OS X 10.6.4 | 1.8.6 p111 | 1.0.1 | 0.4.4 | 0.10.3 | 0.3 |
| OS X 10.6.4 | 1.8.6 p111 | 1.3.3 | 0.4.9 | 0.10.3 | 0.43 |
| OS X 10.6.4 | 1.8.6 p111 | 1.3.5 | 0.4.9 | 0.10.3 | 0.43 |
No testing with Ruby debugging under jRuby in any combination. That’s yet to come.
A few conclusions (may be obvious to some!):
- The combination of Ruby and RubyGems version is critical
- It seems, after RubyGems 1.1 (more likely 1.2), the debug support stabilized
- With RubyGems 1.3.x, the latest debug support is likely the best.
A final note, not particularly related to debugging, but rather to multiple Ruby platform support in Netbeans.
Using the same base version of Ruby for all the tests led to unmitigated user confusion when configuring the different stacks – Tools > Ruby Platforms.
An egregious hack that hasn’t appeared to hurt anything is to manually edit the file ~/.netbeans/6.9/build.properties and add some text to the ruby_version tag for each different Ruby installation to differentiate one from another.
An example
In a console, run a command similar to:
rdebug-ide _0.4.9_ -p 7000 -d -- mongrel_rails start
Open the project in Netbeans, Debug > Attach Debugger and accept the defaults. Then use Netbeans debugging tools normally.