Ruby In Steel 1

Back to -Tutorials -Sapphire (Ruby In Steel) Tutorials -Archives -Ruby In Steel 1

Dynamic Debugging In Ruby

How to Change Your Program While Debugging!

With Dynamic Debugging you can modify a program while it is being debugged. For example, here I have created a new variable, treasures in the Immediate Window, and then I’ve added it to the Watch window. The drill-down debugger lets me look inside the variable by hovering over its name or expanding it in one of the debugging views.

Changing the value of a simple variable while debugging may not seem all that remarkable. But how about changing the internal structure of objects right inside one of the debugging windows or even creating completely new objects while stopped at a breakpoint? This is what I mean by ‘dynamic debugging’ and it’s just one of the features that we’ve added to the new version of the Cylon debugger.

If you are used to debugging C#, you may take for granted the ability to change the value of a selected variable while debugging. The Cylon debugger for Ruby not only lets you change the value of a variable...

But also its data type...

It doesn’t need to be a simple data type either. You could change a simple String variable, for example, into any object type...

...such as an instance of a custom class...

You can even evaluate code to create new objects right inside the watch window...

Or, using the immediate window you could create new variables and assign new objects to them...

...which can then be watched in the other debugging windows...

This is a simple example of a very powerful capability - allowing you to perform complex tests and trials by modifying a program during an active debugging session.

For more information on the debugging enhancements in Cylon 1.2 see ‘Ruby Debugger Enhancements - Conditional Breakpoints, Tracepoints and more’.

Bookmark and Share   Keywords:  debugger
© SapphireSteel Software 2014