# Debugging Ruby

**URL:** <https://www.ruby-forum.com/t/debugging-ruby/85513>\
**Category:** Ruby\
**Created:** [February 14, 2007, 5:02am UTC](https://www.ruby-forum.com/t/debugging-ruby/85513 "2007-02-14T05:02:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bruparel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@bruparel](https://www.ruby-forum.com/u/bruparel)\
**Post date:** [February 14, 2007, 5:02am UTC](https://www.ruby-forum.com/t/debugging-ruby/85513/1 "2007-02-14T05:02:30Z")

</div>

I am starting chapter 13 or Programming Ruby trying to debug the  
following factorial program (in file t.rb) on page 163:

def fact(n)  
if n \<= 0  
1  
else  
n \* fact(n -1)  
end  
end

p fact(5)

When I run the command:  
ruby -r debug t.rb  
Instead of the debugger loading t.rb program, it loads something else  
and displays the following output:

C:\RubyPrograms\PickAxeBook\>ruby -r debug t.rb  
Debug.rb  
Emacs support available.

c:/ruby/lib/ruby/site\_ruby/1.8/ubygems.rb:10:require ‘rubygems’

I am not sure what is happening here. Please note that I am on Windows  
XP machine. When I try to list by typing list 1-9, the following output  
is displayed. I may have messed up the ruby path loader since I was  
messing with it. Why did it persist across the sessions though?

(rdb:1) list 1-9  
[1, 9] in c:/ruby/lib/ruby/site\_ruby/1.8/ubygems.rb  
1 # This file allows for the running of rubygems with a nice  
2 # command line look-and-feel: ruby -rubygems foo.rb  
3 #–  
4 # Copyright 2006 by Chad F., Rich Kilmer, Jim W. and  
others.  
5 # All rights reserved.  
6 # See LICENSE.txt for permissions.

This totally perplexes me. Help!!!  
Bharat

---

<div class="post-metadata">

**Author:** ![bruparel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@bruparel](https://www.ruby-forum.com/u/bruparel)\
**Post date:** [February 14, 2007, 5:11am UTC](https://www.ruby-forum.com/t/debugging-ruby/85513/2 "2007-02-14T05:11:22Z")

</div>

This is getting stranger! I rebooted in Fedora Core 5 Linux (I have a  
dual boot machine). Copied the same program from Windows partition and  
ran it in Linux. Works perfect!

Any clues on how to troubleshoot on Windows side?  
Thanks in advance.  
Bharat

---

<div class="post-metadata">

**Author:** ![bruparel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@bruparel](https://www.ruby-forum.com/u/bruparel)\
**Post date:** [February 14, 2007, 8:28am UTC](https://www.ruby-forum.com/t/debugging-ruby/85513/3 "2007-02-14T08:28:47Z")

</div>

On Behalf Of Bharat R.:

# Any clues on how to troubleshoot on Windows side?

set RUBYOPT=

kind regards -botp

---

<div class="post-metadata">

**Author:** ![bruparel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@bruparel](https://www.ruby-forum.com/u/bruparel)\
**Post date:** [February 14, 2007, 3:42pm UTC](https://www.ruby-forum.com/t/debugging-ruby/85513/4 "2007-02-14T15:42:29Z")

</div>

Thank you.  
Bharat
