--_000_46970D5AD6A83F4889B8997C9A2B0F970C8E232B63NOKEUMSG05mgd_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi,
I want to debug a ruby script using -rdebug option.
The following is the source code: with file fact.rb.
Fact.rb
def fact(n)
return 1 if n == 0
f = 1
n.downto(1) do |i|
f *= i
end
return f
end
print fact(2), "\n"
Debugging
When I run the following command and type 'n' for debugin the next line, its going in to some other files.
As shown below.
C:\ruby\samples\RubySrc-1.8.6-p111\sample>ruby -rdebug fact.rb
Debug.rb
Emacs support available.
c:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:10:require 'rubygems'
(rdb:1) list
[5, 14] in c:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb
5 # All rights reserved.
6 # See LICENSE.txt for permissions.
7 #++
8
9
=> 10 require 'rubygems'
(rdb:1) n
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:10:require 'rbconfig'
(rdb:1) n
c:/ruby/lib/ruby/1.8/i386-mswin32/rbconfig.rb:5:module Config
(rdb:1) n
c:/ruby/lib/ruby/1.8/i386-mswin32/rbconfig.rb:153:RbConfig = Config # compatibility for ruby-1.9
(rdb:1) n
c:/ruby/lib/ruby/1.8/i386-mswin32/rbconfig.rb:154:CROSS_COMPILING = nil unless defined? CROSS_COMPILING
(rdb:1) n
c:/ruby/lib/ruby/1.8/i386-mswin32/rbconfig.rb:154:CROSS_COMPILING = nil unless defined? CROSS_COMPILING
(rdb:1) n
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:12:module Gem
(rdb:1) n
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:18:module Kernel
(rdb:1)'
What is the command that iam supposed to used to debug actual source code, line by line( with out moving to other files)?
Thanks and Regards,
Anil kumar
--_000_46970D5AD6A83F4889B8997C9A2B0F970C8E232B63NOKEUMSG05mgd_--