Once I added support for multi-threaded debugging for Ruby programs in Komodo, Rails debugging followed.
No configuration necessary here. Load at least two files — the Webrick server in the <rails-app>/script directory, and a controller you want to break in. Set breakpoints in the controller. Start the Webrick server, wait for those three lines it emits telling you it’s handling requests, then use a browser to hit the controller, and …
It just works. It’s better than using the current breakpointer functionality that ships with Rails, since not only can you analyze variable values, but you can also change them. And you can step in and out of functions, and get a better idea of how Rails does its thing. At times I think the debugger will be more useful for those working on Rails than with Rails, but I’m sure when controller and model
functions get larger than the samples in the Agile book, the debugger will become more useful to application developers.
There are only two problems. First, it won’t be widely available until the next version of Komodo 3.x goes out. To get an early drop try writing to komodo-feedback and we’ll take it from there, but I can’t guarantee anything.
Second, it’s still a relatively heavy way of debugging. Where "heavy" is a euphemism for "slow". I’ll be doing some optimization of the debugger to speed it up, but I’m still at the stage of getting all the functionality in place and working correctly.
I dealt with the speed problem by adding support for the "Pause" button. Ruby’s thread model made this very easy, although to explain why would be getting more into the internals of the debugger engine, a topic best left for a future post. But when you think a program isn’t getting anywhere, it’s reassuring to press the Pause button and see that it is moving towards a target.
In the meantime I’ve been having fun pressing a button on a web page, and watching Komodo pop up with the yellow line indicating that the program is paused at a line of code.
Wow, that sounds very interesting and promising. Is Komodo available freely so I could see this in action? (Once the new version is out.)
Just wondering about this:
> It's better than using the current breakpointer functionality that ships with Rails, since not only can you analyze variable values, but you can also change them.
This at least is also possible with ruby-breakpoint. It might well be the case that Komodo does this in a more integrated fashion where hovering over variable names will display the value or similar — is this the case?
Regarding the slowness: I guess this is related to using a trace_func? ruby-breakpoint currently only utilizes temporary trace funcs for getting the caller's context from breakpoint() calls and to make the "Retry with breakpoint" feature from error screens work. As you said this has the downside of not offering support for stepping.
The alpha is available freely for OS X only. Komodo is a commercial product, but you can get a free evaluation.
As for changing variables, I didn't realize you could do it with ruby-breakpoint. As you imagine, you can hover over variable names and have their values pop up.
And the trace-function is the source of the slowdown. I did some benchmarks to show that debugging a Rails app with Komodo is about as slow s debugging it with the standard Ruby debugger, which is also based on a trace-func written in pure Ruby. Which tells me that at least the Komodo debugger isn't abjectly slow.
I considered using a just-in-time trace-func. The main problem is that caller() doesn't expose bindings doesn't expose arbitrary stack frames. I use the stack of bindings to show values of local and object variables as you move up and down the call stack.
Python debugging uses a similar architecture, and we found rewriting the Python debugger engine in C increased performance literally by orders of magnitude.
I, as a Rails enthusiast, would love to see full IDE features somewhere. If Komodo can do it, awesome. I've tried Komodo in the past for Perl and Python, and I had crashing problems.
As much as I desperately want a Rails IDE yesterday, it's even more important that it be bulletproof. If Komodo is bulletproof with modern IDE features for Rails programming, I'll buy the Pro version!
Keep up the good work.
As a person who has been buying Komodo since its inception and someone who has just recently been turned on to Rails and Ruby in general, I'm VERY excited about this project. I can't wait until it becomes available in full release form.