[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Connecting to a running ruby process

Piyush Ranjan

1/19/2009 9:22:00 AM

[Note: parts of this message were removed to make it a legal post.]

Hi!
Is there any way you can connect to a running ruby process (for instance a
mongrel) and 'talk' to it like we can do in lisp using slime ?
For instance in you may connect to a running lisp image (like a hunchentoot
web server) and inspect variables as they get created and destroyed. I find
such a 'back-door'(if we may call it) very powerful. I remember there was
something called a breakpoint or debug built into rails. However that is not
what I am actually looking at.

Piyush

2 Answers

Jakub Pavlík jn.

1/19/2009 10:03:00 AM

0

> Hi!
> Is there any way you can connect to a running ruby process (for instance a
> mongrel) and 'talk' to it like we can do in lisp using slime ?
> For instance in you may connect to a running lisp image (like a hunchentoot
> web server) and inspect variables as they get created and destroyed. I find
> such a 'back-door'(if we may call it) very powerful. I remember there was
> something called a breakpoint or debug built into rails. However that is not
> what I am actually looking at.
>
> Piyush

Look at LiveConsole:
http://rubyforge.org/projects/liv...
(Maybe it isn't directly what you need, but it might help)

--
"Configure complete, now type 'make' and PRAY."

(configure script of zsnes - www.zsnes.com)

Brian Candler

1/19/2009 10:32:00 AM

0

Piyush Ranjan wrote:
> Hi!
> Is there any way you can connect to a running ruby process (for instance
> a
> mongrel) and 'talk' to it like we can do in lisp using slime ?

Try the ruby-debug gem (which is what rails uses). Unfortunately, the
supplied documentation is pretty poor, but there is a pretty good doc at
http://bashdb.sourceforge.net/ruby-...

Separate process debugging can be done via rdebug command line flags, or
by calling Debugger methods explicitly:

$ cat p1.rb
require 'rubygems'
require 'ruby-debug'

Debugger.wait_connection = true
Debugger.start_remote
Debugger.post_mortem

Debugger.breakpoint
a = 1 - 1
b = 2 / a
c = a + b
puts c

$ ruby p1.rb

In another window: rdebug -c to single step, inspect variables etc. in
the first process.
--
Posted via http://www.ruby-....