How to use rdebug in ruby script

Hi,

how to use rdebug in a pure ruby script file.Please me

thanks,

Nike

how to use rdebug in a pure ruby script file.Please me

I’ve wondered that myself.
If you’re using MRI I’d recommend using ‘ruby-debug’ gem, then it’s like

require ‘rubygems’
require ‘ruby-debug’
debugger # somewhere in your script

how to use rdebug in a pure ruby script file.Please me
require ‘rdebug’ at the location where you want to start debugging.
That worked for me

Marc W.

require ‘rdebug’ at the location where you want to start debugging.
That worked for me

Which rdebug is it loading (“gem which rdebug”)? My system doesn’t seem
to have that file.
When I do a
require ‘debug’
it drops me to a console, but then doesn’t seem to know how to deal with
the sourcefile right.

E:\dev\ruby\p2pwebclient\final>ruby -v long.rb
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-mingw32]
Debug.rb
Emacs support available.

long.rb:3:
(rdb:1) list
[-2, 7] in long.rb
No sourcefile available for long.rb

But maybe that’s just a windows thing.
-r

Excerpts from Roger P.'s message of Sun Feb 14 04:21:04 +0100 2010:

require ‘rdebug’ at the location where you want to start debugging.
That worked for me

Which rdebug is it loading (“gem which rdebug”)? My system doesn’t seem
to have that file.
When I do a
require ‘debug’

Sorry, I mixed them up: rdebug is not debug. I was talking about the
require ‘debug’ only which was good enough for me.

Marc W.