[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Rails->breakpointer->irb->debugger?

Dan Bensen

9/14/2006 5:56:00 AM

How do you step through your Rails code from irb? Can you drop
into the debugger, or do you have put in a zillion breakpoints?
Is there a way to add & delete breakpoints from irb,
or do you have to set them all before you request a page?
--
My name is dsb, and I'm at prairienet, which is an O-R-G.
5 Answers

A. S. Bradbury

9/14/2006 10:21:00 AM

0

On Thursday 14 September 2006 06:55, Dan Bensen wrote:
> How do you step through your Rails code from irb? Can you drop
> into the debugger, or do you have put in a zillion breakpoints?
> Is there a way to add & delete breakpoints from irb,
> or do you have to set them all before you request a page?

I think you'll like ruby-breakpoint[1]. Just put 'breakpoint' anywhere in your
code, and at that point you'll drop to an irb session where you can inspect
variables, and basically do whatever you want.

If that's not what you want, try googling for tutorials on using the Ruby
debugger.

Regards,
Alex

1. http://ruby-breakpoint.ruby...

Geoff Davis

9/14/2006 12:36:00 PM

0

On Thu, 14 Sep 2006 00:56:04 -0500, Dan Bensen wrote:

> How do you step through your Rails code from irb? Can you drop into the
> debugger, or do you have put in a zillion breakpoints? Is there a way to
> add & delete breakpoints from irb, or do you have to set them all before
> you request a page?

Check out ruby-debug.

http://www.datanoise.com/articles/2006/07/12/tutorial-on-...

http://blog.nanorails.com/articles/2006/07/14/a-better-rails-debugger-...

The docs are a little out of date -- you'll also need to call
Debugger.start before your debugger call.

Dan Bensen

9/14/2006 6:24:00 PM

0

Geoff Davis wrote:
> Check out ruby-debug.

Thanks, that sounds like what I'm looking for.

--
My name is dsb, and I'm at prairienet, which is an O-R-G.

Rick DeNatale

9/14/2006 7:32:00 PM

0

On 9/14/06, Geoff Davis <geoff@phds.org> wrote:
> On Thu, 14 Sep 2006 00:56:04 -0500, Dan Bensen wrote:
>
> > How do you step through your Rails code from irb? Can you drop into the
> > debugger, or do you have put in a zillion breakpoints? Is there a way to
> > add & delete breakpoints from irb, or do you have to set them all before
> > you request a page?
>
> Check out ruby-debug.

I finally got around to trying this, I'd installed the gem some time ago.

I tried it on a ruby script which takes parameters, but it doesn't
seem to work, the usage seems to indicate that you can give parameters
after the script name but rdebug seems to parse and choke on them
itself.

$ rdebug myscript -b 10
ruby-debug 0.4.1
Usage: rdebug [options] <script.rb> <script.rb parameters>

Options:
-s, --server Listen for remote connections
-w, --wait Wait for a client connection,
implies -s option
-n, --nostop Do not stop when a client
connects, implies -s option
-c, --client Connect to remote debugger
-h, --host HOST Host name used for remote debugging
-p, --port PORT Port used for remote debugging
--script FILE Name of the script file to run
--cport PORT Port used for contol commands,
implies -s option

Common options:
--help Show this message
-v, --version Show version

invalid option: -b


--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...

Rick DeNatale

9/14/2006 8:31:00 PM

0

On 9/14/06, Kent Sibilev <ksruby@gmail.com> wrote:
> On 9/14/06, Rick DeNatale <rick.denatale@gmail.com> wrote:

> > $ rdebug myscript -b 10
> > ruby-debug 0.4.1
> > Usage: rdebug [options] <script.rb> <script.rb parameters>
> >
> >
> $rdebug myscript -- -b 10

Muchos Arrigato, mon ami!

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...