In my own experience, here’s what a good debugger needs:
- breakpoints (with conditions even better)
- object list (locals, globals, objects)
- 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.