# Stepping Through Ruby

**URL:** <https://www.ruby-forum.com/t/stepping-through-ruby/170231>\
**Category:** Ruby\
**Created:** [June 14, 2009, 4:17pm UTC](https://www.ruby-forum.com/t/stepping-through-ruby/170231 "2009-06-14T16:17:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [June 14, 2009, 4:17pm UTC](https://www.ruby-forum.com/t/stepping-through-ruby/170231/1 "2009-06-14T16:17:28Z")

</div>

In VBA you can step through the code and at any point examine all the  
state. Is there any similar facility for Ruby?

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [June 14, 2009, 4:24pm UTC](https://www.ruby-forum.com/t/stepping-through-ruby/170231/2 "2009-06-14T16:24:33Z")

</div>

On Sun, Jun 14, 2009 at 3:17 PM, Mike S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ## In VBA you can step through the code and at any point examine all the state. Is there any similar facility for Ruby?
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

There is a debugger for ruby which you use through the shell. There’s a  
pretty good run through of it over at [railscasts.com](http://railscasts.com):

> **[\#54 Debugging with ruby-debug - RailsCasts](http://railscasts.com/episodes/54-debugging-with-ruby-debug)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

Take a look.

Ben

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [June 18, 2009, 2:01am UTC](https://www.ruby-forum.com/t/stepping-through-ruby/170231/3 "2009-06-18T02:01:25Z")

</div>

Ben L. wrote:

> There is a debugger for ruby which you use through the shell. There’s a  
> pretty good run through of it over at [railscasts.com](http://railscasts.com):
> 
> [#54 Debugging with ruby-debug - RailsCasts](http://railscasts.com/episodes/54-debugging-with-ruby-debug)
> 
> Take a look.
> 
> Ben

and…unfortunately, the gem version of it - ruby-debug, which is much  
more usable than the built in version, doesn’t work with 1.9. Sigh.

t.

–

```auto
Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< removed_email_address@domain.invalid >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

```

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [June 19, 2009, 2:32pm UTC](https://www.ruby-forum.com/t/stepping-through-ruby/170231/4 "2009-06-19T14:32:07Z")

</div>

2009/6/18 John W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> On Sun, Jun 14, 2009 at 10:17 AM, Mike S.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > In VBA you can step through the code and at any point examine all the  
> > state. Is there any similar facility for Ruby?
> 
> In addition to ruby-debug, Netbeans, RubyMine and Eclipse (via Aptana)  
> all provide this capability.

Perhaps I should install one of those and try them out?

But seriously, I have not really longed for this feature recently.

I sometimes use gdb for C code because it’s harder to add debugging  
output there with all the recompilation and stuff. However, I have  
observed that machine instructions are apparently small enough that  
the principle of uncertainty known from the quantum theory applies. By  
observing your code with a debugger you may cause it to behave  
differently than how it behaves otherwise. These cases are quite rare  
but the more insidious are the resulting problems.

In theory you write tests for your code and if fitting multiple pieces  
together fails you write more tests that cover more cases, perhaps  
ones that were uninteresting previously but became some sort of  
turning points when multiple pieces of code interact.

As you might not see because I haven’t published my code I have not  
written the tests so I ended up writing ad-hoc tests for cases that  
fail and debug those which is somewhat harder after the fact. Having  
the tests ready would certainly make it easier to understand how  
things fail, probably even more so than having a debugger.

Thanks

Michal

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [June 19, 2009, 6:48pm UTC](https://www.ruby-forum.com/t/stepping-through-ruby/170231/5 "2009-06-19T18:48:11Z")

</div>

Step into/out/over, callstack navigation, tracepoints, breakpoints,  
break on hitcount, conditional breakpoints, watch variables, locals,  
autos, drilldown into objects, hover-and-drilldown (etc.)

[http://www.sapphiresteel.com/Debugging-Ruby-with-the-Cylon](http://www.sapphiresteel.com/Debugging-Ruby-with-the-Cylon)

best wishes  
Huw

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [June 18, 2009, 3:17am UTC](https://www.ruby-forum.com/t/stepping-through-ruby/170231/6 "2009-06-18T03:17:27Z")

</div>

On Sun, Jun 14, 2009 at 10:17 AM, Mike S.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> In VBA you can step through the code and at any point examine all the  
> state. Is there any similar facility for Ruby?

In addition to ruby-debug, Netbeans, RubyMine and Eclipse (via Aptana)  
all provide this capability.

John
