Rails->breakpointer->irb->debugger?

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?

On Thursday 14 September 2006 06:55, Dan B. 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.rubyforge.org/

On Thu, 14 Sep 2006 00:56:04 -0500, Dan B. 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://blog.nanorails.com/articles/2006/07/14/a-better-rails-debugger-ruby-debug

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

Geoff D. wrote:

Check out ruby-debug.

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

On 9/14/06, Rick DeNatale [email protected] wrote:

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

$rdebug myscript – -b 10

On 9/14/06, Kent S. [email protected] wrote:

On 9/14/06, Rick DeNatale [email protected] 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.denhaven2.com/

On 9/14/06, Geoff D. [email protected] wrote:

On Thu, 14 Sep 2006 00:56:04 -0500, Dan B. 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.denhaven2.com/