the blog
Back to -Blog

Hovering DrillDown Debugging - The Ruby Way

Why a Ruby IDE needs interactive debugging...
by Huw Collingbourne
Tuesday 28 November 2006.

I’ve always thought that drill-down debugging is pretty neat – and hovering drill-down debugging is even neater. At any rate, it would be really neat for Ruby - if only it could be done…

GIF - 6.7 kb
This is the Developer Edition Watch window showing how to drill-down inside watched variables

First a word on drill-down. We’ve had drag-and-drop watch variables for some time in the free Personal Edition of Ruby In Steel. The two main limitations of the PE’s Debugger are speed (or lack thereof) and ‘flat’ watch variables. As we’ve said before, the Developer Edition addresses both these problems. Its Cylon debugger is very fast indeed; and its watch variables are no longer of the flat variety.

By ‘flat’ I mean that each variable displays its internal detail as a single line of text. When you are dealing with complex structures – Hashes containing arrays, containing hashes containing arrays or whatever – trying to make sense of all that data can be hard work, to say the least.

In the Developer Edition of Ruby In Steel, watch variables are displayed in the form of a list, each item of which shows the ‘top level’ detail of a variable: its name (say myvar), its value (say “Hello World”) and its type (String). Some objects may contain further levels of detail. In this case, a + sign appears to its left and you can click this to open up a level so that, for instance, a Hash called myhash can be opened to show all its name-value pairs as the branches of a collapsible outline. If one of these branches contains some other expandable structure (another Hash, maybe?) then it will have a + sign which you can click to open up another level of detail and so on…

This is all fine and dandy and very useful. However, it’s not quite as interactive as I’d like. I’ve always been keen on the way in which Smalltalk lets you try out bits of code on the fly. This explains why, from the earliest days of its alpha development, Ruby In Steel has had an interactive Ruby console. In the Console you can interact with Ruby programs using a docked window rather than having to drop down into the dismal world of the command prompt. When you are debugging, and have stopped at a breakpoint, the Ruby Console also acts as a little ‘try-and-test’ workspace. You can enter mathematical expressions such as…

1+2

…and the Console will duly display the answer:

3

Or you can invoke the methods of some object by entering something like:

"Hello World".downcase

..and sure enough, the answer appears:

"hello world"

(above) The interactive Ruby Console

Or you can examine the values of variables by entering the variable name. For example, if you have a complicated Hash called myhash, you would just enter its name and…. urgh! the Console replies by displaying an enormously long line of text giving impenetrable details of the internal data of the Hash and all its constituents. Just like the bad old days, in fact. Ah, wouldn’t it be so much nicer if you could just hover your mouse over the variable name and drill-down inside it, as you can using the watch window…

Well, the good news is that now you can! We’ve just added this feature to the Developer Edition. See what you think ;-)

...and finally! Drill-down hovering debugging from right inside the Ruby Console!

Bookmark and Share   Keywords:  development
  • Summary information for expandable items?
    28 November 2006, by Alex

    Hovering debugging looks great!

    It would also be nice to be able to specify some sort of summary information to display instead of [...] next to expandable items. It can be done via autoexp.dat for C++, perhaps something similar would work for Ruby as well?

    • Summary information for expandable items?
      30 November 2006, by Dermot

      I’ll have a look at that. I wasn’t aware of autoexp.dat (thanks for pointing it out). We’re looking into providing a much better custom debug viewer, better tailored to Ruby. It would be nice to make it use configurable as well via autoexp.dat.

      Dermot

© SapphireSteel Software 2014