Debugging Ruby

Discussion in 'Ruby' started by Bharat Ruparel, Feb 14, 2007.

  1. 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 Fowler, Rich Kilmer, Jim Weirich and
    others.
    5 # All rights reserved.
    6 # See LICENSE.txt for permissions.

    This totally perplexes me. Help!!!
    Bharat

    --
    Posted via http://www.ruby-forum.com/.
     
    Bharat Ruparel, Feb 14, 2007
    #1
    1. Advertising

  2. 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

    --
    Posted via http://www.ruby-forum.com/.
     
    Bharat Ruparel, Feb 14, 2007
    #2
    1. Advertising

  3. T24gQmVoYWxmIE9mIEJoYXJhdCBSdXBhcmVsOg0KIyBBbnkgY2x1ZXMgb24gaG93IHRvIHRyb3Vi
    bGVzaG9vdCBvbiBXaW5kb3dzIHNpZGU/DQoNCnNldCBSVUJZT1BUPQ0KDQpraW5kIHJlZ2FyZHMg
    LWJvdHANCg==
     
    Peña, Botp, Feb 14, 2007
    #3
  4. Bharat Ruparel, Feb 14, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Johann Blake
    Replies:
    1
    Views:
    1,243
    Hermit Dave
    Jan 5, 2004
  2. jacob navia

    Debugging C vs debugging C++

    jacob navia, Oct 26, 2006, in forum: C Programming
    Replies:
    11
    Views:
    625
    Ian Collins
    Oct 27, 2006
  3. AAaron123
    Replies:
    3
    Views:
    690
    AAaron123
    Jul 28, 2009
  4. Steve Conover, Jr
    Replies:
    1
    Views:
    125
    Christoph Tapler
    Sep 9, 2003
  5. anne001
    Replies:
    1
    Views:
    591
Loading...

Share This Page