In my own experience, here’s what a good debugger needs:
- breakpoints (with conditions even better)
- stepping
- object list (locals, globals, objects)
- watches
- resetting the current instructions
- modify objects
4, 5 or 6 are really icing on the cake, but help separate the men from the boys. Although these can help save a tremendous amount of time, especially when a certain situation is really hard to reproduce because you get several shot at reproducing and fixing the problem in real time.
Best examples I have used (and abused): Steve Jasick’s “The Debugger”, and yes, Visual C++ (before the .net and C# days). Eclipse and the java debugger is not too bad either.
So why is this such an unpopular subject with such a limited support with Ruby and with Rails? Enquiring mind wants to know!
Best usable option in practice: breakpoint.
It meets requirements 1 through 3. Hey, you can even do conditional breakpoints!
Just insert a “breakpoint” call where you want to stop, and then run you app normally.
While you do that, run script/breakpointer to catch the breakpoint (assumes you are on the same machine).
There, you can check out any ruby expression like you can do in irb.
Some useful commands to help find out what’s there:
- local_variables (list of all your local variables (whether initialized yet or no)
- instance_variables (same as self, without the values)
- caller (shows the stack trace, not terribly readable but the information is there)
- methods (list all the method of the class you stopped in)
Just need to tough it up and get on with it till someone comes up with a better alternative. This brings back some fond memories of long ago when command line debuggers where all the rage, and all you had too. But I’m starting to date myself here so I’ll just shut up and set a few breakpoints to relax.
A word to the wise: do me a favor, and remove your breakpoints before deploying on your production environment. This could save you from ridicule. Not that this ever happened to me, right!
I’m very hopeful that the guys are RadRails will find a solution to get it to work faster and more reliably.
My Komodo eval license has run out, but I believe it had much of what you want… however, until I buy it I’m in the same boat as you.
Something I missed somewhere is how to step forward or say “go!” once I’ve hit the breakpoint.
Oh, and as to “caller”, I doubt it would be difficult to print it better or to say “show me the instance variables of my caller” – but I’d need to play with it.
I’ll keep watching your blog for info. Thanks for being here!
My eval of Komod probably expired by now as well. On Kubuntu, the stepping speed was really slow, so that didn’t win me over.
When using breakpointer, you can not step, only continue. To do so, I use ctrl-D (Linux), and I believe you would use CTRL-Z on windows (or type “exit”)
I’m not so hot on full-featured IDEs… which is why my transition to Rails was fairly easy. I prefer the lo-fi approach to development, spending most of my time in breakpoints, script/console, running tests.